diff --git a/exprtk.hpp b/exprtk.hpp index 7581c4c..2b2b419 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -175,19 +175,25 @@ namespace exprtk return std::string("0"); std::string result; - bool negative = (i < 0); - if (negative) i *= -1; - - while (i) + if (i < 0) { - char digit = '0' + char(i % 10); - result = (digit + result); - i /= 10; + for ( ; i; i /= 10) + { + result += '0' + char(-(i % 10)); + } + + result += '-'; + } + else + { + for ( ; i; i /= 10) + { + result += '0' + char(i % 10); + } } - if (negative) - result = "-" + result; + std::reverse(result.begin(), result.end()); return result; } @@ -335,9 +341,9 @@ namespace exprtk { "break", "case", "continue", "default", "false", "for", "if", "else", "ilike", "in", "like", "and", "nand", "nor", - "not", "null", "or", "repeat", "shl", "shr", "swap", - "switch", "true", "until", "var", "while", "xnor", "xor", - "&", "|" + "not", "null", "or", "repeat", "return", "shl", "shr", + "swap", "switch", "true", "until", "var", "while", "xnor", + "xor", "&", "|" }; static const std::size_t reserved_words_size = sizeof(reserved_words) / sizeof(std::string); @@ -353,14 +359,43 @@ namespace exprtk "like", "log", "log10", "log2", "logn", "log1p", "mand", "max", "min", "mod", "mor", "mul", "ncdf", "nand", "nor", "not", "not_equal", "null", "or", "pow", "rad2deg", - "repeat", "root", "round", "roundn", "sec", "sgn", "shl", - "shr", "sin", "sinc", "sinh", "sqrt", "sum", "swap", + "repeat", "return", "root", "round", "roundn", "sec", "sgn", + "shl", "shr", "sin", "sinc", "sinh", "sqrt", "sum", "swap", "switch", "tan", "tanh", "true", "trunc", "until", "var", "while", "xnor", "xor", "&", "|" }; static const std::size_t reserved_symbols_size = sizeof(reserved_symbols) / sizeof(std::string); + static const std::string base_function_list[] = + { + "abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", + "atan2", "avg", "ceil", "clamp", "cos", "cosh", "cot", + "csc", "equal", "erf", "erfc", "exp", "expm1", "floor", + "frac", "hypot", "iclamp", "like", "log", "log10", "log2", + "logn", "log1p", "mand", "max", "min", "mod", "mor", "mul", + "ncdf", "pow", "root", "round", "roundn", "sec", "sgn", + "sin", "sinc", "sinh", "sqrt", "sum", "swap", "tan", "tanh", + "trunc", "not_equal", "inrange", "deg2grad", "deg2rad", + "rad2deg", "grad2deg" + }; + + static const std::size_t base_function_list_size = sizeof(base_function_list) / sizeof(std::string); + + static const std::string logic_ops_list[] = + { + "and", "nand", "nor", "not", "or", "xnor", "xor", "&", "|" + }; + + static const std::size_t logic_ops_list_size = sizeof(logic_ops_list) / sizeof(std::string); + + static const std::string cntrl_struct_list[] = + { + "for", "if", "repeat", "switch", "while" + }; + + static const std::size_t cntrl_struct_list_size = sizeof(cntrl_struct_list) / sizeof(std::string); + inline bool is_reserved_word(const std::string& symbol) { for (std::size_t i = 0; i < reserved_words_size; ++i) @@ -387,6 +422,45 @@ namespace exprtk return false; } + inline bool is_base_function(const std::string& function_name) + { + for (std::size_t i = 0; i < base_function_list_size; ++i) + { + if (imatch(function_name,base_function_list[i])) + { + return true; + } + } + + return false; + } + + inline bool is_control_struct(const std::string& cntrl_strct) + { + for (std::size_t i = 0; i < cntrl_struct_list_size; ++i) + { + if (imatch(cntrl_strct,cntrl_struct_list[i])) + { + return true; + } + } + + return false; + } + + inline bool is_logic_opr(const std::string& lgc_opr) + { + for (std::size_t i = 0; i < cntrl_struct_list_size; ++i) + { + if (imatch(lgc_opr,logic_ops_list[i])) + { + return true; + } + } + + return false; + } + struct cs_match { static inline bool cmp(const char c0, const char c1) @@ -553,11 +627,11 @@ namespace exprtk } static const double pow10[] = { - 1.0, - 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, - 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, - 1.0E+009, 1.0E+010, 1.0E+011, 1.0E+012, - 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016 + 1.0, + 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, + 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, + 1.0E+009, 1.0E+010, 1.0E+011, 1.0E+012, + 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016 }; static const std::size_t pow10_size = sizeof(pow10) / sizeof(double); @@ -1396,38 +1470,38 @@ namespace exprtk { static const double fract10[] = { - 0.0, - 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, 1.0E+009, 1.0E+010, - 1.0E+011, 1.0E+012, 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016, 1.0E+017, 1.0E+018, 1.0E+019, 1.0E+020, - 1.0E+021, 1.0E+022, 1.0E+023, 1.0E+024, 1.0E+025, 1.0E+026, 1.0E+027, 1.0E+028, 1.0E+029, 1.0E+030, - 1.0E+031, 1.0E+032, 1.0E+033, 1.0E+034, 1.0E+035, 1.0E+036, 1.0E+037, 1.0E+038, 1.0E+039, 1.0E+040, - 1.0E+041, 1.0E+042, 1.0E+043, 1.0E+044, 1.0E+045, 1.0E+046, 1.0E+047, 1.0E+048, 1.0E+049, 1.0E+050, - 1.0E+051, 1.0E+052, 1.0E+053, 1.0E+054, 1.0E+055, 1.0E+056, 1.0E+057, 1.0E+058, 1.0E+059, 1.0E+060, - 1.0E+061, 1.0E+062, 1.0E+063, 1.0E+064, 1.0E+065, 1.0E+066, 1.0E+067, 1.0E+068, 1.0E+069, 1.0E+070, - 1.0E+071, 1.0E+072, 1.0E+073, 1.0E+074, 1.0E+075, 1.0E+076, 1.0E+077, 1.0E+078, 1.0E+079, 1.0E+080, - 1.0E+081, 1.0E+082, 1.0E+083, 1.0E+084, 1.0E+085, 1.0E+086, 1.0E+087, 1.0E+088, 1.0E+089, 1.0E+090, - 1.0E+091, 1.0E+092, 1.0E+093, 1.0E+094, 1.0E+095, 1.0E+096, 1.0E+097, 1.0E+098, 1.0E+099, 1.0E+100, - 1.0E+101, 1.0E+102, 1.0E+103, 1.0E+104, 1.0E+105, 1.0E+106, 1.0E+107, 1.0E+108, 1.0E+109, 1.0E+110, - 1.0E+111, 1.0E+112, 1.0E+113, 1.0E+114, 1.0E+115, 1.0E+116, 1.0E+117, 1.0E+118, 1.0E+119, 1.0E+120, - 1.0E+121, 1.0E+122, 1.0E+123, 1.0E+124, 1.0E+125, 1.0E+126, 1.0E+127, 1.0E+128, 1.0E+129, 1.0E+130, - 1.0E+131, 1.0E+132, 1.0E+133, 1.0E+134, 1.0E+135, 1.0E+136, 1.0E+137, 1.0E+138, 1.0E+139, 1.0E+140, - 1.0E+141, 1.0E+142, 1.0E+143, 1.0E+144, 1.0E+145, 1.0E+146, 1.0E+147, 1.0E+148, 1.0E+149, 1.0E+150, - 1.0E+151, 1.0E+152, 1.0E+153, 1.0E+154, 1.0E+155, 1.0E+156, 1.0E+157, 1.0E+158, 1.0E+159, 1.0E+160, - 1.0E+161, 1.0E+162, 1.0E+163, 1.0E+164, 1.0E+165, 1.0E+166, 1.0E+167, 1.0E+168, 1.0E+169, 1.0E+170, - 1.0E+171, 1.0E+172, 1.0E+173, 1.0E+174, 1.0E+175, 1.0E+176, 1.0E+177, 1.0E+178, 1.0E+179, 1.0E+180, - 1.0E+181, 1.0E+182, 1.0E+183, 1.0E+184, 1.0E+185, 1.0E+186, 1.0E+187, 1.0E+188, 1.0E+189, 1.0E+190, - 1.0E+191, 1.0E+192, 1.0E+193, 1.0E+194, 1.0E+195, 1.0E+196, 1.0E+197, 1.0E+198, 1.0E+199, 1.0E+200, - 1.0E+201, 1.0E+202, 1.0E+203, 1.0E+204, 1.0E+205, 1.0E+206, 1.0E+207, 1.0E+208, 1.0E+209, 1.0E+210, - 1.0E+211, 1.0E+212, 1.0E+213, 1.0E+214, 1.0E+215, 1.0E+216, 1.0E+217, 1.0E+218, 1.0E+219, 1.0E+220, - 1.0E+221, 1.0E+222, 1.0E+223, 1.0E+224, 1.0E+225, 1.0E+226, 1.0E+227, 1.0E+228, 1.0E+229, 1.0E+230, - 1.0E+231, 1.0E+232, 1.0E+233, 1.0E+234, 1.0E+235, 1.0E+236, 1.0E+237, 1.0E+238, 1.0E+239, 1.0E+240, - 1.0E+241, 1.0E+242, 1.0E+243, 1.0E+244, 1.0E+245, 1.0E+246, 1.0E+247, 1.0E+248, 1.0E+249, 1.0E+250, - 1.0E+251, 1.0E+252, 1.0E+253, 1.0E+254, 1.0E+255, 1.0E+256, 1.0E+257, 1.0E+258, 1.0E+259, 1.0E+260, - 1.0E+261, 1.0E+262, 1.0E+263, 1.0E+264, 1.0E+265, 1.0E+266, 1.0E+267, 1.0E+268, 1.0E+269, 1.0E+270, - 1.0E+271, 1.0E+272, 1.0E+273, 1.0E+274, 1.0E+275, 1.0E+276, 1.0E+277, 1.0E+278, 1.0E+279, 1.0E+280, - 1.0E+281, 1.0E+282, 1.0E+283, 1.0E+284, 1.0E+285, 1.0E+286, 1.0E+287, 1.0E+288, 1.0E+289, 1.0E+290, - 1.0E+291, 1.0E+292, 1.0E+293, 1.0E+294, 1.0E+295, 1.0E+296, 1.0E+297, 1.0E+298, 1.0E+299, 1.0E+300, - 1.0E+301, 1.0E+302, 1.0E+303, 1.0E+304, 1.0E+305, 1.0E+306, 1.0E+307, 1.0E+308 + 0.0, + 1.0E+001, 1.0E+002, 1.0E+003, 1.0E+004, 1.0E+005, 1.0E+006, 1.0E+007, 1.0E+008, 1.0E+009, 1.0E+010, + 1.0E+011, 1.0E+012, 1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016, 1.0E+017, 1.0E+018, 1.0E+019, 1.0E+020, + 1.0E+021, 1.0E+022, 1.0E+023, 1.0E+024, 1.0E+025, 1.0E+026, 1.0E+027, 1.0E+028, 1.0E+029, 1.0E+030, + 1.0E+031, 1.0E+032, 1.0E+033, 1.0E+034, 1.0E+035, 1.0E+036, 1.0E+037, 1.0E+038, 1.0E+039, 1.0E+040, + 1.0E+041, 1.0E+042, 1.0E+043, 1.0E+044, 1.0E+045, 1.0E+046, 1.0E+047, 1.0E+048, 1.0E+049, 1.0E+050, + 1.0E+051, 1.0E+052, 1.0E+053, 1.0E+054, 1.0E+055, 1.0E+056, 1.0E+057, 1.0E+058, 1.0E+059, 1.0E+060, + 1.0E+061, 1.0E+062, 1.0E+063, 1.0E+064, 1.0E+065, 1.0E+066, 1.0E+067, 1.0E+068, 1.0E+069, 1.0E+070, + 1.0E+071, 1.0E+072, 1.0E+073, 1.0E+074, 1.0E+075, 1.0E+076, 1.0E+077, 1.0E+078, 1.0E+079, 1.0E+080, + 1.0E+081, 1.0E+082, 1.0E+083, 1.0E+084, 1.0E+085, 1.0E+086, 1.0E+087, 1.0E+088, 1.0E+089, 1.0E+090, + 1.0E+091, 1.0E+092, 1.0E+093, 1.0E+094, 1.0E+095, 1.0E+096, 1.0E+097, 1.0E+098, 1.0E+099, 1.0E+100, + 1.0E+101, 1.0E+102, 1.0E+103, 1.0E+104, 1.0E+105, 1.0E+106, 1.0E+107, 1.0E+108, 1.0E+109, 1.0E+110, + 1.0E+111, 1.0E+112, 1.0E+113, 1.0E+114, 1.0E+115, 1.0E+116, 1.0E+117, 1.0E+118, 1.0E+119, 1.0E+120, + 1.0E+121, 1.0E+122, 1.0E+123, 1.0E+124, 1.0E+125, 1.0E+126, 1.0E+127, 1.0E+128, 1.0E+129, 1.0E+130, + 1.0E+131, 1.0E+132, 1.0E+133, 1.0E+134, 1.0E+135, 1.0E+136, 1.0E+137, 1.0E+138, 1.0E+139, 1.0E+140, + 1.0E+141, 1.0E+142, 1.0E+143, 1.0E+144, 1.0E+145, 1.0E+146, 1.0E+147, 1.0E+148, 1.0E+149, 1.0E+150, + 1.0E+151, 1.0E+152, 1.0E+153, 1.0E+154, 1.0E+155, 1.0E+156, 1.0E+157, 1.0E+158, 1.0E+159, 1.0E+160, + 1.0E+161, 1.0E+162, 1.0E+163, 1.0E+164, 1.0E+165, 1.0E+166, 1.0E+167, 1.0E+168, 1.0E+169, 1.0E+170, + 1.0E+171, 1.0E+172, 1.0E+173, 1.0E+174, 1.0E+175, 1.0E+176, 1.0E+177, 1.0E+178, 1.0E+179, 1.0E+180, + 1.0E+181, 1.0E+182, 1.0E+183, 1.0E+184, 1.0E+185, 1.0E+186, 1.0E+187, 1.0E+188, 1.0E+189, 1.0E+190, + 1.0E+191, 1.0E+192, 1.0E+193, 1.0E+194, 1.0E+195, 1.0E+196, 1.0E+197, 1.0E+198, 1.0E+199, 1.0E+200, + 1.0E+201, 1.0E+202, 1.0E+203, 1.0E+204, 1.0E+205, 1.0E+206, 1.0E+207, 1.0E+208, 1.0E+209, 1.0E+210, + 1.0E+211, 1.0E+212, 1.0E+213, 1.0E+214, 1.0E+215, 1.0E+216, 1.0E+217, 1.0E+218, 1.0E+219, 1.0E+220, + 1.0E+221, 1.0E+222, 1.0E+223, 1.0E+224, 1.0E+225, 1.0E+226, 1.0E+227, 1.0E+228, 1.0E+229, 1.0E+230, + 1.0E+231, 1.0E+232, 1.0E+233, 1.0E+234, 1.0E+235, 1.0E+236, 1.0E+237, 1.0E+238, 1.0E+239, 1.0E+240, + 1.0E+241, 1.0E+242, 1.0E+243, 1.0E+244, 1.0E+245, 1.0E+246, 1.0E+247, 1.0E+248, 1.0E+249, 1.0E+250, + 1.0E+251, 1.0E+252, 1.0E+253, 1.0E+254, 1.0E+255, 1.0E+256, 1.0E+257, 1.0E+258, 1.0E+259, 1.0E+260, + 1.0E+261, 1.0E+262, 1.0E+263, 1.0E+264, 1.0E+265, 1.0E+266, 1.0E+267, 1.0E+268, 1.0E+269, 1.0E+270, + 1.0E+271, 1.0E+272, 1.0E+273, 1.0E+274, 1.0E+275, 1.0E+276, 1.0E+277, 1.0E+278, 1.0E+279, 1.0E+280, + 1.0E+281, 1.0E+282, 1.0E+283, 1.0E+284, 1.0E+285, 1.0E+286, 1.0E+287, 1.0E+288, 1.0E+289, 1.0E+290, + 1.0E+291, 1.0E+292, 1.0E+293, 1.0E+294, 1.0E+295, 1.0E+296, 1.0E+297, 1.0E+298, 1.0E+299, 1.0E+300, + 1.0E+301, 1.0E+302, 1.0E+303, 1.0E+304, 1.0E+305, 1.0E+306, 1.0E+307, 1.0E+308 }; static const int fract10_size = static_cast(sizeof(fract10) / sizeof(double)); @@ -2407,17 +2481,26 @@ namespace exprtk { if (!is_end(s_itr_) && ('0' == *(s_itr_))) { - if ( - is_end(s_itr_ + 1) || - is_end(s_itr_ + 2) || - is_end(s_itr_ + 3) || - ( - ('x' != *(s_itr_ + 1)) && - ('X' != *(s_itr_ + 1)) - ) || - (!details::is_hex_digit(*(s_itr_ + 2))) || - (!details::is_hex_digit(*(s_itr_ + 3))) - ) + /* + Note: The following 'awkward' conditional is + due to various broken msvc compilers. + */ + #if _MSC_VER == 1600 + const bool within_range = !is_end(s_itr_ + 2) && + !is_end(s_itr_ + 3) ; + #else + const bool within_range = !is_end(s_itr_ + 1) && + !is_end(s_itr_ + 2) && + !is_end(s_itr_ + 3) ; + #endif + + const bool x_seperator = ('x' == *(s_itr_ + 1)) || + ('X' == *(s_itr_ + 1)) ; + + const bool both_digits = details::is_hex_digit(*(s_itr_ + 2)) && + details::is_hex_digit(*(s_itr_ + 3)) ; + + if (!within_range || !x_seperator || !both_digits) { t.set_error(token::e_err_string,initial_itr,s_itr_,base_itr_); token_list_.push_back(t); @@ -5724,7 +5807,7 @@ namespace exprtk template class variable_node : public expression_node, - public ivariable + public ivariable { public: @@ -5958,7 +6041,7 @@ namespace exprtk }; template - class vector_node : public expression_node, + class vector_node : public expression_node , public vector_interface { public: @@ -6013,7 +6096,7 @@ namespace exprtk template class vector_elem_node : public expression_node, - public ivariable + public ivariable { public: @@ -6195,7 +6278,7 @@ namespace exprtk }; template - class swap_vecvec_node : public binary_node, + class swap_vecvec_node : public binary_node , public vector_interface { public: @@ -6208,7 +6291,8 @@ namespace exprtk : binary_node(details::e_swap,branch0,branch1), vec0_node_ptr_(0), vec1_node_ptr_(0), - vec_size_ (0) + vec_size_ (0), + initialised_(false) { if (is_ivector_node(binary_node::branch_[0].first)) { @@ -6234,12 +6318,13 @@ namespace exprtk { vec_size_ = std::min(vec0_node_ptr_->ref().size(), vec1_node_ptr_->ref().size()); + initialised_ = true; } } inline T value() const { - if (vec0_node_ptr_ && vec1_node_ptr_) + if (initialised_) { binary_node::branch_[0].first->value(); binary_node::branch_[1].first->value(); @@ -6283,6 +6368,7 @@ namespace exprtk vector_node* vec0_node_ptr_; vector_node* vec1_node_ptr_; std::size_t vec_size_; + bool initialised_; }; #ifndef exprtk_disable_string_capabilities @@ -7802,7 +7888,7 @@ namespace exprtk }; template - class assignment_vec_node : public binary_node, + class assignment_vec_node : public binary_node , public vector_interface { public: @@ -7869,7 +7955,7 @@ namespace exprtk }; template - class assignment_vecvec_node : public binary_node, + class assignment_vecvec_node : public binary_node , public vector_interface { public: @@ -8033,7 +8119,7 @@ namespace exprtk }; template - class assignment_vec_op_node : public binary_node, + class assignment_vec_op_node : public binary_node , public vector_interface { public: @@ -8101,7 +8187,7 @@ namespace exprtk }; template - class assignment_vecvec_op_node : public binary_node, + class assignment_vecvec_op_node : public binary_node , public vector_interface { public: @@ -8194,7 +8280,7 @@ namespace exprtk }; template - class eqineq_vecvec_node : public binary_node, + class eqineq_vecvec_node : public binary_node , public vector_interface { public: @@ -8298,7 +8384,7 @@ namespace exprtk }; template - class eqineq_vecval_node : public binary_node, + class eqineq_vecval_node : public binary_node , public vector_interface { public: @@ -8383,7 +8469,7 @@ namespace exprtk }; template - class eqineq_valvec_node : public binary_node, + class eqineq_valvec_node : public binary_node , public vector_interface { public: @@ -8468,7 +8554,7 @@ namespace exprtk }; template - class vecarith_vecvec_node : public binary_node, + class vecarith_vecvec_node : public binary_node , public vector_interface { public: @@ -8593,7 +8679,7 @@ namespace exprtk }; template - class vecarith_vecval_node : public binary_node, + class vecarith_vecval_node : public binary_node , public vector_interface { public: @@ -8698,7 +8784,7 @@ namespace exprtk }; template - class vecarith_valvec_node : public binary_node, + class vecarith_valvec_node : public binary_node , public vector_interface { public: @@ -8803,7 +8889,7 @@ namespace exprtk }; template - class unary_vector_node : public unary_node, + class unary_vector_node : public unary_node , public vector_interface { public: @@ -9513,9 +9599,9 @@ namespace exprtk if (rdt.range) { - range_t& rp = (*rdt.range); - std::size_t r0 = 0; - std::size_t r1 = 0; + range_t& rp = (*rdt.range); + std::size_t r0 = 0; + std::size_t r1 = 0; if (rp(r0,r1,rdt.size)) { @@ -13442,10 +13528,6 @@ namespace exprtk template class symbol_table { - protected: - - template class parser; - protected: template @@ -13629,17 +13711,6 @@ namespace exprtk } }; - if (symbol_name.size() > 1) - { - for (std::size_t i = 0; i < details::reserved_symbols_size; ++i) - { - if (details::imatch(symbol_name,details::reserved_symbols[i])) - { - return false; - } - } - } - tm_itr_t itr = map.find(symbol_name); if (map.end() == itr) @@ -13833,11 +13904,11 @@ namespace exprtk typedef typename details::stringvar_node stringvar_t; typedef stringvar_t* stringvar_ptr; #endif - typedef ifunction function_t; - typedef ivararg_function vararg_function_t; + typedef ifunction function_t; + typedef ivararg_function vararg_function_t; typedef igeneric_function generic_function_t; typedef function_t* function_ptr; - typedef vararg_function_t* vararg_function_ptr; + typedef vararg_function_t* vararg_function_ptr; typedef generic_function_t* generic_function_ptr; static const std::size_t lut_size = 256; @@ -13852,7 +13923,7 @@ namespace exprtk type_store,std::string> stringvar_store; #endif type_store,ifunction > function_store; - type_store,ivararg_function > vararg_function_store; + type_store,ivararg_function > vararg_function_store; type_store,igeneric_function > generic_function_store; type_store,igeneric_function > string_function_store; type_store vector_store; @@ -14270,6 +14341,48 @@ namespace exprtk return false; } + inline bool add_reserved_function(const std::string& function_name, function_t& function) + { + if (!valid()) + return false; + else if (!valid_symbol(function_name,false)) + return false; + else if (symbol_exists(function_name,false)) + return false; + else + return local_data().function_store.add(function_name,function); + } + + inline bool add_reserved_function(const std::string& vararg_function_name, vararg_function_t& vararg_function) + { + if (!valid()) + return false; + else if (!valid_symbol(vararg_function_name,false)) + return false; + else if (symbol_exists(vararg_function_name,false)) + return false; + else + return local_data().vararg_function_store.add(vararg_function_name,vararg_function); + } + + inline bool add_reserved_function(const std::string& function_name, generic_function_t& function, const func_type ft = e_ft_basicfunc) + { + if (!valid()) + return false; + else if (!valid_symbol(function_name,false)) + return false; + else if (symbol_exists(function_name,false)) + return false; + else if (std::string::npos != function.parameter_sequence.find_first_not_of("STV*?|")) + return false; + else if (e_ft_basicfunc == ft) + return local_data().generic_function_store.add(function_name,function); + else if (e_ft_strfunc == ft) + return local_data().string_function_store.add(function_name, function); + else + return false; + } + template inline bool add_vector(const std::string& vector_name, T (&v)[N]) { @@ -14440,7 +14553,7 @@ namespace exprtk return local_data().vector_store.get_list(vlist); } - inline bool symbol_exists(const std::string& symbol_name) const + inline bool symbol_exists(const std::string& symbol_name, const bool check_reserved_symb = true) const { /* Will return true if symbol_name exists as either a reserved symbol, @@ -14456,7 +14569,7 @@ namespace exprtk #endif else if (local_data().function_store.symbol_exists(symbol_name)) return true; - else if (local_data().is_reserved_symbol(symbol_name)) + else if (check_reserved_symb && local_data().is_reserved_symbol(symbol_name)) return true; else return false; @@ -14612,7 +14725,7 @@ namespace exprtk private: - inline bool valid_symbol(const std::string& symbol) const + inline bool valid_symbol(const std::string& symbol, const bool check_reserved_symb = true) const { if (symbol.empty()) return false; @@ -14633,20 +14746,48 @@ namespace exprtk } } - return (!local_data().is_reserved_symbol(symbol)); + return (check_reserved_symb) ? (!local_data().is_reserved_symbol(symbol)) : true; } - inline typename st_holder::st_data& local_data() + inline bool valid_function(const std::string& symbol) const + { + if (symbol.empty()) + return false; + if (!details::is_letter(symbol[0])) + return false; + else if (symbol.size() > 1) + { + for (std::size_t i = 1; i < symbol.size(); ++i) + { + if ( + (!details::is_letter(symbol[i])) && + (!details:: is_digit(symbol[i])) && + ('_' != symbol[i]) + ) + { + return false; + } + } + } + + return true; + } + + typedef typename st_holder::st_data local_data_t; + + inline local_data_t& local_data() { return *(holder_->data_); } - inline const typename st_holder::st_data& local_data() const + inline const local_data_t& local_data() const { return *(holder_->data_); } st_holder* holder_; + + friend class parser; }; template @@ -14659,6 +14800,7 @@ namespace exprtk typedef details::expression_node* expression_ptr; typedef details::vector_holder* vector_holder_ptr; + typedef std::vector > symtab_list_t; struct expression_holder { @@ -14754,7 +14896,7 @@ namespace exprtk expression(const expression& e) : expression_holder_(e.expression_holder_), - symbol_table_(e.symbol_table_) + symbol_table_list_(e.symbol_table_list_) { expression_holder_->ref_count++; } @@ -14775,7 +14917,7 @@ namespace exprtk expression_holder_ = e.expression_holder_; expression_holder_->ref_count++; - symbol_table_ = e.symbol_table_; + symbol_table_list_ = e.symbol_table_list_; } return *this; @@ -14842,21 +14984,26 @@ namespace exprtk inline void register_symbol_table(symbol_table& st) { - symbol_table_ = st; + symbol_table_list_.push_back(st); } - inline const symbol_table& get_symbol_table() const + inline const symbol_table& get_symbol_table(const std::size_t& index = 0) const { - return symbol_table_; + return symbol_table_list_[index]; } - inline symbol_table& get_symbol_table() + inline symbol_table& get_symbol_table(const std::size_t& index = 0) { - return symbol_table_; + return symbol_table_list_[index]; } private: + inline symtab_list_t get_symbol_table_list() const + { + return symbol_table_list_; + } + inline void set_expression(const expression_ptr expr) { if (expr) @@ -14934,7 +15081,7 @@ namespace exprtk } expression_holder* expression_holder_; - symbol_table symbol_table_; + symtab_list_t symbol_table_list_; friend class parser; friend class expression_helper; @@ -15161,6 +15308,7 @@ namespace exprtk typedef lexer::token token_t; typedef expression_node_t* expression_node_ptr; typedef symbol_table symbol_table_t; + typedef typename expression::symtab_list_t symbol_table_list_t; typedef details::vector_holder* vector_holder_ptr; typedef typename details::functor_t functor_t; @@ -15180,6 +15328,7 @@ namespace exprtk typedef std::map inv_binary_op_map_t; typedef std::multimap base_ops_map_t; + typedef std::set disabled_func_set_t; typedef details::T0oT1_define vov_t; typedef details::T0oT1_define cov_t; @@ -15304,7 +15453,7 @@ namespace exprtk if (se.depth > parser_.scope_depth_) return null_element_; else if ( - (se.name == var_name) && + (se.name == var_name) && (se.index == index) ) return se; @@ -15313,15 +15462,39 @@ namespace exprtk return null_element_; } + inline scope_element& get_active_element(const std::string& var_name, + const std::size_t index = std::numeric_limits::max()) + { + for (std::size_t i = 0; i < element_.size(); ++i) + { + scope_element& se = element_[i]; + + if (se.depth > parser_.scope_depth_) + return null_element_; + else if ( + (se.name == var_name) && + (se.index == index) && + (se.active) + ) + return se; + } + + return null_element_; + } + inline bool add_element(const scope_element& se) { - for (std::size_t j = 0; j < element_.size(); ++j) + for (std::size_t i = 0; i < element_.size(); ++i) { + scope_element& cse = element_[i]; + if ( - (element_[j].name == se.name ) && - (element_[j].depth <= se.depth) && - (element_[j].index == se.index) && - (element_[j].size == se.size ) + (cse.name == se.name ) && + (cse.depth <= se.depth) && + (cse.index == se.index) && + (cse.size == se.size ) && + (cse.type == se.type ) && + (cse.active) ) return false; } @@ -15334,11 +15507,19 @@ namespace exprtk inline void deactivate(const std::size_t& scope_depth) { - for (std::size_t j = 0; j < element_.size(); ++j) + exprtk_debug(("deactivate() - Scope depth: %d\n",static_cast(parser_.scope_depth_))); + + for (std::size_t i = 0; i < element_.size(); ++i) { - if (element_[j].depth >= scope_depth) + scope_element& se = element_[i]; + + if (se.active && (se.depth >= scope_depth)) { - element_[j].active = false; + exprtk_debug(("deactivate() - element[%02d] '%s'\n", + static_cast(i), + se.name.c_str())); + + se.active = false; } } } @@ -15423,8 +15604,8 @@ namespace exprtk ~scope_handler() { - parser_.scope_depth_--; parser_.sem_.deactivate(parser_.scope_depth_); + parser_.scope_depth_--; #ifdef exprtk_enable_debugging std::string depth(2 * parser_.scope_depth_,'-'); exprtk_debug(("<%s Scope Depth: %02d\n",depth.c_str(),static_cast(parser_.scope_depth_))); @@ -15438,24 +15619,418 @@ namespace exprtk parser_t& parser_; }; - public: - - enum compilation_options + struct symtab_store { - e_unknown = 0, - e_replacer = 1, - e_joiner = 2, - e_numeric_check = 4, - e_bracket_check = 8, - e_sequence_check = 16, - e_commutative_check = 32, - e_strength_reduction = 64, - e_disable_vardef = 128, - e_collect_vars = 256, - e_collect_funcs = 512, - e_collect_assings = 1024 + symbol_table_list_t symtab_list_; + + typedef typename symbol_table_t::local_data_t local_data_t; + typedef typename symbol_table_t::variable_ptr variable_ptr; + typedef typename symbol_table_t::stringvar_ptr stringvar_ptr; + typedef typename symbol_table_t::function_ptr function_ptr; + typedef typename symbol_table_t::vector_holder_ptr vector_holder_ptr; + typedef typename symbol_table_t::vararg_function_ptr vararg_function_ptr; + typedef typename symbol_table_t::generic_function_ptr generic_function_ptr; + + inline bool empty() const + { + return symtab_list_.empty(); + } + + inline void clear() + { + symtab_list_.clear(); + } + + inline bool valid() const + { + if (!empty()) + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (symtab_list_[i].valid()) + return true; + } + } + + return false; + } + + inline bool valid_symbol(const std::string& symbol) const + { + if (!symtab_list_.empty()) + return symtab_list_[0].valid_symbol(symbol); + else + return false; + } + + inline bool valid_function_name(const std::string& symbol) const + { + if (!symtab_list_.empty()) + return symtab_list_[0].valid_function(symbol); + else + return false; + } + + inline variable_ptr get_variable(const std::string& variable_name) const + { + if (!valid_symbol(variable_name)) + return reinterpret_cast(0); + + variable_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = local_data(i) + .variable_store.get(variable_name); + + if (result) break; + } + + return result; + } + + inline variable_ptr get_variable(const T& var_ref) const + { + variable_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = local_data(i).variable_store + .get_from_varptr(reinterpret_cast(&var_ref)); + + if (result) break; + } + + return result; + } + + #ifndef exprtk_disable_string_capabilities + inline stringvar_ptr get_stringvar(const std::string& string_name) const + { + if (!valid_symbol(string_name)) + return reinterpret_cast(0); + + stringvar_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = local_data(i) + .stringvar_store.get(string_name); + + if (result) break; + } + + return result; + } + #endif + + inline function_ptr get_function(const std::string& function_name) const + { + if (!valid_function_name(function_name)) + return reinterpret_cast(0); + + function_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = local_data(i) + .function_store.get(function_name); + + if (result) break; + } + + return result; + } + + inline vararg_function_ptr get_vararg_function(const std::string& vararg_function_name) const + { + if (!valid_function_name(vararg_function_name)) + return reinterpret_cast(0); + + vararg_function_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = local_data(i) + .vararg_function_store.get(vararg_function_name); + + if (result) break; + } + + return result; + } + + inline generic_function_ptr get_generic_function(const std::string& function_name) const + { + if (!valid_function_name(function_name)) + return reinterpret_cast(0); + + generic_function_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = local_data(i) + .generic_function_store.get(function_name); + + if (result) break; + } + + return result; + } + + inline generic_function_ptr get_string_function(const std::string& function_name) const + { + if (!valid_function_name(function_name)) + return reinterpret_cast(0); + + generic_function_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = + local_data(i).string_function_store.get(function_name); + + if (result) break; + } + + return result; + } + + inline vector_holder_ptr get_vector(const std::string& vector_name) const + { + if (!valid_symbol(vector_name)) + return reinterpret_cast(0); + + vector_holder_ptr result = reinterpret_cast(0); + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else + result = + local_data(i).vector_store.get(vector_name); + + if (result) break; + } + + return result; + } + + inline bool is_constant_node(const std::string& symbol_name) const + { + if (!valid_symbol(symbol_name)) + return false; + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if (local_data(i).variable_store.is_constant(symbol_name)) + return true; + } + + return false; + } + + #ifndef exprtk_disable_string_capabilities + inline bool is_constant_string(const std::string& symbol_name) const + { + if (!valid_symbol(symbol_name)) + return false; + + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if (!local_data(i).stringvar_store.symbol_exists(symbol_name)) + continue; + else if ( local_data(i).stringvar_store.is_constant(symbol_name)) + return true; + } + + return false; + } + #endif + + inline bool symbol_exists(const std::string& symbol) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if (symtab_list_[i].symbol_exists(symbol)) + return true; + } + + return false; + } + + inline bool is_variable(const std::string& variable_name) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if ( + symtab_list_[i].local_data().variable_store + .symbol_exists(variable_name) + ) + return true; + } + + return false; + } + + #ifndef exprtk_disable_string_capabilities + inline bool is_stringvar(const std::string& stringvar_name) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if ( + symtab_list_[i].local_data().stringvar_store + .symbol_exists(stringvar_name) + ) + return true; + } + + return false; + } + + inline bool is_conststr_stringvar(const std::string& symbol_name) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if ( + symtab_list_[i].local_data().stringvar_store + .symbol_exists(symbol_name) + ) + { + return ( + local_data(i).stringvar_store.symbol_exists(symbol_name) || + local_data(i).stringvar_store.is_constant (symbol_name) + ); + + } + } + + return false; + } + #endif + + inline bool is_function(const std::string& function_name) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if ( + local_data(i).vararg_function_store + .symbol_exists(function_name) + ) + return true; + } + + return false; + } + + inline bool is_vararg_function(const std::string& vararg_function_name) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if ( + local_data(i).vararg_function_store + .symbol_exists(vararg_function_name) + ) + return true; + } + + return false; + } + + inline bool is_vector(const std::string& vector_name) const + { + for (std::size_t i = 0; i < symtab_list_.size(); ++i) + { + if (!symtab_list_[i].valid()) + continue; + else if ( + local_data(i).vector_store + .symbol_exists(vector_name) + ) + return true; + } + + return false; + } + + inline std::string get_variable_name(const expression_node_ptr& ptr) const + { + return local_data().variable_store.entity_name(ptr); + } + + inline std::string get_vector_name(const vector_holder_ptr& ptr) const + { + return local_data().vector_store.entity_name(ptr); + } + + #ifndef exprtk_disable_string_capabilities + inline std::string get_stringvar_name(const expression_node_ptr& ptr) const + { + return local_data().stringvar_store.entity_name(ptr); + } + + inline std::string get_conststr_stringvar_name(const expression_node_ptr& ptr) const + { + return local_data().stringvar_store.entity_name(ptr); + } + #endif + + inline local_data_t& local_data(const std::size_t& index = 0) + { + return symtab_list_[index].local_data(); + } + + inline const local_data_t& local_data(const std::size_t& index = 0) const + { + return symtab_list_[index].local_data(); + } + + inline symbol_table_t& get_symbol_table(const std::size_t& index = 0) + { + return symtab_list_[index]; + } }; + public: + struct unknown_symbol_resolver { @@ -15628,18 +16203,325 @@ namespace exprtk friend class parser; }; - static const std::size_t compile_all_opts = e_replacer + - e_joiner + - e_numeric_check + - e_bracket_check + - e_sequence_check + - e_commutative_check + - e_strength_reduction; + class settings_store + { + private: - parser(const std::size_t compile_options = compile_all_opts) - : compile_options_(compile_options), + typedef std::set disabled_entity_set_t; + typedef disabled_entity_set_t::iterator des_itr_t; + + public: + + enum settings_compilation_options + { + e_unknown = 0, + e_replacer = 1, + e_joiner = 2, + e_numeric_check = 4, + e_bracket_check = 8, + e_sequence_check = 16, + e_commutative_check = 32, + e_strength_reduction = 64, + e_disable_vardef = 128, + e_collect_vars = 256, + e_collect_funcs = 512, + e_collect_assings = 1024, + e_disable_usr_on_rsrvd = 2048 + }; + + enum settings_base_funcs + { + e_bf_unknown = 0, + e_bf_abs , e_bf_acos , e_bf_acosh , e_bf_asin , + e_bf_asinh , e_bf_atan , e_bf_atan2 , e_bf_atanh , + e_bf_avg , e_bf_ceil , e_bf_clamp , e_bf_cos , + e_bf_cosh , e_bf_cot , e_bf_csc , e_bf_equal , + e_bf_erf , e_bf_erfc , e_bf_exp , e_bf_expm1 , + e_bf_floor , e_bf_frac , e_bf_hypot , e_bf_iclamp , + e_bf_like , e_bf_log , e_bf_log10 , e_bf_log1p , + e_bf_log2 , e_bf_logn , e_bf_mand , e_bf_max , + e_bf_min , e_bf_mod , e_bf_mor , e_bf_mul , + e_bf_ncdf , e_bf_pow , e_bf_root , e_bf_round , + e_bf_roundn , e_bf_sec , e_bf_sgn , e_bf_sin , + e_bf_sinc , e_bf_sinh , e_bf_sqrt , e_bf_sum , + e_bf_swap , e_bf_tan , e_bf_tanh , e_bf_trunc , + e_bf_not_equal , e_bf_inrange , e_bf_deg2grad , e_bf_deg2rad, + e_bf_rad2deg , e_bf_grad2deg + }; + + enum settings_control_structs + { + e_ctrl_unknown = 0, + e_ctrl_ifelse, + e_ctrl_switch, + e_ctrl_for_loop, + e_ctrl_while_loop, + e_ctrl_repeat_loop + }; + + enum settings_logic_opr + { + e_logic_unknown = 0, + e_logic_and, e_logic_nand, e_logic_nor, + e_logic_not, e_logic_or, e_logic_xnor, + e_logic_xor, e_logic_scand, e_logic_scor + }; + + static const std::size_t compile_all_opts = e_replacer + + e_joiner + + e_numeric_check + + e_bracket_check + + e_sequence_check + + e_commutative_check + + e_strength_reduction; + + settings_store(const std::size_t compile_options = compile_all_opts) + { + load_compile_options(compile_options); + } + + settings_store& enable_all_base_functions() + { + disabled_func_set_.clear(); + return *this; + } + + settings_store& enable_all_control_structures() + { + disabled_ctrl_set_.clear(); + return *this; + } + + settings_store& enable_all_logic_ops() + { + disabled_logic_set_.clear(); + return *this; + } + + settings_store& disable_all_base_functions() + { + std::copy(details::base_function_list, + details::base_function_list + details::base_function_list_size, + std::insert_iterator + (disabled_func_set_,disabled_func_set_.begin())); + return *this; + } + + settings_store& disable_all_control_structures() + { + std::copy(details::cntrl_struct_list, + details::cntrl_struct_list + details::cntrl_struct_list_size, + std::insert_iterator + (disabled_ctrl_set_,disabled_ctrl_set_.begin())); + return *this; + } + + settings_store& disable_all_logic_ops() + { + std::copy(details::logic_ops_list, + details::logic_ops_list + details::logic_ops_list_size, + std::insert_iterator + (disabled_logic_set_,disabled_logic_set_.begin())); + return *this; + } + + bool replacer_enabled () const { return enable_replacer_; } + bool commutative_check_enabled () const { return enable_commutative_check_; } + bool joiner_enabled () const { return enable_joiner_; } + bool numeric_check_enabled () const { return enable_numeric_check_; } + bool bracket_check_enabled () const { return enable_bracket_check_; } + bool sequence_check_enabled () const { return enable_sequence_check_; } + bool strength_reduction_enabled () const { return enable_strength_reduction_; } + bool collect_variables_enabled () const { return enable_collect_vars_; } + bool collect_functions_enabled () const { return enable_collect_funcs_; } + bool collect_assignments_enabled() const { return enable_collect_assings_; } + bool vardef_disabled () const { return disable_vardef_; } + bool rsrvd_sym_usr_disabled () const { return disable_rsrvd_sym_usr_; } + + bool function_enabled(const std::string& function_name) + { + if (disabled_func_set_.empty()) + return true; + else + return (disabled_func_set_.end() == disabled_func_set_.find(function_name)); + } + + bool control_struct_enabled(const std::string& control_struct) + { + if (disabled_ctrl_set_.empty()) + return true; + else + return (disabled_ctrl_set_.end() == disabled_ctrl_set_.find(control_struct)); + } + + bool logic_enabled(const std::string& logic_operation) + { + if (disabled_logic_set_.empty()) + return true; + else + return (disabled_logic_set_.end() == disabled_logic_set_.find(logic_operation)); + } + + bool function_disabled(const std::string& function_name) + { + if (disabled_func_set_.empty()) + return false; + else + return (disabled_func_set_.end() != disabled_func_set_.find(function_name)); + } + + bool control_struct_disabled(const std::string& control_struct) + { + if (disabled_ctrl_set_.empty()) + return false; + else + return (disabled_ctrl_set_.end() != disabled_ctrl_set_.find(control_struct)); + } + + bool logic_disabled(const std::string& logic_operation) + { + if (disabled_logic_set_.empty()) + return false; + else + return (disabled_logic_set_.end() != disabled_logic_set_.find(logic_operation)); + } + + settings_store& disable_base_function(settings_base_funcs bf) + { + if ( + (e_bf_unknown != bf) && + (bf < details::base_function_list_size) + ) + { + disabled_func_set_.insert(details::base_function_list[bf - 1]); + } + + return *this; + } + + settings_store& disable_control_structure(settings_control_structs ctrl_struct) + { + if ( + (e_ctrl_unknown != ctrl_struct) && + (ctrl_struct < details::cntrl_struct_list_size) + ) + { + disabled_ctrl_set_.insert(details::cntrl_struct_list[ctrl_struct - 1]); + } + + return *this; + } + + settings_store& disable_logic_operation(settings_logic_opr logic) + { + if ( + (e_logic_unknown != logic) && + (logic < details::logic_ops_list_size) + ) + { + disabled_logic_set_.insert(details::logic_ops_list[logic - 1]); + } + + return *this; + } + + settings_store& enable_base_function(settings_base_funcs bf) + { + if ( + (e_bf_unknown != bf) && + (bf < details::base_function_list_size) + ) + { + des_itr_t itr = disabled_func_set_.find(details::base_function_list[bf - 1]); + + if (disabled_func_set_.end() != itr) + { + disabled_func_set_.erase(itr); + } + } + + return *this; + } + + settings_store& enable_control_structure(settings_control_structs ctrl_struct) + { + if ( + (e_ctrl_unknown != ctrl_struct) && + (ctrl_struct < details::cntrl_struct_list_size) + ) + { + des_itr_t itr = disabled_ctrl_set_.find(details::cntrl_struct_list[ctrl_struct - 1]); + + if (disabled_ctrl_set_.end() != itr) + { + disabled_ctrl_set_.erase(itr); + } + } + + return *this; + } + + settings_store& enable_logic_operation(settings_logic_opr logic) + { + if ( + (e_logic_unknown != logic) && + (logic < details::logic_ops_list_size) + ) + { + des_itr_t itr = disabled_logic_set_.find(details::logic_ops_list[logic - 1]); + + if (disabled_logic_set_.end() != itr) + { + disabled_logic_set_.erase(itr); + } + } + + return *this; + } + + private: + + void load_compile_options(const std::size_t compile_options) + { + enable_replacer_ = (compile_options & e_replacer ) == e_replacer; + enable_joiner_ = (compile_options & e_joiner ) == e_joiner; + enable_numeric_check_ = (compile_options & e_numeric_check ) == e_numeric_check; + enable_bracket_check_ = (compile_options & e_bracket_check ) == e_bracket_check; + enable_sequence_check_ = (compile_options & e_sequence_check ) == e_sequence_check; + enable_commutative_check_ = (compile_options & e_commutative_check ) == e_commutative_check; + enable_strength_reduction_ = (compile_options & e_strength_reduction ) == e_strength_reduction; + enable_collect_vars_ = (compile_options & e_collect_vars ) == e_collect_vars; + enable_collect_funcs_ = (compile_options & e_collect_funcs ) == e_collect_funcs; + enable_collect_assings_ = (compile_options & e_collect_assings ) == e_collect_assings; + disable_vardef_ = (compile_options & e_disable_vardef ) == e_disable_vardef; + disable_rsrvd_sym_usr_ = (compile_options & e_disable_usr_on_rsrvd) == e_disable_usr_on_rsrvd; + } + + bool enable_replacer_; + bool enable_joiner_; + bool enable_numeric_check_; + bool enable_bracket_check_; + bool enable_sequence_check_; + bool enable_commutative_check_; + bool enable_strength_reduction_; + bool enable_collect_vars_; + bool enable_collect_funcs_; + bool enable_collect_assings_; + bool disable_vardef_; + bool disable_rsrvd_sym_usr_; + + disabled_entity_set_t disabled_func_set_ ; + disabled_entity_set_t disabled_ctrl_set_ ; + disabled_entity_set_t disabled_logic_set_; + + friend class parser; + }; + + typedef settings_store settings_t; + + parser(const settings_t& settings = settings_t()) + : settings_(settings), resolve_unknown_symbol_(false), - vardef_disabled_((compile_options & e_disable_vardef) == e_disable_vardef), scope_depth_(0), unknown_symbol_resolver_(reinterpret_cast(0)), #ifdef _MSC_VER @@ -15655,12 +16537,12 @@ namespace exprtk { init_precompilation(); - load_operations_map(base_ops_map_); - load_unary_operations_map(unary_op_map_); - load_binary_operations_map(binary_op_map_); + load_operations_map (base_ops_map_ ); + load_unary_operations_map (unary_op_map_ ); + load_binary_operations_map (binary_op_map_ ); load_inv_binary_operations_map(inv_binary_op_map_); - load_sf3_map(sf3_map_); - load_sf4_map(sf4_map_); + load_sf3_map (sf3_map_ ); + load_sf4_map (sf4_map_ ); expression_generator_.init_synthesize_map(); expression_generator_.set_parser(*this); @@ -15669,7 +16551,7 @@ namespace exprtk expression_generator_.set_ibom(inv_binary_op_map_); expression_generator_.set_sf3m(sf3_map_); expression_generator_.set_sf4m(sf4_map_); - expression_generator_.set_strength_reduction_state(strength_reduction_enabled()); + expression_generator_.set_strength_reduction_state(settings_.strength_reduction_enabled()); } ~parser() @@ -15677,16 +16559,16 @@ namespace exprtk inline void init_precompilation() { - if (collect_variables_enabled()) + if (settings_.collect_variables_enabled()) dec_.collect_variables() = true; - if (collect_functions_enabled()) + if (settings_.collect_functions_enabled()) dec_.collect_functions() = true; - if (collect_assignments_enabled()) + if (settings_.collect_assignments_enabled()) dec_.collect_assignments() = true; - if (replacer_enabled()) + if (settings_.replacer_enabled()) { symbol_replacer_.clear(); symbol_replacer_.add_replace("true" ,"1",lexer::token::e_number); @@ -15695,7 +16577,7 @@ namespace exprtk helper_assembly_.register_modifier(&symbol_replacer_); } - if (commutative_check_enabled()) + if (settings_.commutative_check_enabled()) { for (std::size_t i = 0; i < details::reserved_words_size; ++i) { @@ -15706,7 +16588,7 @@ namespace exprtk helper_assembly_.register_inserter(&commutative_inserter_); } - if (joiner_enabled()) + if (settings_.joiner_enabled()) { helper_assembly_.token_joiner_list.clear(); helper_assembly_.register_joiner(&operator_joiner_2_); @@ -15714,24 +16596,24 @@ namespace exprtk } if ( - numeric_check_enabled () || - bracket_check_enabled () || - sequence_check_enabled() + settings_.numeric_check_enabled () || + settings_.bracket_check_enabled () || + settings_.sequence_check_enabled() ) { helper_assembly_.token_scanner_list.clear(); - if (numeric_check_enabled()) + if (settings_.numeric_check_enabled()) { helper_assembly_.register_scanner(&numeric_checker_); } - if (bracket_check_enabled()) + if (settings_.bracket_check_enabled()) { helper_assembly_.register_scanner(&bracket_checker_); } - if (sequence_check_enabled()) + if (settings_.sequence_check_enabled()) { helper_assembly_.register_scanner(&sequence_validator_); } @@ -15778,7 +16660,7 @@ namespace exprtk return false; } - symbol_table_ = expr.get_symbol_table(); + symtab_store_.symtab_list_ = expr.get_symbol_table_list(); dec_.clear(); lexer_.begin(); @@ -15851,77 +16733,27 @@ namespace exprtk } } - inline bool replacer_enabled() const - { - return ((compile_options_ & e_replacer) == e_replacer); - } - - inline bool commutative_check_enabled() const - { - return ((compile_options_ & e_commutative_check) == e_commutative_check); - } - - inline bool joiner_enabled() const - { - return ((compile_options_ & e_joiner) == e_joiner); - } - - inline bool numeric_check_enabled() const - { - return ((compile_options_ & e_numeric_check) == e_numeric_check); - } - - inline bool bracket_check_enabled() const - { - return ((compile_options_ & e_bracket_check) == e_bracket_check); - } - - inline bool sequence_check_enabled() const - { - return ((compile_options_ & e_sequence_check) == e_sequence_check); - } - - inline bool strength_reduction_enabled() const - { - return ((compile_options_ & e_strength_reduction) == e_strength_reduction); - } - - inline bool collect_variables_enabled() const - { - return ((compile_options_ & e_collect_vars) == e_collect_vars); - } - - inline bool collect_functions_enabled() const - { - return ((compile_options_ & e_collect_funcs) == e_collect_funcs); - } - - inline bool collect_assignments_enabled() const - { - return ((compile_options_ & e_collect_assings) == e_collect_assings); - } - inline bool run_assemblies() { - if (commutative_check_enabled()) + if (settings_.commutative_check_enabled()) { helper_assembly_.run_inserters(lexer_); } - if (joiner_enabled()) + if (settings_.joiner_enabled()) { helper_assembly_.run_joiners(lexer_); } - if (replacer_enabled()) + if (settings_.replacer_enabled()) { helper_assembly_.run_modifiers(lexer_); } if ( - numeric_check_enabled () || - bracket_check_enabled () || - sequence_check_enabled() + settings_.numeric_check_enabled () || + settings_.bracket_check_enabled () || + settings_.sequence_check_enabled() ) { if (!helper_assembly_.run_scanners(lexer_)) @@ -15984,6 +16816,11 @@ namespace exprtk return true; } + inline settings_store& settings() + { + return settings_; + } + inline parser_error::type get_error(const std::size_t& index) { if (index < error_list_.size()) @@ -16014,7 +16851,7 @@ namespace exprtk inline bool replace_symbol(const std::string& old_symbol, const std::string& new_symbol) { - if (!replacer_enabled()) + if (!settings_.replacer_enabled()) return false; else if (details::is_reserved_word(old_symbol)) return false; @@ -16024,7 +16861,7 @@ namespace exprtk inline bool remove_replace_symbol(const std::string& symbol) { - if (!replacer_enabled()) + if (!settings_.replacer_enabled()) return false; else if (details::is_reserved_word(symbol)) return false; @@ -16059,7 +16896,8 @@ namespace exprtk ) return false; else - return (base_ops_map_.end() != base_ops_map_.find(symbol)); + return settings_.function_enabled(symbol) && + (base_ops_map_.end() != base_ops_map_.find(symbol)); } inline bool valid_vararg_operation(const std::string& symbol) @@ -16084,7 +16922,8 @@ namespace exprtk details::imatch(symbol,s_mor ) || details::imatch(symbol,s_multi ) || details::imatch(symbol,s_mswitch) - ); + ) && + settings_.function_enabled(symbol); } inline void store_token() @@ -16244,50 +17083,50 @@ namespace exprtk if (details::imatch(current_token_.value,s_and)) { - current_state.set(e_level01,e_level02,details::e_and); + current_state.set(e_level03,e_level04,details::e_and); break; } else if (details::imatch(current_token_.value,s_and1)) { #ifndef exprtk_disable_sc_andor - current_state.set(e_level01,e_level02,details::e_scand); + current_state.set(e_level03,e_level04,details::e_scand); #else - current_state.set(e_level01,e_level02,details::e_and); + current_state.set(e_level03,e_level04,details::e_and); #endif break; } else if (details::imatch(current_token_.value,s_nand)) { - current_state.set(e_level01,e_level02,details::e_nand); + current_state.set(e_level03,e_level04,details::e_nand); break; } else if (details::imatch(current_token_.value,s_or)) { - current_state.set(e_level03,e_level04,details::e_or); + current_state.set(e_level01,e_level02,details::e_or); break; } else if (details::imatch(current_token_.value,s_or1)) { #ifndef exprtk_disable_sc_andor - current_state.set(e_level03,e_level04,details::e_scor); + current_state.set(e_level01,e_level02,details::e_scor); #else - current_state.set(e_level03,e_level04,details::e_or); + current_state.set(e_level01,e_level02,details::e_or); #endif break; } else if (details::imatch(current_token_.value,s_nor)) { - current_state.set(e_level03,e_level04,details::e_nor); + current_state.set(e_level01,e_level02,details::e_nor); break; } else if (details::imatch(current_token_.value,s_xor)) { - current_state.set(e_level03,e_level04,details::e_xor); + current_state.set(e_level01,e_level02,details::e_xor); break; } else if (details::imatch(current_token_.value,s_xnor)) { - current_state.set(e_level03,e_level04,details::e_xnor); + current_state.set(e_level01,e_level02,details::e_xnor); break; } else if (details::imatch(current_token_.value,s_in)) @@ -16395,7 +17234,7 @@ namespace exprtk expression_node_ptr return_node = error_node(); if ( - (return_node = symbol_table_.get_variable(v)) || + (return_node = symtab_store_.get_variable(v)) || (return_node = sem_ .get_variable(v)) ) { @@ -16760,13 +17599,13 @@ namespace exprtk { switch (parameter_count) { - #define base_opr_case(N) \ - case N : { \ - expression_node_ptr pl##N[N] = {0}; \ - std::copy(param_list,param_list + N,pl##N); \ - lodge_symbol(operation_name,e_st_function); \ - return expression_generator_(operation.type,pl##N);\ - } \ + #define base_opr_case(N) \ + case N : { \ + expression_node_ptr pl##N[N] = {0}; \ + std::copy(param_list,param_list + N,pl##N); \ + lodge_symbol(operation_name,e_st_function); \ + return expression_generator_(operation.type,pl##N); \ + } \ base_opr_case(1) base_opr_case(2) @@ -16876,7 +17715,7 @@ namespace exprtk else { if ( - commutative_check_enabled() && + settings_.commutative_check_enabled() && token_is(token_t::e_mul,false) ) { @@ -16968,7 +17807,7 @@ namespace exprtk inline expression_node_ptr parse_conditional_statement() { - expression_node_ptr condition = error_node(); + expression_node_ptr condition = error_node(); next_token(); @@ -17370,7 +18209,7 @@ namespace exprtk return error_node(); } - else if (!symbol_table_.is_variable(loop_counter_symbol)) + else if (!symtab_store_.is_variable(loop_counter_symbol)) { if ( !se->active && @@ -17384,11 +18223,13 @@ namespace exprtk else { scope_element nse; - nse.name = loop_counter_symbol; - nse.type = scope_element::e_variable; - nse.depth = scope_depth_; - nse.data = new T(T(0)); - nse.var_node = new variable_node_t(*(T*)(nse.data)); + nse.name = loop_counter_symbol; + nse.active = true; + nse.ref_count = 1; + nse.type = scope_element::e_variable; + nse.depth = scope_depth_; + nse.data = new T(T(0)); + nse.var_node = new variable_node_t(*(T*)(nse.data)); if (!sem_.add_element(nse)) { @@ -17414,8 +18255,7 @@ namespace exprtk "ERR58 - Failed to parse initialiser of for-loop")); result = false; } - - if (!token_is(token_t::e_eof)) + else if (!token_is(token_t::e_eof)) { set_error( make_error(parser_error::e_syntax, @@ -17795,6 +18635,8 @@ namespace exprtk scoped_vec_delete sdd(*this,arg_list); + lodge_symbol(symbol,e_st_function); + next_token(); if (!token_is(token_t::e_lbracket)) { @@ -17880,7 +18722,9 @@ namespace exprtk inline void parse_pending_string_rangesize(expression_node_ptr& expression) { + // Allow no more than 100 range calls, eg: s[][][]...[][] const std::size_t max_rangesize_parses = 100; + std::size_t i = 0; while @@ -18177,7 +19021,7 @@ namespace exprtk { const std::string symbol = current_token_.value; - if (!symbol_table_.is_conststr_stringvar(symbol)) + if (!symtab_store_.is_conststr_stringvar(symbol)) { set_error( make_error(parser_error::e_syntax, @@ -18187,12 +19031,12 @@ namespace exprtk return error_node(); } - expression_node_ptr result = symbol_table_.get_stringvar(symbol); + expression_node_ptr result = symtab_store_.get_stringvar(symbol); typedef details::stringvar_node* strvar_node_t; strvar_node_t const_str_node = static_cast(0); - const bool is_const_string = symbol_table_.is_constant_string(symbol); + const bool is_const_string = symtab_store_.is_constant_string(symbol); if (is_const_string) { @@ -18315,7 +19159,7 @@ namespace exprtk vector_holder_ptr vec = vector_holder_ptr(0); - const scope_element& se = sem_.get_element(symbol); + const scope_element& se = sem_.get_active_element(symbol); if ( (se.name != symbol) || @@ -18323,7 +19167,7 @@ namespace exprtk (scope_element::e_vector != se.type) ) { - if (0 == (vec = symbol_table_.get_vector(symbol))) + if (0 == (vec = symtab_store_.get_vector(symbol))) { set_error( make_error(parser_error::e_syntax, @@ -18629,7 +19473,7 @@ namespace exprtk param_type_list += 'V'; else if (is_generally_string_node(arg)) param_type_list += 'S'; - else // Everything else is assumed to be scalar returning expression + else // Everything else is assumed to be a scalar returning expression param_type_list += 'T'; arg_list.push_back(arg); @@ -19131,6 +19975,7 @@ namespace exprtk { vec_holder = se.vec_node; se.active = true; + se.depth = scope_depth_; se.ref_count++; } } @@ -19138,12 +19983,14 @@ namespace exprtk if (0 == vec_holder) { scope_element nse; - nse.name = vec_name; - nse.type = scope_element::e_vector; - nse.depth = scope_depth_; - nse.size = vec_size; - nse.data = new T[vec_size]; - nse.vec_node = new typename scope_element::vector_holder_t((T*)(nse.data),nse.size); + nse.name = vec_name; + nse.active = true; + nse.ref_count = 1; + nse.type = scope_element::e_vector; + nse.depth = scope_depth_; + nse.size = vec_size; + nse.data = new T[vec_size]; + nse.vec_node = new typename scope_element::vector_holder_t((T*)(nse.data),nse.size); if (!sem_.add_element(nse)) { @@ -19185,7 +20032,7 @@ namespace exprtk inline expression_node_ptr parse_define_var_statement() { - if (vardef_disabled_) + if (settings_.vardef_disabled()) { set_error( make_error(parser_error::e_syntax, @@ -19223,7 +20070,7 @@ namespace exprtk return error_node(); } - else if (symbol_table_.symbol_exists(var_name)) + else if (symtab_store_.symbol_exists(var_name)) { set_error( make_error(parser_error::e_syntax, @@ -19298,10 +20145,11 @@ namespace exprtk return error_node(); } - else if (scope_element::e_variable == se.type) + else if ((scope_element::e_variable == se.type)) { var_node = se.var_node; se.active = true; + se.depth = scope_depth_; se.ref_count++; } } @@ -19473,9 +20321,9 @@ namespace exprtk } else { - if (symbol_table_.is_variable(var0_name)) + if (symtab_store_.is_variable(var0_name)) { - variable0 = symbol_table_.get_variable(var0_name); + variable0 = symtab_store_.get_variable(var0_name); } scope_element& se = sem_.get_element(var0_name); @@ -19556,9 +20404,9 @@ namespace exprtk } else { - if (symbol_table_.is_variable(var1_name)) + if (symtab_store_.is_variable(var1_name)) { - variable1 = symbol_table_.get_variable(var1_name); + variable1 = symtab_store_.get_variable(var1_name); } scope_element& se = sem_.get_element(var1_name); @@ -19647,7 +20495,7 @@ namespace exprtk peek_token_is(token_t::e_lsqrbracket) ) { - if (!commutative_check_enabled()) + if (!settings_.commutative_check_enabled()) { set_error( make_error(parser_error::e_syntax, @@ -19692,7 +20540,7 @@ namespace exprtk if (implied_mul) { - if (!commutative_check_enabled()) + if (!settings_.commutative_check_enabled()) { set_error( make_error(parser_error::e_syntax, @@ -19717,11 +20565,11 @@ namespace exprtk const std::string symbol = current_token_.value; // Are we dealing with a variable or a special constant? - expression_node_ptr variable = symbol_table_.get_variable(symbol); + expression_node_ptr variable = symtab_store_.get_variable(symbol); if (variable) { - if (symbol_table_.is_constant_node(symbol)) + if (symtab_store_.is_constant_node(symbol)) { variable = expression_generator_(variable->value()); } @@ -19738,9 +20586,9 @@ namespace exprtk // Are we dealing with a locally defined variable or vector? if (!sem_.empty()) { - scope_element& se = sem_.get_element(symbol); + scope_element& se = sem_.get_active_element(symbol); - if (se.name == symbol) + if (se.active && (se.name == symbol)) { if (scope_element::e_variable == se.type) { @@ -19763,7 +20611,7 @@ namespace exprtk #ifndef exprtk_disable_string_capabilities // Are we dealing with a string variable? - if (symbol_table_.is_stringvar(symbol)) + if (symtab_store_.is_stringvar(symbol)) { return parse_string(); } @@ -19771,7 +20619,7 @@ namespace exprtk { // Are we dealing with a function? - ifunction* function = symbol_table_.get_function(symbol); + ifunction* function = symtab_store_.get_function(symbol); if (function) { @@ -19796,7 +20644,7 @@ namespace exprtk { // Are we dealing with a vararg function? - ivararg_function* vararg_function = symbol_table_.get_vararg_function(symbol); + ivararg_function* vararg_function = symtab_store_.get_vararg_function(symbol); if (vararg_function) { @@ -19821,7 +20669,7 @@ namespace exprtk { // Are we dealing with a vararg generic function? - igeneric_function* generic_function = symbol_table_.get_generic_function(symbol); + igeneric_function* generic_function = symtab_store_.get_generic_function(symbol); if (generic_function) { @@ -19845,8 +20693,8 @@ namespace exprtk } { - // Are we dealing with a vararg string returing function? - igeneric_function* string_function = symbol_table_.get_string_function(symbol); + // Are we dealing with a vararg string returning function? + igeneric_function* string_function = symtab_store_.get_string_function(symbol); if (string_function) { @@ -19870,7 +20718,7 @@ namespace exprtk } // Are we dealing with a vector element? - if (symbol_table_.is_vector(symbol)) + if (symtab_store_.is_vector(symbol)) { lodge_symbol(symbol,e_st_vector); return parse_vector(); @@ -19878,64 +20726,72 @@ namespace exprtk if (details::is_reserved_symbol(symbol)) { - set_error( - make_error(parser_error::e_syntax, - current_token_, - "ERR160 - Invalid use of reserved symbol '" + symbol + "'")); + if (settings_.function_enabled(symbol) || !details::is_base_function(symbol)) + { + set_error( + make_error(parser_error::e_syntax, + current_token_, + "ERR160 - Invalid use of reserved symbol '" + symbol + "'")); - return error_node(); + return error_node(); + } } // Should we handle unknown symbols? if (resolve_unknown_symbol_ && unknown_symbol_resolver_) { - T default_value = T(0); - std::string error_message; - typename unknown_symbol_resolver::usr_symbol_type usr_symbol_type; - - if (unknown_symbol_resolver_->process(symbol,usr_symbol_type,default_value,error_message)) + if (!(settings_.rsrvd_sym_usr_disabled() && details::is_reserved_symbol(symbol))) { - bool create_result = false; + T default_value = T(0); + std::string error_message; + typename unknown_symbol_resolver::usr_symbol_type usr_symbol_type; - switch (usr_symbol_type) + if (unknown_symbol_resolver_->process(symbol,usr_symbol_type,default_value,error_message)) { - case unknown_symbol_resolver::e_usr_variable_type : create_result = symbol_table_.create_variable(symbol,default_value); - break; + bool create_result = false; - case unknown_symbol_resolver::e_usr_constant_type : create_result = symbol_table_.add_constant(symbol,default_value); - break; + symbol_table_t& symtab = symtab_store_.get_symbol_table(); - default : create_result = false; - } - - if (create_result) - { - expression_node_ptr var = symbol_table_.get_variable(symbol); - - if (var) + switch (usr_symbol_type) { - if (symbol_table_.is_constant_node(symbol)) - { - var = expression_generator_(var->value()); - } + case unknown_symbol_resolver::e_usr_variable_type : create_result = symtab.create_variable(symbol,default_value); + break; - lodge_symbol(symbol,e_st_variable); + case unknown_symbol_resolver::e_usr_constant_type : create_result = symtab.add_constant(symbol,default_value); + break; - if (!post_variable_process(symbol)) - return error_node(); - - next_token(); - - return var; + default : create_result = false; } + + if (create_result) + { + expression_node_ptr var = symtab_store_.get_variable(symbol); + + if (var) + { + if (symtab_store_.is_constant_node(symbol)) + { + var = expression_generator_(var->value()); + } + + lodge_symbol(symbol,e_st_variable); + + if (!post_variable_process(symbol)) + return error_node(); + + next_token(); + + return var; + } + } + + set_error( + make_error(parser_error::e_symtab, + current_token_, + "ERR161 - Failed to create variable: '" + symbol + "'")); + + return error_node(); } - - set_error( - make_error(parser_error::e_symtab, - current_token_, - "ERR161 - Failed to create variable: '" + symbol + "'")); - - return error_node(); } } @@ -19959,6 +20815,7 @@ namespace exprtk static const std::string symbol_continue = "continue"; static const std::string symbol_var = "var" ; static const std::string symbol_swap = "swap" ; + static const std::string symbol_return = "return" ; if (valid_vararg_operation(current_token_.value)) { @@ -19968,23 +20825,38 @@ namespace exprtk { return parse_base_operation(); } - else if (details::imatch(current_token_.value,symbol_if)) + else if ( + details::imatch(current_token_.value,symbol_if) && + settings_.control_struct_enabled(current_token_.value) + ) { return parse_conditional_statement(); } - else if (details::imatch(current_token_.value,symbol_while)) + else if ( + details::imatch(current_token_.value,symbol_while) && + settings_.control_struct_enabled(current_token_.value) + ) { return parse_while_loop(); } - else if (details::imatch(current_token_.value,symbol_repeat)) + else if ( + details::imatch(current_token_.value,symbol_repeat) && + settings_.control_struct_enabled(current_token_.value) + ) { return parse_repeat_until_loop(); } - else if (details::imatch(current_token_.value,symbol_for)) + else if ( + details::imatch(current_token_.value,symbol_for) && + settings_.control_struct_enabled(current_token_.value) + ) { return parse_for_loop(); } - else if (details::imatch(current_token_.value,symbol_switch)) + else if ( + details::imatch(current_token_.value,symbol_switch) && + settings_.control_struct_enabled(current_token_.value) + ) { return parse_switch_statement(); } @@ -20014,7 +20886,7 @@ namespace exprtk { return parse_swap_statement(); } - else if (symbol_table_.valid() || !sem_.empty()) + else if (symtab_store_.valid() || !sem_.empty()) { return parse_symtab_symbol(); } @@ -21927,12 +22799,14 @@ namespace exprtk else { scope_element nse; - nse.name = symbol; - nse.type = scope_element::e_vecelem; - nse.index = i; - nse.depth = parser_->scope_depth_; - nse.data = 0; - nse.var_node = new variable_node_t((*v)); + nse.name = symbol; + nse.active = true; + nse.ref_count = 1; + nse.type = scope_element::e_vecelem; + nse.index = i; + nse.depth = parser_->scope_depth_; + nse.data = 0; + nse.var_node = new variable_node_t((*v)); if (!parser_->sem_.add_element(nse)) { @@ -21992,11 +22866,11 @@ namespace exprtk switch (cst) { - case e_st_variable : symbol_name = parser_->symbol_table_ + case e_st_variable : symbol_name = parser_->symtab_store_ .get_variable_name(node); break; - case e_st_string : symbol_name = parser_->symbol_table_ + case e_st_string : symbol_name = parser_->symtab_store_ .get_stringvar_name(node); break; @@ -22005,7 +22879,7 @@ namespace exprtk vector_holder_t& vh = static_cast(node)->ref(); - symbol_name = parser_->symbol_table_.get_vector_name(&vh); + symbol_name = parser_->symtab_store_.get_vector_name(&vh); } break; @@ -22650,11 +23524,13 @@ namespace exprtk { if (details::is_uv_node(branch[1])) { - details::operator_type o = static_cast*>(branch[1])->operation(); + typedef details::uv_base_node* uvbn_ptr_t; + + details::operator_type o = static_cast(branch[1])->operation(); if (details::e_neg == o) { - const Type& v1 = static_cast*>(branch[1])->v(); + const Type& v1 = static_cast(branch[1])->v(); free_node(*expr_gen.node_allocator_,branch[1]); @@ -22721,11 +23597,13 @@ namespace exprtk { if (details::is_uv_node(branch[0])) { - details::operator_type o = static_cast*>(branch[0])->operation(); + typedef details::uv_base_node* uvbn_ptr_t; + + details::operator_type o = static_cast(branch[0])->operation(); if (details::e_neg == o) { - const Type& v0 = static_cast*>(branch[0])->v(); + const Type& v0 = static_cast(branch[0])->v(); free_node(*expr_gen.node_allocator_,branch[0]); @@ -22997,7 +23875,6 @@ namespace exprtk } result = cobnode; - } else if (details::e_mul == cobnode->operation()) { @@ -23649,7 +24526,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / v1) / v2 --> (vovov) v0 / (v1 * v2) if ((details::e_div == o0) && (details::e_div == o1)) @@ -23705,7 +24582,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // v0 / (v1 / v2) --> (vovov) (v0 * v2) / v1 if ((details::e_div == o0) && (details::e_div == o1)) @@ -23762,7 +24639,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / v1) / c --> (vovoc) v0 / (v1 * c) if ((details::e_div == o0) && (details::e_div == o1)) @@ -23818,7 +24695,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // v0 / (v1 / c) --> (vocov) (v0 * c) / v1 if ((details::e_div == o0) && (details::e_div == o1)) @@ -23874,7 +24751,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / c) / v1 --> (vovoc) v0 / (v1 * c) if ((details::e_div == o0) && (details::e_div == o1)) @@ -23930,7 +24807,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // v0 / (c / v1) --> (vovoc) (v0 * v1) / c if ((details::e_div == o0) && (details::e_div == o1)) @@ -23986,7 +24863,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c / v0) / v1 --> (covov) c / (v0 * v1) if ((details::e_div == o0) && (details::e_div == o1)) @@ -24043,7 +24920,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // c / (v0 / v1) --> (covov) (c * v1) / v0 if ((details::e_div == o0) && (details::e_div == o1)) @@ -24099,7 +24976,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c0 + v) + c1 --> (cov) (c0 + c1) + v if ((details::e_add == o0) && (details::e_add == o1)) @@ -24209,7 +25086,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c0) + (v + c1) --> (cov) (c0 + c1) + v if ((details::e_add == o0) && (details::e_add == o1)) @@ -24329,7 +25206,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c0) + (c1 + v) --> (cov) (c0 + c1) + v if ((details::e_add == o0) && (details::e_add == o1)) @@ -24438,7 +25315,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v + c0) + c1 --> (voc) v + (c0 + c1) if ((details::e_add == o0) && (details::e_add == o1)) @@ -24568,7 +25445,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / v1) * (v2 / v3) --> (vovovov) (v0 * v2) / (v1 * v3) if ((details::e_div == o0) && (details::e_mul == o1) && (details::e_div == o2)) @@ -24648,7 +25525,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / v1) * (v2 / c) --> (vovovoc) (v0 * v2) / (v1 * c) if ((details::e_div == o0) && (details::e_mul == o1) && (details::e_div == o2)) @@ -24728,7 +25605,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / v1) * (c / v2) --> (vocovov) (v0 * c) / (v1 * v2) if ((details::e_div == o0) && (details::e_mul == o1) && (details::e_div == o2)) @@ -24808,7 +25685,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 / c) * (v1 / v2) --> (vovocov) (v0 * v1) / (c * v2) if ((details::e_div == o0) && (details::e_mul == o1) && (details::e_div == o2)) @@ -24888,7 +25765,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c / v0) * (v1 / v2) --> (covovov) (c * v1) / (v0 * v2) if ((details::e_div == o0) && (details::e_mul == o1) && (details::e_div == o2)) @@ -24968,7 +25845,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c0 + v0) + (c1 + v1) --> (covov) (c0 + c1) + v0 + v1 if ((details::e_add == o0) && (details::e_add == o1) && (details::e_add == o2)) @@ -25153,7 +26030,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 + c0) + (v1 + c1) --> (covov) (c0 + c1) + v0 + v1 if ((details::e_add == o0) && (details::e_add == o1) && (details::e_add == o2)) @@ -25388,7 +26265,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (c0 + v0) + (v1 + c1) --> (covov) (c0 + c1) + v0 + v1 if ((details::e_add == o0) && (details::e_add == o1) && (details::e_add == o2)) @@ -25573,7 +26450,7 @@ namespace exprtk expression_node_ptr result = error_node(); - if (expr_gen.strength_reduction_enabled()) + if (expr_gen.parser_->settings_.strength_reduction_enabled()) { // (v0 + c0) + (c1 + v1) --> (covov) (c0 + c1) + v0 + v1 if ((details::e_add == o0) && (details::e_add == o1) && (details::e_add == o2)) @@ -28535,18 +29412,17 @@ namespace exprtk parser(const parser&); parser& operator=(const parser&); + settings_store settings_; lexer::generator lexer_; lexer::token current_token_; lexer::token store_current_token_; expression_generator expression_generator_; details::node_allocator node_allocator_; - symbol_table_t symbol_table_; + symtab_store symtab_store_; dependent_entity_collector dec_; - std::size_t compile_options_; std::deque error_list_; std::deque brkcnt_list_; bool resolve_unknown_symbol_; - bool vardef_disabled_; std::size_t scope_depth_; unknown_symbol_resolver* unknown_symbol_resolver_; unknown_symbol_resolver default_usr_; @@ -30149,8 +31025,8 @@ namespace exprtk namespace information { static const char* library = "Mathematical Expression Toolkit"; - static const char* version = "2.7182818284590452353602874713526624977572470936999595"; - static const char* date = "20150111"; + static const char* version = "2.71828182845904523536028747135266249775724709369995957"; + static const char* date = "20150330"; static inline std::string data() { diff --git a/exprtk_simple_example_01.cpp b/exprtk_simple_example_01.cpp index 8782c71..b4abe17 100644 --- a/exprtk_simple_example_01.cpp +++ b/exprtk_simple_example_01.cpp @@ -24,16 +24,21 @@ template void trig_function() { + typedef exprtk::symbol_table symbol_table_t; + typedef exprtk::expression expression_t; + typedef exprtk::parser parser_t; + std::string expression_string = "clamp(-1.0,sin(2 * pi * x) + cos(x / 2 * pi),+1.0)"; T x; - exprtk::symbol_table symbol_table; + + symbol_table_t symbol_table; symbol_table.add_variable("x",x); symbol_table.add_constants(); - exprtk::expression expression; + expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; parser.compile(expression_string,expression); for (x = T(-5); x <= T(+5); x += T(0.001)) diff --git a/exprtk_simple_example_02.cpp b/exprtk_simple_example_02.cpp index 8f8f5b0..4f1848e 100644 --- a/exprtk_simple_example_02.cpp +++ b/exprtk_simple_example_02.cpp @@ -24,6 +24,10 @@ template void square_wave() { + typedef exprtk::symbol_table symbol_table_t; + typedef exprtk::expression expression_t; + typedef exprtk::parser parser_t; + std::string expr_string = "a*(4/pi)*" "((1 /1)*sin( 2*pi*f*t)+(1 /3)*sin( 6*pi*f*t)+" " (1 /5)*sin(10*pi*f*t)+(1 /7)*sin(14*pi*f*t)+" @@ -39,16 +43,16 @@ void square_wave() T t = T(0); T a = T(10); - exprtk::symbol_table symbol_table; + symbol_table_t symbol_table; symbol_table.add_variable("f",f); symbol_table.add_variable("t",t); symbol_table.add_variable("a",a); symbol_table.add_constants(); - exprtk::expression expression; + expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; parser.compile(expr_string,expression); const T delta = (T(4) * pi) / T(1000); diff --git a/exprtk_simple_example_03.cpp b/exprtk_simple_example_03.cpp index bf39a1b..11b8575 100644 --- a/exprtk_simple_example_03.cpp +++ b/exprtk_simple_example_03.cpp @@ -24,19 +24,23 @@ template void polynomial() { + typedef exprtk::symbol_table symbol_table_t; + typedef exprtk::expression expression_t; + typedef exprtk::parser parser_t; + std::string expression_string = "25x^5 - 35x^4 - 15x^3 + 40x^2 - 15x + 1"; T r0 = T(0); T r1 = T(1); T x = T(0); - exprtk::symbol_table symbol_table; + symbol_table_t symbol_table; symbol_table.add_variable("x",x); - exprtk::expression expression; + expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; parser.compile(expression_string,expression); const T delta = T(1.0 / 100.0); diff --git a/exprtk_simple_example_05.cpp b/exprtk_simple_example_05.cpp index 2034c92..6b528aa 100644 --- a/exprtk_simple_example_05.cpp +++ b/exprtk_simple_example_05.cpp @@ -37,13 +37,17 @@ struct myfunc : public exprtk::ifunction template void custom_function() { - typedef exprtk::expression expression_t; + typedef exprtk::symbol_table symbol_table_t; + typedef exprtk::expression expression_t; + typedef exprtk::parser parser_t; + std::string expression_string = "myfunc(sin(x * pi),y / 2)"; + T x = T(1); T y = T(2); myfunc mf; - exprtk::symbol_table symbol_table; + symbol_table_t symbol_table; symbol_table.add_variable("x",x); symbol_table.add_variable("y",y); symbol_table.add_function("myfunc",mf); @@ -52,7 +56,7 @@ void custom_function() expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; parser.compile(expression_string,expression); T result = expression.value(); diff --git a/exprtk_simple_example_07.cpp b/exprtk_simple_example_07.cpp index aa949ee..05b6ce2 100644 --- a/exprtk_simple_example_07.cpp +++ b/exprtk_simple_example_07.cpp @@ -24,10 +24,13 @@ template void logic() { - typedef exprtk::expression expression_t; + typedef exprtk::symbol_table symbol_table_t; + typedef exprtk::expression expression_t; + typedef exprtk::parser parser_t; + std::string expression_string = "not(A and B) or C"; - exprtk::symbol_table symbol_table; + symbol_table_t symbol_table; symbol_table.create_variable("A"); symbol_table.create_variable("B"); symbol_table.create_variable("C"); @@ -35,7 +38,7 @@ void logic() expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; parser.compile(expression_string,expression); printf(" # | A | B | C | %s\n" diff --git a/exprtk_test.cpp b/exprtk_test.cpp index f17abed..3c85938 100644 --- a/exprtk_test.cpp +++ b/exprtk_test.cpp @@ -33,1031 +33,1031 @@ typedef std::pair test_t; static const test_t test_list[] = { - // Note: Each of following tests must compile down - // to a single literal node. - test_t("0",0.0), - test_t("1",1.0), - test_t("2",2.0), - test_t("3",3.0), - test_t("4",4.0), - test_t("5",5.0), - test_t("6",6.0), - test_t("7",7.0), - test_t("8",8.0), - test_t("9",9.0), - test_t("12.12",12.12), - test_t("123.123",123.123), - test_t("1234.1234",1234.1234), - test_t("12345.12345",12345.12345), - test_t("123456.123456",123456.123456), - test_t("0.0",0.0), - test_t("1.0",1.0), - test_t("2.0",2.0), - test_t("3.0",3.0), - test_t("4.0",4.0), - test_t("5.0",5.0), - test_t("6.0",6.0), - test_t("7.0",7.0), - test_t("8.0",8.0), - test_t("9.0",9.0), - test_t("0.0",0.0), - test_t("1.1",1.1), - test_t("2.2",2.2), - test_t("3.3",3.3), - test_t("4.4",4.4), - test_t("5.5",5.5), - test_t("6.6",6.6), - test_t("7.7",7.7), - test_t("8.8",8.8), - test_t("9.9",9.9), - test_t("+0",0.0), - test_t("+1",1.0), - test_t("+2",2.0), - test_t("+3",3.0), - test_t("+4",4.0), - test_t("+5",5.0), - test_t("+6",6.0), - test_t("+7",7.0), - test_t("+8",8.0), - test_t("+9",9.0), - test_t("+0.0",0.0), - test_t("+1.0",1.0), - test_t("+2.0",2.0), - test_t("+3.0",3.0), - test_t("+4.0",4.0), - test_t("+5.0",5.0), - test_t("+6.0",6.0), - test_t("+7.0",7.0), - test_t("+8.0",8.0), - test_t("+9.0",9.0), - test_t("+0.0",0.0), - test_t("+1.1",1.1), - test_t("+2.2",2.2), - test_t("+3.3",3.3), - test_t("+4.4",4.4), - test_t("+5.5",5.5), - test_t("+6.6",6.6), - test_t("+7.7",7.7), - test_t("+8.8",8.8), - test_t("+9.9",9.9), - test_t("-0",-0.0), - test_t("-1",-1.0), - test_t("-2",-2.0), - test_t("-3",-3.0), - test_t("-4",-4.0), - test_t("-5",-5.0), - test_t("-6",-6.0), - test_t("-7",-7.0), - test_t("-8",-8.0), - test_t("-9",-9.0), - test_t("-0.0",-0.0), - test_t("-1.0",-1.0), - test_t("-2.0",-2.0), - test_t("-3.0",-3.0), - test_t("-4.0",-4.0), - test_t("-5.0",-5.0), - test_t("-6.0",-6.0), - test_t("-7.0",-7.0), - test_t("-8.0",-8.0), - test_t("-9.0",-9.0), - test_t("-0.0",-0.0), - test_t("-1.1",-1.1), - test_t("-2.2",-2.2), - test_t("-3.3",-3.3), - test_t("-4.4",-4.4), - test_t("-5.5",-5.5), - test_t("-6.6",-6.6), - test_t("-7.7",-7.7), - test_t("-8.8",-8.8), - test_t("-9.9",-9.9), - test_t("0.0e+0" ,+0.0e+0), - test_t("1.1e+1" ,+1.1e+1), - test_t("2.2e+2" ,+2.2e+2), - test_t("3.3e+3" ,+3.3e+3), - test_t("4.4e+4" ,+4.4e+4), - test_t("5.5e+5" ,+5.5e+5), - test_t("6.6e+6" ,+6.6e+6), - test_t("7.7e+7" ,+7.7e+7), - test_t("8.8e+8" ,+8.8e+8), - test_t("9.9e+9" ,+9.9e+9), - test_t("-0.0e+0",-0.0e+0), - test_t("-1.1e+1",-1.1e+1), - test_t("-2.2e+2",-2.2e+2), - test_t("-3.3e+3",-3.3e+3), - test_t("-4.4e+4",-4.4e+4), - test_t("-5.5e+5",-5.5e+5), - test_t("-6.6e+6",-6.6e+6), - test_t("-7.7e+7",-7.7e+7), - test_t("-8.8e+8",-8.8e+8), - test_t("-9.9e+9",-9.9e+9), - test_t("0.0E+0" ,+0.0E+0), - test_t("1.1E+1" ,+1.1E+1), - test_t("2.2E+2" ,+2.2E+2), - test_t("3.3E+3" ,+3.3E+3), - test_t("4.4E+4" ,+4.4E+4), - test_t("5.5E+5" ,+5.5E+5), - test_t("6.6E+6" ,+6.6E+6), - test_t("7.7E+7" ,+7.7E+7), - test_t("8.8E+8" ,+8.8E+8), - test_t("9.9E+9" ,+9.9E+9), - test_t("-0.0E+0",-0.0E+0), - test_t("-1.1E+1",-1.1E+1), - test_t("-2.2E+2",-2.2E+2), - test_t("-3.3E+3",-3.3E+3), - test_t("-4.4E+4",-4.4E+4), - test_t("-5.5E+5",-5.5E+5), - test_t("-6.6E+6",-6.6E+6), - test_t("-7.7E+7",-7.7E+7), - test_t("-8.8E+8",-8.8E+8), - test_t("-9.9E+9",-9.9E+9), - test_t("(0)",0.0), - test_t("(1)",1.0), - test_t("(2)",2.0), - test_t("(3)",3.0), - test_t("(4)",4.0), - test_t("(5)",5.0), - test_t("(6)",6.0), - test_t("(7)",7.0), - test_t("(8)",8.0), - test_t("(9)",9.0), - test_t("(0.0)",0.0), - test_t("(1.0)",1.0), - test_t("(2.0)",2.0), - test_t("(3.0)",3.0), - test_t("(4.0)",4.0), - test_t("(5.0)",5.0), - test_t("(6.0)",6.0), - test_t("(7.0)",7.0), - test_t("(8.0)",8.0), - test_t("(9.0)",9.0), - test_t("(0.0)",0.0), - test_t("(1.1)",1.1), - test_t("(2.2)",2.2), - test_t("(3.3)",3.3), - test_t("(4.4)",4.4), - test_t("(5.5)",5.5), - test_t("(6.6)",6.6), - test_t("(7.7)",7.7), - test_t("(8.8)",8.8), - test_t("(9.9)",9.9), - test_t("(+0)" ,0.0), - test_t("(+1)" ,1.0), - test_t("(+2)" ,2.0), - test_t("(+3)" ,3.0), - test_t("(+4)" ,4.0), - test_t("(+5)" ,5.0), - test_t("(+6)" ,6.0), - test_t("(+7)" ,7.0), - test_t("(+8)" ,8.0), - test_t("(+9)" ,9.0), - test_t("(+0.0)",0.0), - test_t("(+1.0)",1.0), - test_t("(+2.0)",2.0), - test_t("(+3.0)",3.0), - test_t("(+4.0)",4.0), - test_t("(+5.0)",5.0), - test_t("(+6.0)",6.0), - test_t("(+7.0)",7.0), - test_t("(+8.0)",8.0), - test_t("(+9.0)",9.0), - test_t("(+0.0)",0.0), - test_t("(+1.1)",1.1), - test_t("(+2.2)",2.2), - test_t("(+3.3)",3.3), - test_t("(+4.4)",4.4), - test_t("(+5.5)",5.5), - test_t("(+6.6)",6.6), - test_t("(+7.7)",7.7), - test_t("(+8.8)",8.8), - test_t("(+9.9)",9.9), - test_t("(-0)" ,-0.0), - test_t("(-1)" ,-1.0), - test_t("(-2)" ,-2.0), - test_t("(-3)" ,-3.0), - test_t("(-4)" ,-4.0), - test_t("(-5)" ,-5.0), - test_t("(-6)" ,-6.0), - test_t("(-7)" ,-7.0), - test_t("(-8)" ,-8.0), - test_t("(-9)" ,-9.0), - test_t("(-0.0)",-0.0), - test_t("(-1.0)",-1.0), - test_t("(-2.0)",-2.0), - test_t("(-3.0)",-3.0), - test_t("(-4.0)",-4.0), - test_t("(-5.0)",-5.0), - test_t("(-6.0)",-6.0), - test_t("(-7.0)",-7.0), - test_t("(-8.0)",-8.0), - test_t("(-9.0)",-9.0), - test_t("(-0.0)",-0.0), - test_t("(-1.1)",-1.1), - test_t("(-2.2)",-2.2), - test_t("(-3.3)",-3.3), - test_t("(-4.4)",-4.4), - test_t("(-5.5)",-5.5), - test_t("(-6.6)",-6.6), - test_t("(-7.7)",-7.7), - test_t("(-8.8)",-8.8), - test_t("(-9.9)",-9.9), - test_t("-(1.1)",-1.1), - test_t("-(1.1+2.2)",-3.3), - test_t("1234567890",1234567890), - test_t("123456789.0",123456789.0), - test_t("+1234567890",1234567890), - test_t("+123456789.0",123456789.0), - test_t("-1234567890",-1234567890), - test_t("-123456789.0",-123456789.0), - test_t("1234.567890",1234.567890), - test_t("-1234.567890",-1234.567890), - test_t("0+9",9.0), - test_t("1+8",9.0), - test_t("2+7",9.0), - test_t("3+6",9.0), - test_t("4+5",9.0), - test_t("5+4",9.0), - test_t("6+3",9.0), - test_t("7+2",9.0), - test_t("8+1",9.0), - test_t("9+0",9.0), - test_t(" 0 + 9 ",9.0), - test_t(" 1 + 8 ",9.0), - test_t(" 2 + 7 ",9.0), - test_t(" 3 + 6 ",9.0), - test_t(" 4 + 5 ",9.0), - test_t(" 5 + 4 ",9.0), - test_t(" 6 + 3 ",9.0), - test_t(" 7 + 2 ",9.0), - test_t(" 8 + 1 ",9.0), - test_t(" 9 + 0 ",9.0), - test_t("( 0 + 9 )",9.0), - test_t("( 1 + 8 )",9.0), - test_t("( 2 + 7 )",9.0), - test_t("( 3 + 6 )",9.0), - test_t("( 4 + 5 )",9.0), - test_t("( 5 + 4 )",9.0), - test_t("( 6 + 3 )",9.0), - test_t("( 7 + 2 )",9.0), - test_t("( 8 + 1 )",9.0), - test_t("( 9 + 0 )",9.0), - test_t("1+2",+3.0), - test_t("1-2",-1.0), - test_t("1*2",+2.0), - test_t("1/2",+0.5), - test_t("1.1+2.2", +3.3), - test_t("1.1-2.2", -1.1), - test_t("1.1*2.2",+2.42), - test_t("1.1/2.2", +0.5), - test_t("0-9",-9.0), - test_t("1-8",-7.0), - test_t("2-7",-5.0), - test_t("3-6",-3.0), - test_t("4-5",-1.0), - test_t("5-4",+1.0), - test_t("6-3",+3.0), - test_t("7-2",+5.0), - test_t("8-1",+7.0), - test_t("9-0",+9.0), - test_t(" 0 - 9 ",-9.0), - test_t(" 1 - 8 ",-7.0), - test_t(" 2 - 7 ",-5.0), - test_t(" 3 - 6 ",-3.0), - test_t(" 4 - 5 ",-1.0), - test_t(" 5 - 4 ",+1.0), - test_t(" 6 - 3 ",+3.0), - test_t(" 7 - 2 ",+5.0), - test_t(" 8 - 1 ",+7.0), - test_t(" 9 - 0 ",+9.0), - test_t("( 0 - 9 )",-9.0), - test_t("( 1 - 8 )",-7.0), - test_t("( 2 - 7 )",-5.0), - test_t("( 3 - 6 )",-3.0), - test_t("( 4 - 5 )",-1.0), - test_t("( 5 - 4 )",+1.0), - test_t("( 6 - 3 )",+3.0), - test_t("( 7 - 2 )",+5.0), - test_t("( 8 - 1 )",+7.0), - test_t("( 9 - 0 )",+9.0), - test_t("-(1+2)",-3.0), - test_t("+(1+2)",+3.0), - test_t("+(1-2)",-1.0), - test_t("-(1-2)",+1.0), - test_t("(-3*-6)",+18.0), - test_t("(-6*-3)",+18.0), - test_t("-(-3*-6)",-18.0), - test_t("-(-6*-3)",-18.0), - test_t("1.1+2.2+3.3",+6.6), - test_t("+1.1+2.2+3.3",+6.6), - test_t("-1.1-2.2-3.3",-6.6), - test_t("1.1*2.2*3.3",+7.986), - test_t("+1.1*2.2*3.3",+7.986), - test_t("-1.1*-2.2*-3.3",-7.986), - test_t("1 + 1/2",+1.5), - test_t("1 + (1/2)",+1.5), - test_t("1.1 + 1.1/2.2",+1.6), - test_t("1.1 + (1.1/2.2)",+1.6), - test_t("2 * 1/2",+1.0), - test_t("2 * (1/2)",+1.0), - test_t("2.2 * 1.1/2.2",+1.1), - test_t("2.2 * (1.1/2.2)",+1.1), - test_t("1^2",1.0), - test_t("2^1",2.0), - test_t("2^3",8.0), - test_t("-2^3",-8.0), - test_t("-2^4",-16.0), - test_t("(-2)^3",-8.0), - test_t("(-2)^4",+16.0), - test_t("3^2^4",43046721.0), - test_t("1.1^2.2",1.23328630055466251099), - test_t("2.2^1.1",2.3804822576003541627), - test_t("2.2^3.3",13.48946876053338489127), - test_t("3.3^2.2^1.1",17.15193942371376191362), - test_t("+3.3^2.2^1.1",17.15193942371376191362), - test_t("3.3^+2.2^1.1",17.15193942371376191362), - test_t("3.3^2.2^+1.1",17.15193942371376191362), - test_t("3.3^2.2^-1.1",1.65127293793867959137), - test_t("+3.3^+2.2^-1.1",1.65127293793867959137), - test_t("1.1^(1.1 * 2.2)",1.25941916576299080582), - test_t("2.2^(1.1 * 3.3)",17.49823848953534759743), - test_t("3.3^(1.1 * 2.2)",17.98058156638874965269), - test_t("1.1^-2.2/1.1",0.73712884727743375853), - test_t("1.1^+2.2/1.1",1.121169364140602282717273261774), - test_t("1.1^2.2/+1.1",1.121169364140602282717273261774), - test_t("1.1^+2.2/+1.1",1.121169364140602282717273261774), - test_t("1.1^+2.2/-1.1",-1.121169364140602282717273261774), - test_t("1.1^2.2/-1.1",-1.121169364140602282717273261774), - test_t("1.1^+2.2/-1.1",-1.121169364140602282717273261774), - test_t("+1.1^-2.2/1.1",0.73712884727743375853), - test_t("+1.1^+2.2/1.1",1.121169364140602282717273261774), - test_t("+1.1^2.2/+1.1",1.121169364140602282717273261774), - test_t("+1.1^+2.2/+1.1",1.121169364140602282717273261774), - test_t("+1.1^+2.2/-1.1",-1.121169364140602282717273261774), - test_t("+1.1^2.2/-1.1",-1.121169364140602282717273261774), - test_t("+1.1^+2.2/-1.1",-1.121169364140602282717273261774), - test_t("equal(1.23^3,(1.23 * 1.23 * 1.23))",1.0), - test_t("equal(1.23^-3,1/(1.23 * 1.23 * 1.23))",1.0), - test_t("equal((2.1 + 1.23^3),(2.1 + [1.23 * 1.23 * 1.23]))",1.0), - test_t("equal((2.1 - 1.23^3),(2.1 - [1.23 * 1.23 * 1.23]))",1.0), - test_t("equal((2.1 * 1.23^3),(2.1 * [1.23 * 1.23 * 1.23]))",1.0), - test_t("equal((2.1 / 1.23^3),(2.1 / [1.23 * 1.23 * 1.23]))",1.0), - test_t("equal((1.23^3 + 2.1),({1.23 * 1.23 * 1.23} + 2.1))",1.0), - test_t("equal((1.23^3 - 2.1),({1.23 * 1.23 * 1.23} - 2.1))",1.0), - test_t("equal((1.23^3 * 2.1),({1.23 * 1.23 * 1.23} * 2.1))",1.0), - test_t("equal((1.23^3 / 2.1),({1.23 * 1.23 * 1.23} / 2.1))",1.0), - test_t("equal(1.0^(1.0/2.0),sqrt(1.0))",1.0), - test_t("equal(1.0^(1.0/2.0),root(1.0,2.0))",1.0), - test_t("equal(1.0^(1.0/3.0),root(1.0,3.0))",1.0), - test_t("equal(1.0^(1.0/4.0),root(1.0,4.0))",1.0), - test_t("equal(1.0^(1.0/5.0),root(1.0,5.0))",1.0), - test_t("equal(1.0^(1.0/6.0),root(1.0,6.0))",1.0), - test_t("equal(1.0^(1.0/7.0),root(1.0,7.0))",1.0), - test_t("equal(1.0^(1.0/8.0),root(1.0,8.0))",1.0), - test_t("equal(1.0^(1.0/9.0),root(1.0,9.0))",1.0), - test_t("equal(2.0^(1.0/2.0),sqrt(2.0))",1.0), - test_t("equal(2.0^(1.0/2.0),root(2.0,2.0))",1.0), - test_t("equal(3.0^(1.0/3.0),root(3.0,3.0))",1.0), - test_t("equal(4.0^(1.0/4.0),root(4.0,4.0))",1.0), - test_t("equal(5.0^(1.0/5.0),root(5.0,5.0))",1.0), - test_t("equal(6.0^(1.0/6.0),root(6.0,6.0))",1.0), - test_t("equal(7.0^(1.0/7.0),root(7.0,7.0))",1.0), - test_t("equal(8.0^(1.0/8.0),root(8.0,8.0))",1.0), - test_t("equal(9.0^(1.0/9.0),root(9.0,9.0))",1.0), - test_t("1 < 2", 1.0), - test_t("1 <= 2", 1.0), - test_t("1.1 <= 2.2", 1.0), - test_t("(1.0 + 0.1) <= (2.0 + 0.2)", 1.0), - test_t("1 > 2", 0.0), - test_t("1 >= 2", 0.0), - test_t("1.1 >= 2.2", 0.0), - test_t("(1.0 + 0.1) >= (2.0 + 0.2)", 0.0), - test_t("1 <> 2", 1.0), - test_t("1 != 2", 1.0), - test_t("1.1 <> 2.2", 1.0), - test_t("1.1 != 2.2", 1.0), - test_t("(1.0 + 0.1) <> (2.0 + 0.2)", 1.0), - test_t("(1.0 + 0.1) != (2.0 + 0.2)", 1.0), - test_t("1 == 1", 1.0), - test_t("1.1 == 1.1", 1.0), - test_t("1 = 1", 1.0), - test_t("1.1 = 1.1", 1.0), - test_t("1 <> 1", 0.0), - test_t("1 != 1", 0.0), - test_t("1.1 <> 1.1", 0.0), - test_t("1.1 != 1.1", 0.0), - test_t("(1.0 + 0.1) <> (1.0 + 0.1)", 0.0), - test_t("(1.0 + 0.1) != (1.0 + 0.1)", 0.0), - test_t("equal(1.1,1.1)",1.0), - test_t("equal(1.1,2.2)",0.0), - test_t("not_equal(1.1,1.1)",0.0), - test_t("not_equal(1.1,2.2)",1.0), - test_t("1 and 1",1.0), - test_t("1 and 0",0.0), - test_t("0 and 1",0.0), - test_t("0 and 0",0.0), - test_t("1.0 and 1.0",1.0), - test_t("1.0 and 0.0",0.0), - test_t("0.0 and 1.0",0.0), - test_t("0.0 and 0.0",0.0), - test_t("(1 and 1)",1.0), - test_t("(1 and 0)",0.0), - test_t("(0 and 1)",0.0), - test_t("(0 and 0)",0.0), - test_t("(1.0 and 1.0)",1.0), - test_t("(1.0 and 0.0)",0.0), - test_t("(0.0 and 1.0)",0.0), - test_t("(0.0 and 0.0)",0.0), - test_t("1 or 1",1.0), - test_t("1 or 0",1.0), - test_t("0 or 1",1.0), - test_t("0 or 0",0.0), - test_t("1.0 or 1.0",1.0), - test_t("1.0 or 0.0",1.0), - test_t("0.0 or 1.0",1.0), - test_t("0.0 or 0.0",0.0), - test_t("(1 or 1)",1.0), - test_t("(1 or 0)",1.0), - test_t("(0 or 1)",1.0), - test_t("(0 or 0)",0.0), - test_t("(1.0 or 1.0)",1.0), - test_t("(1.0 or 0.0)",1.0), - test_t("(0.0 or 1.0)",1.0), - test_t("(0.0 or 0.0)",0.0), - test_t("1 nand 1",0.0), - test_t("1 nand 0",1.0), - test_t("0 nand 1",1.0), - test_t("0 nand 0",1.0), - test_t("1.0 nand 1.0",0.0), - test_t("1.0 nand 0.0",1.0), - test_t("0.0 nand 1.0",1.0), - test_t("0.0 nand 0.0",1.0), - test_t("(1 nand 1)",0.0), - test_t("(1 nand 0)",1.0), - test_t("(0 nand 1)",1.0), - test_t("(0 nand 0)",1.0), - test_t("(1.0 nand 1.0)",0.0), - test_t("(1.0 nand 0.0)",1.0), - test_t("(0.0 nand 1.0)",1.0), - test_t("(0.0 nand 0.0)",1.0), - test_t("1 nor 1",0.0), - test_t("1 nor 0",0.0), - test_t("0 nor 1",0.0), - test_t("0 nor 0",1.0), - test_t("1.0 nor 1.0",0.0), - test_t("1.0 nor 0.0",0.0), - test_t("0.0 nor 1.0",0.0), - test_t("0.0 nor 0.0",1.0), - test_t("(1 nor 1)",0.0), - test_t("(1 nor 0)",0.0), - test_t("(0 nor 1)",0.0), - test_t("(0 nor 0)",1.0), - test_t("(1.0 nor 1.0)",0.0), - test_t("(1.0 nor 0.0)",0.0), - test_t("(0.0 nor 1.0)",0.0), - test_t("(0.0 nor 0.0)",1.0), - test_t("0 xor 0",0.0), - test_t("0 xor 1",1.0), - test_t("1 xor 0",1.0), - test_t("1 xor 1",0.0), - test_t("0.0 xor 0.0",0.0), - test_t("0.0 xor 1.0",1.0), - test_t("1.0 xor 0.0",1.0), - test_t("1.0 xor 1.0",0.0), - test_t("(0 xor 0)",0.0), - test_t("(0 xor 1)",1.0), - test_t("(1 xor 0)",1.0), - test_t("(1 xor 1)",0.0), - test_t("(0.0 xor 0.0)",0.0), - test_t("(0.0 xor 1.0)",1.0), - test_t("(1.0 xor 0.0)",1.0), - test_t("(1.0 xor 1.0)",0.0), - test_t("1 & 1",1.0), - test_t("1 & 0",0.0), - test_t("0 & 1",0.0), - test_t("0 & 0",0.0), - test_t("1.0 & 1.0",1.0), - test_t("1.0 & 0.0",0.0), - test_t("0.0 & 1.0",0.0), - test_t("0.0 & 0.0",0.0), - test_t("(1 & 1)",1.0), - test_t("(1 & 0)",0.0), - test_t("(0 & 1)",0.0), - test_t("(0 & 0)",0.0), - test_t("(1.0 & 1.0)",1.0), - test_t("(1.0 & 0.0)",0.0), - test_t("(0.0 & 1.0)",0.0), - test_t("(0.0 & 0.0)",0.0), - test_t("1 | 1",1.0), - test_t("1 | 0",1.0), - test_t("0 | 1",1.0), - test_t("0 | 0",0.0), - test_t("1.0 | 1.0",1.0), - test_t("1.0 | 0.0",1.0), - test_t("0.0 | 1.0",1.0), - test_t("0.0 | 0.0",0.0), - test_t("(1 | 1)",1.0), - test_t("(1 | 0)",1.0), - test_t("(0 | 1)",1.0), - test_t("(0 | 0)",0.0), - test_t("(1.0 | 1.0)",1.0), - test_t("(1.0 | 0.0)",1.0), - test_t("(0.0 | 1.0)",1.0), - test_t("(0.0 | 0.0)",0.0), - test_t("(1 nand 1) == not(1 and 1)",1.0), - test_t("(1 nand 0) == not(1 and 0)",1.0), - test_t("(0 nand 1) == not(0 and 1)",1.0), - test_t("(0 nand 0) == not(0 and 0)",1.0), - test_t("(1 nor 1) == not(1 or 1)",1.0), - test_t("(1 nor 0) == not(1 or 0)",1.0), - test_t("(0 nor 1) == not(0 or 1)",1.0), - test_t("(0 nor 0) == not(0 or 0)",1.0), - test_t("(1.0 nand 1.0) == not(1.0 and 1.0)",1.0), - test_t("(1.0 nand 0.0) == not(1.0 and 0.0)",1.0), - test_t("(0.0 nand 1.0) == not(0.0 and 1.0)",1.0), - test_t("(0.0 nand 0.0) == not(0.0 and 0.0)",1.0), - test_t("(1.0 nor 1.0) == not(1.0 or 1.0)",1.0), - test_t("(1.0 nor 0.0) == not(1.0 or 0.0)",1.0), - test_t("(0.0 nor 1.0) == not(0.0 or 1.0)",1.0), - test_t("(0.0 nor 0.0) == not(0.0 or 0.0)",1.0), - test_t("(1 nand 1) == not(1 & 1)",1.0), - test_t("(1 nand 0) == not(1 & 0)",1.0), - test_t("(0 nand 1) == not(0 & 1)",1.0), - test_t("(0 nand 0) == not(0 & 0)",1.0), - test_t("(1 nor 1) == not(1 | 1)",1.0), - test_t("(1 nor 0) == not(1 | 0)",1.0), - test_t("(0 nor 1) == not(0 | 1)",1.0), - test_t("(0 nor 0) == not(0 | 0)",1.0), - test_t("(1.0 nand 1.0) == not(1.0 & 1.0)",1.0), - test_t("(1.0 nand 0.0) == not(1.0 & 0.0)",1.0), - test_t("(0.0 nand 1.0) == not(0.0 & 1.0)",1.0), - test_t("(0.0 nand 0.0) == not(0.0 & 0.0)",1.0), - test_t("(1.0 nor 1.0) == not(1.0 | 1.0)",1.0), - test_t("(1.0 nor 0.0) == not(1.0 | 0.0)",1.0), - test_t("(0.0 nor 1.0) == not(0.0 | 1.0)",1.0), - test_t("(0.0 nor 0.0) == not(0.0 | 0.0)",1.0), - test_t("mand(1,1)",1.0), - test_t("mand(1,0)",0.0), - test_t("mand(0,1)",0.0), - test_t("mand(0,0)",0.0), - test_t("mand(1.0,1.0)",1.0), - test_t("mand(1.0,0.0)",0.0), - test_t("mand(0.0,1.0)",0.0), - test_t("mand(0.0,0.0)",0.0), - test_t("mor(1,1)",1.0), - test_t("mor(1,0)",1.0), - test_t("mor(0,1)",1.0), - test_t("mor(0,0)",0.0), - test_t("mor(1.0,1.0)",1.0), - test_t("mor(1.0,0.0)",1.0), - test_t("mor(0.0,1.0)",1.0), - test_t("mor(0.0,0.0)",0.0), - test_t("(1 nand 1) == not(mand(1,1))",1.0), - test_t("(1 nand 0) == not(mand(1,0))",1.0), - test_t("(0 nand 1) == not(mand(0,1))",1.0), - test_t("(0 nand 0) == not(mand(0,0))",1.0), - test_t("(1 nor 1) == not(mor(1,1))",1.0), - test_t("(1 nor 0) == not(mor(1,0))",1.0), - test_t("(0 nor 1) == not(mor(0,1))",1.0), - test_t("(0 nor 0) == not(mor(0,0))",1.0), - test_t("(1.0 nand 1.0) == not(mand(1.0,1.0))",1.0), - test_t("(1.0 nand 0.0) == not(mand(1.0,0.0))",1.0), - test_t("(0.0 nand 1.0) == not(mand(0.0,1.0))",1.0), - test_t("(0.0 nand 0.0) == not(mand(0.0,0.0))",1.0), - test_t("(1.0 nor 1.0) == not(mor(1.0,1.0))",1.0), - test_t("(1.0 nor 0.0) == not(mor(1.0,0.0))",1.0), - test_t("(0.0 nor 1.0) == not(mor(0.0,1.0))",1.0), - test_t("(0.0 nor 0.0) == not(mor(0.0,0.0))",1.0), - test_t("abs(1)",1.0), - test_t("abs(-1)",1.0), - test_t("abs(1.0)",1.0), - test_t("abs(-1.0)",1.0), - test_t("min(1,2)",1.0), - test_t("min(1,2,3)",1.0), - test_t("min(1,2,3,4)",1.0), - test_t("min(1,2,3,4,5)",1.0), - test_t("min(1,2,3,4,5,6)",1.0), - test_t("min(1.1,2.2)",1.1), - test_t("min(1.1,2.2,3.3)",1.1), - test_t("min(1.1,2.2,3.3,4.4)",1.1), - test_t("min(1.1,2.2,3.3,4.4,5.5)",1.1), - test_t("min(1.1,2.2,3.3,4.4,5.5,6.6)",1.1), - test_t("min(min(1,2),min(3,4))",1.0), - test_t("max(1,2)",2.0), - test_t("max(1,2,3)",3.0), - test_t("max(1,2,3,4)",4.0), - test_t("max(1,2,3,4,5)",5.0), - test_t("max(1,2,3,4,5,6)",6.0), - test_t("max(1.1,2.2)",2.2), - test_t("max(1.1,2.2,3.3)",3.3), - test_t("max(1.1,2.2,3.3,4.4)",4.4), - test_t("max(1.1,2.2,3.3,4.4,5.5)",5.5), - test_t("max(1.1,2.2,3.3,4.4,5.5,6.6)",6.6), - test_t("max(max(1,2),max(3,4))",4.0), - test_t("avg(1,2)",1.5), - test_t("avg(1,2,3)",2.0), - test_t("avg(1,2,3,4)",2.5), - test_t("avg(1,2,3,4,5)",3.0), - test_t("avg(1.1,2.2)",1.65), - test_t("avg(1.1,2.2,3.3)",2.2), - test_t("avg(1.1,2.2,3.3,4.4)",2.75), - test_t("avg(1.1,2.2,3.3,4.4,5.5)",3.3), - test_t("avg(1.1,2.2,3.3,4.4,5.5,6.6)",3.85), - test_t("sum(1,2)",3.0), - test_t("sum(1,2,3)",6.0), - test_t("sum(1,2,3,4)",10), - test_t("sum(1,2,3,4,5)",15.0), - test_t("sum(1,2,3,4,5,6)",21), - test_t("sum(1.1,2.2)",3.3), - test_t("sum(1.1,2.2,3.3)",6.6), - test_t("sum(1.1,2.2,3.3,4.4)",11.0), - test_t("sum(1.1,2.2,3.3,4.4,5.5)",16.5), - test_t("sum(1.1,2.2,3.3,4.4,5.5,6.6)",23.1), - test_t("mul(1,2)",2.0), - test_t("mul(1,2,3)",6.0), - test_t("mul(1,2,3,4)",24.0), - test_t("mul(1,2,3,4,5)",120.0), - test_t("mul(1,2,3,4,5,6)",720.0), - test_t("mul(1.1,2.2)",2.42), - test_t("mul(1.1,2.2,3.3)",7.986), - test_t("mul(1.1,2.2,3.3,4.4)",35.1384), - test_t("mul(1.1,2.2,3.3,4.4,5.5)",193.2612), - test_t("mul(1.1,2.2,3.3,4.4,5.5,6.6)",1275.52392), - test_t("equal(sum(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),(1.1+2.2+3.3+4.4+5.5+6.6+7.7+8.8+9.9))",1.0), - test_t("equal(mul(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),(1.1*2.2*3.3*4.4*5.5*6.6*7.7*8.8*9.9))",1.0), - test_t("equal(min(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),1.1)",1.0), - test_t("equal(max(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),9.9)",1.0), - test_t("equal(avg(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),5.5)",1.0), - test_t("floor(1.0)",1.0), - test_t("floor(1.1)",1.0), - test_t("floor(-1.0)",-1.0), - test_t("floor(-1.1)",-2.0), - test_t("ceil(1.0)",1.0), - test_t("ceil(1.1)",2.0), - test_t("ceil(-1.0)",-1.0), - test_t("ceil(-1.1)",-1.0), - test_t("round(1.1)",1.0), - test_t("round(1.49)",1.0), - test_t("round(1.5)",2.0), - test_t("round(1.9)",2.0), - test_t("roundn(1/3,2)",0.33), - test_t("roundn(1/3,5)",0.33333), - test_t("roundn(2/3,2)",0.67), - test_t("roundn(2/3,5)",0.66667), - test_t("roundn(1.0/3.0,2.0)",0.33), - test_t("roundn(1.0/3.0,5.0)",0.33333), - test_t("roundn(2.0/3.0,2.0)",0.67), - test_t("roundn(2.0/3.0,5.0)",0.66667), - test_t("cos(0.0)",1.0), - test_t("sin(0.0)",0.0), - test_t("equal(sin(pi/4.0),cos(pi/4.0))",1.0), - test_t("equal(sin(pi/6.0),cos(pi/3.0))",1.0), - test_t("(sin(pi/4.0) - cos(pi/4.0)) <= epsilon",1.0), - test_t("(cos(pi/3.0) - sin(pi/6.0)) <= epsilon",1.0), - test_t("sin(deg2rad(30))",0.5), - test_t("cos(deg2rad(60))",0.5), - test_t("sin(deg2rad(30)) + cos(deg2rad(60))",1.0), - test_t("equal(sin(deg2rad(30))/cos(deg2rad(30)),tan(deg2rad(30)))",1.0), - test_t("equal(sinh(pi),11.5487393572577483779773343153884) ",1.0), - test_t("equal(asinh(11.5487393572577483779773343153884),pi)",1.0), - test_t("equal(cosh(pi),11.5919532755215206277517520525601) ",1.0), - test_t("equal(acosh(11.5919532755215206277517520525601),pi)",1.0), - test_t("equal(tanh(pi),0.99627207622074994426469058001253) ",1.0), - test_t("equal(atanh(0.99627207622074994426469058001253),pi)",1.0), - test_t("exp(1.0)",2.71828182845904523536028747135266249775724), - test_t("exp(0.0)",1.0), - test_t("log(2.7182818284590451)",1.0), - test_t("log10(10.0)",1.0), - test_t("frac(12.34) + trunc(12.34)",12.34), - test_t("hypot(3.0,4.0)",5.0), - test_t("hypot(1.0,sqrt(3.0))",2.0), - test_t("if(1 < 2, 3, 4)",3.0), - test_t("if(1.1 < 2.2, 3.3, 4.4)",3.3), - test_t("if((1.0+1.1) < (2.0+1.2), 3.3, 4.4)",3.3), - test_t("if(1 = 2, 3, 4)",4.0), - test_t("if(1.1 = 2.2, 3.3, 4.4)",4.4), - test_t("if((1.0+1.1) = (2.0+1.2), 3.3, 4.4)",4.4), - test_t("if(1 == 2, 3, 4)",4.0), - test_t("if(1.1 == 2.2, 3.3, 4.4)",4.4), - test_t("if((1.0+1.1) == (2.0+1.2), 3.3, 4.4)",4.4), - test_t("if(1 >= 2, 3, 4)",4.0), - test_t("if(1.1 >= 2.2, 3.3, 4.4)",4.4), - test_t("if((1.0+1.1) >= (2.0+1.2), 3.3, 4.4)",4.4), - test_t("if(((1.0 + 2.0) == 3.0) and ((4.0 + 5.0) < 9.0),1,2)",2.0), - test_t("(3.0 - 1.0 - 2.0) == ((3.0 - 1.0) - 2.0)",1.0), - test_t("true == true",1.0), - test_t("false == false",1.0), - test_t("true != false",1.0), - test_t("false != true",1.0), - test_t("(1 < 2) == true",1.0), - test_t("(1 > 2) == false",1.0), - test_t("true == (1 < 2)",1.0), - test_t("false == (1 > 2)",1.0), - test_t("(1 > 2) != true",1.0), - test_t("(1 < 2) != false",1.0), - test_t("true != (1 > 2)",1.0), - test_t("false != (1 < 2)",1.0), - test_t("(true and true) == true",1.0), - test_t("(false and false) == false",1.0), - test_t("(true or true) == true",1.0), - test_t("(false or false) == false",1.0), - test_t("(true and false) == false",1.0), - test_t("(false and true) == false",1.0), - test_t("(true or false) == true",1.0), - test_t("(false or true) == true",1.0), - test_t("(true & true) == true",1.0), - test_t("(false & false) == false",1.0), - test_t("(true | true) == true",1.0), - test_t("(false | false) == false",1.0), - test_t("(true & false) == false",1.0), - test_t("(false & true) == false",1.0), - test_t("(true | false) == true",1.0), - test_t("(false | true) == true",1.0), - test_t("clamp(-1,1,+1)",1.0), - test_t("clamp(-1,-1.5,+1.0)",-1.0), - test_t("clamp(-1,+1.5,+1.0)",+1.0), - test_t("clamp(-1,-1.5,+1.0) + clamp(-1,+1.5,+1.0)",0.0), - test_t("inrange(-2,1,+2) == ((-2 <= 1) and (1 <= +2))",1.0), - test_t("inrange(-2,1,+2) == if(({-2 <= 1} and [1 <= +2]),1.0,0.0)",1.0), - test_t("sgn( 0)", 0.0), - test_t("sgn(+3)",+1.0), - test_t("sgn(-3)",-1.0), - test_t("equal($f00(1.1,2.2,3.3),(1.1+2.2)/3.3)",1.0), - 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-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), - test_t("1+2+3+4+5+6+7+8+9+0",45.0), - test_t("1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0",45.0), - test_t("1.0 + 2.0 + 3.0 + 4.0 + 5.0 + 6.0 + 7.0 + 8.0 + 9.0 + 0.0",45.0), - test_t("(1+2)+(3+4)+(5+6)+(7+8)+(9+0)",45.0), - test_t("(1-2)+(3-4)+(5-6)+(7-8)+(9-0)",+5.0), - test_t("(1+2)-(3+4)-(5+6)-(7+8)-(9+0)",-39.0), - test_t("(1.0+2.0)+(3.0+4.0)+(5.0+6.0)+(7.0+8.0)+(9.0+0.0)",45.0), - test_t("(1.0-2.0)+(3.0-4.0)+(5.0-6.0)+(7.0-8.0)+(9.0-0.0)",+5.0), - test_t("(1.0+2.0)-(3.0+4.0)-(5.0+6.0)-(7.0+8.0)-(9.0+0.0)",-39.0), - test_t("[(1.0+2.0)+[3.0+4.0]+(5.0+6.0)]+([7.0+8.0]+(9.0+0.0))",45.0), - test_t("([1.0-2.0]+(3.0-4.0)+[5.0-6.0])+[(7.0-8.0)+[9.0-0.0]]",+5.0), - test_t("((1.0+2.0))-[(3.0+4.0)]-((5.0+6.0))-[(7.0+8.0)]-((9.0+0.0))",-39.0), - test_t("{[(1.0+2.0)+[3.0+4.0]+({5.0+6.0})]}+({[7.0+8.0]+(9.0+0.0)})",45.0), - test_t("{([1.0-2.0]+(3.0-4.0)+[5.0-6.0])}+[({+7.0}-{+8.0})+[{+9.0-0.0}]]",+5.0), - test_t("((+1.0+2.0))-[({+3.0+4.0})]-(({+5.0+6.0}))-[({+7.0}+8.0)]-(({+9.0}+{0.0}))",-39.0), - test_t("1+2-3*4/5+6-7*8/9+0",0.37777777777777777778), - test_t("1.1+2.2-3.3*4.4/5.5+6.6-7.7*8.8/9.9+0.0",0.41555555555555555556), - test_t("(1+2)-(3*4)/(5+6)-(7*8)/(9+0)",-4.31313131313131313131), - test_t("1/1+1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9",2.82896825396825396825), - test_t("(1/1)+(1/2)+(1/3)+(1/4)+(1/5)+(1/6)+(1/7)+(1/8)+(1/9)",2.82896825396825396825), - test_t("1.0/1.0+1.0/2.0+1.0/3.0+1.0/4.0+1.0/5.0+1.0/6.0+1.0/7.0+1.0/8.0+1.0/9",2.82896825396825396825), - test_t("(1.0/1.0)+(1.0/2.0)+(1.0/3.0)+(1.0/4.0)+(1.0/5.0)+(1.0/6.0)+(1.0/7.0)+(1.0/8.0)+(1.0/9)",2.82896825396825396825), - test_t("1/1*1/2*1/3*1/4*1/5*1/6*1/7*1/8*1/9",0.00000275573192239859), - test_t("(1/1)*(1/2)*(1/3)*(1/4)*(1/5)*(1/6)*(1/7)*(1/8)*(1/9)",0.00000275573192239859), - test_t("1.0/1.0*1.0/2.0*1.0/3.0*1.0/4.0*1.0/5.0*1.0/6.0*1.0/7.0*1.0/8.0*1.0/9",0.00000275573192239859), - test_t("(1.0/1.0)*(1.0/2.0)*(1.0/3.0)*(1.0/4.0)*(1.0/5.0)*(1.0/6.0)*(1.0/7.0)*(1.0/8.0)*(1.0/9)",0.00000275573192239859), - test_t("equal(poly01(1.2345,2.2,1.1),(2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly02(1.2345,3.3,2.2,1.1),(3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly03(1.2345,4.4,3.3,2.2,1.1),(4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly04(1.2345,5.5,4.4,3.3,2.2,1.1),(5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly05(1.2345,6.6,5.5,4.4,3.3,2.2,1.1),(6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly06(1.2345,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly07(1.2345,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(8.8*1.2345^7+7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly08(1.2345,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(9.9*1.2345^8+8.8*1.2345^7+7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly09(1.2345,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(1.1*1.2345^9+9.9*1.2345^8+8.8*1.2345^7+7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), - test_t("equal(poly10(1.37,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(2.2*1.37^10+1.1*1.37^9+9.9*1.37^8+8.8*1.37^7+7.7*1.37^6+6.6*1.37^5+5.5*1.37^4+4.4*1.37^3+3.3*1.37^2+2.2*1.37^1+1.1))",1.0), - test_t("equal(poly11(1.37,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(3.3*1.37^11+2.2*1.37^10+1.1*1.37^9+9.9*1.37^8+8.8*1.37^7+7.7*1.37^6+6.6*1.37^5+5.5*1.37^4+4.4*1.37^3+3.3*1.37^2+2.2*1.37^1+1.1))",1.0), - test_t("equal(poly12(1.37,4.4,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(4.4*1.37^12+3.3*1.37^11+2.2*1.37^10+1.1*1.37^9+9.9*1.37^8+8.8*1.37^7+7.7*1.37^6+6.6*1.37^5+5.5*1.37^4+4.4*1.37^3+3.3*1.37^2+2.2*1.37^1+1.1))",1.0), - test_t("equal(\t \n(\n \r1.1\t\t - \n\n 2.2\n\n/\r3.3\t),(1.1-2.2/3.3))",1.0), - test_t("equal((pi^2^3),(pi^8))",1.0), - test_t("equal((pi^(2^3)),(pi^8))",1.0), - test_t("equal(pi^2^3-pi^8,0)",1.0), - test_t("equal((2*pi^2^3),2*(pi^8))",1.0), - test_t("equal((pi^2^3*2),2*(pi^8))",1.0), - test_t("equal((pi^2^3/2),(pi^8)/2)",1.0), - test_t("equal((pi^2.2^3.3),(pi^13.4894687605338489))",1.0), - test_t("equal((pi^(2.2^3.3)),(pi^13.4894687605338489))",1.0), - test_t("equal((2.2*pi^2.2^3.3),2.2*(pi^13.4894687605338489))",1.0), - test_t("equal((pi^2.2^3.3*2),2*(pi^13.4894687605338489))",1.0), - test_t("equal((pi^2.2^3.3/2.2),(pi^13.4894687605338489)/2.2)",1.0), - test_t("equal((pi^-2^3),1/(pi^8))",1.0), - test_t("equal((pi^(-2^3)),1/(pi^8))",1.0), - test_t("equal((pi^2^-3),(pi^(1/8)))",1.0), - test_t("equal((pi^(2^-3)),(pi^(1/8)))",1.0), - test_t("equal((pi^-2^-3),1/(pi^(1/8)))",1.0), - test_t("equal((pi^(-2^-3)),1/(pi^(1/8)))",1.0), - test_t("equal((-pi^2^3),(-pi^8))",1.0), - test_t("equal((-pi^(2^3)),(-pi^8))",1.0), - test_t("equal(-pi^2^3--pi^8,0)",1.0), - test_t("equal((2*-pi^2^3),2*(-pi^8))",1.0), - test_t("equal((-pi^2^3*2),2*(-pi^8))",1.0), - test_t("equal((-pi^2^3/2),(-pi^8)/2)",1.0), - test_t("equal((-pi^2.2^3.3),(-pi^13.4894687605338489))",1.0), - test_t("equal((-pi^(2.2^3.3)),(-pi^13.4894687605338489))",1.0), - test_t("equal((2.2*-pi^2.2^3.3),2.2*(-pi^13.4894687605338489))",1.0), - test_t("equal((-pi^2.2^3.3*2),2*(-pi^13.4894687605338489))",1.0), - test_t("equal((-pi^2.2^3.3/2.2),(-pi^13.4894687605338489)/2.2)",1.0), - test_t("equal((-pi^-2^3),1/(-pi^8))",1.0), - test_t("equal((-pi^(-2^3)),1/(-pi^8))",1.0), - test_t("equal((-pi^2^-3),(-pi^(1/8)))",1.0), - test_t("equal((-pi^(2^-3)),(-pi^(1/8)))",1.0), - test_t("equal((-pi^-2^-3),1/(-pi^(1/8)))",1.0), - test_t("equal((-pi^(-2^-3)),1/(-pi^(1/8)))",1.0), - test_t("equal((+pi^+2^+3),(+pi^+8))",1.0), - test_t("equal((+pi^(2^3)),(+pi^+8))",1.0), - test_t("equal(+pi^+2^+3-+pi^+8,0)",1.0), - test_t("equal((+2*+pi^+2^+3),+2*(+pi^+8))",1.0), - test_t("equal((+pi^+2^+3*+2),+2*(+pi^+8))",1.0), - test_t("equal((+pi^+2^+3/+2),(+pi^+8)/+2)",1.0), - test_t("equal((+pi^+2.2^+3.3),(+pi^+13.4894687605338489))",1.0), - test_t("equal((+pi^(+2.2^+3.3)),(+pi^+13.4894687605338489))",1.0), - test_t("equal((+2.2*+pi^+2.2^+3.3),+2.2*(+pi^+13.4894687605338489))",1.0), - test_t("equal((+pi^+2.2^+3.3*+2),+2*(+pi^+13.4894687605338489))",1.0), - test_t("equal((+pi^+2.2^+3.3/+2.2),(+pi^+13.4894687605338489)/+2.2)",1.0), - test_t("equal((+pi^-2^3),1/(+pi^+8))",1.0), - test_t("equal((+pi^(-2^3)),1/(+pi^+8))",1.0), - test_t("equal((+pi^2^-3),(+pi^(+1/+8)))",1.0), - test_t("equal((+pi^(2^-3)),(+pi^(+1/+8)))",1.0), - test_t("equal((+pi^-2^-3),1/(+pi^(+1/+8)))",1.0), - test_t("equal((+pi^(-2^-3)),1/(+pi^(+1/+8)))",1.0), - test_t("equal((-pi^+2^+3),(-pi^+8))",1.0), - test_t("equal((-pi^(2^3)),(-pi^+8))",1.0), - test_t("equal(-pi^+2^+3--pi^+8,0)",1.0), - test_t("equal((+2*-pi^+2^+3),2*(-pi^+8))",1.0), - test_t("equal((-pi^+2^+3*2),2*(-pi^+8))",1.0), - test_t("equal((-pi^+2^+3/+2),(-pi^+8)/+2)",1.0), - test_t("equal((-pi^+2.2^+3.3),(-pi^+13.4894687605338489))",1.0), - test_t("equal((-pi^(2.2^3.3)),(-pi^+13.4894687605338489))",1.0), - test_t("equal((+2.2*-pi^+2.2^+3.3),2.2*(-pi^+13.4894687605338489))",1.0), - test_t("equal((-pi^+2.2^+3.3*2),2*(-pi^+13.4894687605338489))",1.0), - test_t("equal((-pi^+2.2^+3.3/+2.2),(-pi^+13.4894687605338489)/+2.2)",1.0), - test_t("equal((-pi^-2^3),1/(-pi^+8))",1.0), - test_t("equal((-pi^(-2^3)),1/(-pi^+8))",1.0), - test_t("equal((-pi^2^-3),(-pi^(+1/+8)))",1.0), - test_t("equal((-pi^(2^-3)),(-pi^(+1/+8)))",1.0), - test_t("equal((-pi^-2^-3),1/(-pi^(+1/+8)))",1.0), - test_t("equal((-pi^(-2^-3)),1/(-pi^(+1/+8)))",1.0), - test_t("switch { case (1 <= 2) : 1; default: 1.12345; }",1.0), - test_t("switch { case (1 > 2) : 0; case (1 <= 2) : 1; default: 1.12345; }",1.0), - test_t("switch { case (1 <= 2) : switch { case (1 <= 2) : 1; default: 1.12345; }; default: 1.12345; }",1.0), - test_t("switch { case [1 <= 2] : 1; default: 1.12345; }",1.0), - test_t("switch { case [1 > 2] : 0; case [1 <= 2] : 1; default: 1.12345; }",1.0), - test_t("switch { case [1 <= 2] : switch { case [1 <= 2] : 1; default: 1.12345; }; default: 1.12345; }",1.0), - test_t("switch { case {1 <= 2} : 1; default: 1.12345; }",1.0), - test_t("switch { case {1 > 2} : 0; case {1 <= 2} : 1; default: 1.12345; }",1.0), - test_t("switch { case {1 <= 2} : switch { case {1 <= 2} : 1; default: 1.12345; }; default: 1.12345; }",1.0), - test_t("switch { case [(1 <= 2)] : {1}; default: 1.12345; }",1.0), - test_t("switch { case ([1 > 2]) : [0]; case ([1 <= 2]) : 1; default: 1.12345; }",1.0), - test_t("switch { case {(1 <= 2)} : switch { case ({1 <= 2}) : 1; default: 1.12345; }; default: 1.12345; }",1.0), - test_t("switch { case 1 > 1 : 1; case 2 > 2 : 2; case 3 = 3 : 3; case 4 > 4 : 4; default : 5; }",3.0), - test_t("repeat 1.1 + 2.2 until (1 < 2)",3.3), - test_t("repeat (1.1 + 2.2) until (1 < 2)",3.3), - test_t("repeat 1.1 + 2.2; until (1 < 2)",3.3), - test_t("repeat (1.1 + 2.2); until (1 < 2)",3.3), - test_t("repeat 1.1234; 1 < 2; 1.1 + 2.2 until (1 < 2)",3.3), - test_t("repeat 1.1234; 1 < 2; (1.1 + 2.2) until (1 < 2)",3.3), - test_t("repeat 1.1234; 1 < 2; 1.1 + 2.2; until (1 < 2)",3.3), - test_t("repeat 1.1234; 1 < 2; (1.1 + 2.2); until (1 < 2)",3.3), - test_t("[*] { case 1 < 2 : 1 / 2; case (1 < 3) : 2 / 2; case 1 < 4 : 3 / 2; case (1 < 5) : 4 / 2; }",2.0), - test_t(" 0 ? 1 : 2",2.0), - test_t(" 1 ? 3 : 4",3.0), - test_t("(0 ? 1 : 2) == 2",1.0), - test_t("(1 ? 3 : 4) == 3",1.0), - test_t("[(0)] ? [(1)] : [(2)]",2.0), - test_t("([(0)] ? [(1)] : [(2)]) == 2",1.0), - test_t("([(1)] ? [(3)] : [(4)]) == 3",1.0), - test_t("(1 < 2 ? 3 : 4) == 3",1.0), - test_t("(1 > 2 ? 3 : 4) == 4",1.0), - test_t("(1 < 2 ? 3 + 5 : 4) == 8",1.0), - test_t("(1 > 2 ? 3 : 4 + 5) == 9",1.0), - test_t("(2 < 3 + 3 ? 7 : 9) == 7",1.0), - test_t("(1 + 1 < 3 ? 7 : 9) == 7",1.0), - test_t("(1 + 1 < 3 + 3 ? 7 : 9) == 7",1.0), - test_t("(2 > 3 + 3 ? 7 : 9) == 9",1.0), - test_t("(1 + 1 > 3 ? 7 : 9) == 9",1.0), - test_t("(1 + 1 > 3 + 3 ? 7 : 9) == 9",1.0), - test_t("(2 < (3 + 3) ? 7 : 9) == 7",1.0), - test_t("((1 + 1) < 3 ? 7 : 9) == 7",1.0), - test_t("((1 + 1) < (3 + 3) ? 7 : 9) == 7",1.0), - test_t("(min(1,2) ? 1 + 3 : 1 + 4) == 4",1.0), - test_t("(min(0,1) ? 1 + 3 : 1 + 4) == 5",1.0), - test_t("if(1 < 2) 3; == 3",1.0), - test_t("if(1 > 2) 3; == null",1.0), - test_t("if(1 < 2) 3; else 4; == 3",1.0), - test_t("if(1 > 2) 3; else 4; == 4",1.0), - test_t("if(1 < 2) 3; else {1+2; 4;} == 3",1.0), - test_t("if(1 > 2) 3; else {1+2; 4;} == 4",1.0), - test_t("if(1 < 2) 3; else if (1 < 2) 4; == 3",1.0), - test_t("if(1 > 2) 3; else if (1 < 2) 4; == 4",1.0), - test_t("if(1 > 2) 3; else if (1 > 2) 4; == null",1.0), - test_t("if(1 < 2) 3; else if (1 < 2) {1+2; 4;} == 3",1.0), - test_t("if(1 > 2) 3; else if (1 < 2) {1+2; 4;} == 4",1.0), - test_t("if(1 > 2) 3; else if (1 > 2) {1+2; 4;} == null",1.0), - test_t("if(1 < 2) { 1+2; 3;} == 3",1.0), - test_t("if(1 > 2) { 1+2; 3;} == null",1.0), - test_t("if(1 < 2) { 1+2; 3;} else 4; == 3",1.0), - test_t("if(1 > 2) { 1+2; 3;} else 4; == 4",1.0), - test_t("if(1 < 2) { 1+2; 3;} else {1+2; 4;} == 3",1.0), - test_t("if(1 > 2) { 1+2; 3;} else {1+2; 4;} == 4",1.0), - test_t("if(1 < 2) { 1+2; 3;} else if (1 < 2) 4; == 3",1.0), - test_t("if(1 > 2) { 1+2; 3;} else if (1 < 2) 4; == 4",1.0), - test_t("if(1 > 2) { 1+2; 3;} else if (1 > 2) 4; == null",1.0), - test_t("if(1 < 2) { 1+2; 3;} else if (1 < 2) {1+2; 4;} == 3",1.0), - test_t("if(1 > 2) { 1+2; 3;} else if (1 < 2) {1+2; 4;} == 4",1.0), - test_t("if(1 > 2) { 1+2; 3;} else if (1 > 2) {1+2; 4;} == null",1.0) + // Note: Each of following tests must compile down + // to a single literal node. + test_t("0",0.0), + test_t("1",1.0), + test_t("2",2.0), + test_t("3",3.0), + test_t("4",4.0), + test_t("5",5.0), + test_t("6",6.0), + test_t("7",7.0), + test_t("8",8.0), + test_t("9",9.0), + test_t("12.12",12.12), + test_t("123.123",123.123), + test_t("1234.1234",1234.1234), + test_t("12345.12345",12345.12345), + test_t("123456.123456",123456.123456), + test_t("0.0",0.0), + test_t("1.0",1.0), + test_t("2.0",2.0), + test_t("3.0",3.0), + test_t("4.0",4.0), + test_t("5.0",5.0), + test_t("6.0",6.0), + test_t("7.0",7.0), + test_t("8.0",8.0), + test_t("9.0",9.0), + test_t("0.0",0.0), + test_t("1.1",1.1), + test_t("2.2",2.2), + test_t("3.3",3.3), + test_t("4.4",4.4), + test_t("5.5",5.5), + test_t("6.6",6.6), + test_t("7.7",7.7), + test_t("8.8",8.8), + test_t("9.9",9.9), + test_t("+0",0.0), + test_t("+1",1.0), + test_t("+2",2.0), + test_t("+3",3.0), + test_t("+4",4.0), + test_t("+5",5.0), + test_t("+6",6.0), + test_t("+7",7.0), + test_t("+8",8.0), + test_t("+9",9.0), + test_t("+0.0",0.0), + test_t("+1.0",1.0), + test_t("+2.0",2.0), + test_t("+3.0",3.0), + test_t("+4.0",4.0), + test_t("+5.0",5.0), + test_t("+6.0",6.0), + test_t("+7.0",7.0), + test_t("+8.0",8.0), + test_t("+9.0",9.0), + test_t("+0.0",0.0), + test_t("+1.1",1.1), + test_t("+2.2",2.2), + test_t("+3.3",3.3), + test_t("+4.4",4.4), + test_t("+5.5",5.5), + test_t("+6.6",6.6), + test_t("+7.7",7.7), + test_t("+8.8",8.8), + test_t("+9.9",9.9), + test_t("-0",-0.0), + test_t("-1",-1.0), + test_t("-2",-2.0), + test_t("-3",-3.0), + test_t("-4",-4.0), + test_t("-5",-5.0), + test_t("-6",-6.0), + test_t("-7",-7.0), + test_t("-8",-8.0), + test_t("-9",-9.0), + test_t("-0.0",-0.0), + test_t("-1.0",-1.0), + test_t("-2.0",-2.0), + test_t("-3.0",-3.0), + test_t("-4.0",-4.0), + test_t("-5.0",-5.0), + test_t("-6.0",-6.0), + test_t("-7.0",-7.0), + test_t("-8.0",-8.0), + test_t("-9.0",-9.0), + test_t("-0.0",-0.0), + test_t("-1.1",-1.1), + test_t("-2.2",-2.2), + test_t("-3.3",-3.3), + test_t("-4.4",-4.4), + test_t("-5.5",-5.5), + test_t("-6.6",-6.6), + test_t("-7.7",-7.7), + test_t("-8.8",-8.8), + test_t("-9.9",-9.9), + test_t("0.0e+0" ,+0.0e+0), + test_t("1.1e+1" ,+1.1e+1), + test_t("2.2e+2" ,+2.2e+2), + test_t("3.3e+3" ,+3.3e+3), + test_t("4.4e+4" ,+4.4e+4), + test_t("5.5e+5" ,+5.5e+5), + test_t("6.6e+6" ,+6.6e+6), + test_t("7.7e+7" ,+7.7e+7), + test_t("8.8e+8" ,+8.8e+8), + test_t("9.9e+9" ,+9.9e+9), + test_t("-0.0e+0",-0.0e+0), + test_t("-1.1e+1",-1.1e+1), + test_t("-2.2e+2",-2.2e+2), + test_t("-3.3e+3",-3.3e+3), + test_t("-4.4e+4",-4.4e+4), + test_t("-5.5e+5",-5.5e+5), + test_t("-6.6e+6",-6.6e+6), + test_t("-7.7e+7",-7.7e+7), + test_t("-8.8e+8",-8.8e+8), + test_t("-9.9e+9",-9.9e+9), + test_t("0.0E+0" ,+0.0E+0), + test_t("1.1E+1" ,+1.1E+1), + test_t("2.2E+2" ,+2.2E+2), + test_t("3.3E+3" ,+3.3E+3), + test_t("4.4E+4" ,+4.4E+4), + test_t("5.5E+5" ,+5.5E+5), + test_t("6.6E+6" ,+6.6E+6), + test_t("7.7E+7" ,+7.7E+7), + test_t("8.8E+8" ,+8.8E+8), + test_t("9.9E+9" ,+9.9E+9), + test_t("-0.0E+0",-0.0E+0), + test_t("-1.1E+1",-1.1E+1), + test_t("-2.2E+2",-2.2E+2), + test_t("-3.3E+3",-3.3E+3), + test_t("-4.4E+4",-4.4E+4), + test_t("-5.5E+5",-5.5E+5), + test_t("-6.6E+6",-6.6E+6), + test_t("-7.7E+7",-7.7E+7), + test_t("-8.8E+8",-8.8E+8), + test_t("-9.9E+9",-9.9E+9), + test_t("(0)",0.0), + test_t("(1)",1.0), + test_t("(2)",2.0), + test_t("(3)",3.0), + test_t("(4)",4.0), + test_t("(5)",5.0), + test_t("(6)",6.0), + test_t("(7)",7.0), + test_t("(8)",8.0), + test_t("(9)",9.0), + test_t("(0.0)",0.0), + test_t("(1.0)",1.0), + test_t("(2.0)",2.0), + test_t("(3.0)",3.0), + test_t("(4.0)",4.0), + test_t("(5.0)",5.0), + test_t("(6.0)",6.0), + test_t("(7.0)",7.0), + test_t("(8.0)",8.0), + test_t("(9.0)",9.0), + test_t("(0.0)",0.0), + test_t("(1.1)",1.1), + test_t("(2.2)",2.2), + test_t("(3.3)",3.3), + test_t("(4.4)",4.4), + test_t("(5.5)",5.5), + test_t("(6.6)",6.6), + test_t("(7.7)",7.7), + test_t("(8.8)",8.8), + test_t("(9.9)",9.9), + test_t("(+0)" ,0.0), + test_t("(+1)" ,1.0), + test_t("(+2)" ,2.0), + test_t("(+3)" ,3.0), + test_t("(+4)" ,4.0), + test_t("(+5)" ,5.0), + test_t("(+6)" ,6.0), + test_t("(+7)" ,7.0), + test_t("(+8)" ,8.0), + test_t("(+9)" ,9.0), + test_t("(+0.0)",0.0), + test_t("(+1.0)",1.0), + test_t("(+2.0)",2.0), + test_t("(+3.0)",3.0), + test_t("(+4.0)",4.0), + test_t("(+5.0)",5.0), + test_t("(+6.0)",6.0), + test_t("(+7.0)",7.0), + test_t("(+8.0)",8.0), + test_t("(+9.0)",9.0), + test_t("(+0.0)",0.0), + test_t("(+1.1)",1.1), + test_t("(+2.2)",2.2), + test_t("(+3.3)",3.3), + test_t("(+4.4)",4.4), + test_t("(+5.5)",5.5), + test_t("(+6.6)",6.6), + test_t("(+7.7)",7.7), + test_t("(+8.8)",8.8), + test_t("(+9.9)",9.9), + test_t("(-0)" ,-0.0), + test_t("(-1)" ,-1.0), + test_t("(-2)" ,-2.0), + test_t("(-3)" ,-3.0), + test_t("(-4)" ,-4.0), + test_t("(-5)" ,-5.0), + test_t("(-6)" ,-6.0), + test_t("(-7)" ,-7.0), + test_t("(-8)" ,-8.0), + test_t("(-9)" ,-9.0), + test_t("(-0.0)",-0.0), + test_t("(-1.0)",-1.0), + test_t("(-2.0)",-2.0), + test_t("(-3.0)",-3.0), + test_t("(-4.0)",-4.0), + test_t("(-5.0)",-5.0), + test_t("(-6.0)",-6.0), + test_t("(-7.0)",-7.0), + test_t("(-8.0)",-8.0), + test_t("(-9.0)",-9.0), + test_t("(-0.0)",-0.0), + test_t("(-1.1)",-1.1), + test_t("(-2.2)",-2.2), + test_t("(-3.3)",-3.3), + test_t("(-4.4)",-4.4), + test_t("(-5.5)",-5.5), + test_t("(-6.6)",-6.6), + test_t("(-7.7)",-7.7), + test_t("(-8.8)",-8.8), + test_t("(-9.9)",-9.9), + test_t("-(1.1)",-1.1), + test_t("-(1.1+2.2)",-3.3), + test_t("1234567890",1234567890), + test_t("123456789.0",123456789.0), + test_t("+1234567890",1234567890), + test_t("+123456789.0",123456789.0), + test_t("-1234567890",-1234567890), + test_t("-123456789.0",-123456789.0), + test_t("1234.567890",1234.567890), + test_t("-1234.567890",-1234.567890), + test_t("0+9",9.0), + test_t("1+8",9.0), + test_t("2+7",9.0), + test_t("3+6",9.0), + test_t("4+5",9.0), + test_t("5+4",9.0), + test_t("6+3",9.0), + test_t("7+2",9.0), + test_t("8+1",9.0), + test_t("9+0",9.0), + test_t(" 0 + 9 ",9.0), + test_t(" 1 + 8 ",9.0), + test_t(" 2 + 7 ",9.0), + test_t(" 3 + 6 ",9.0), + test_t(" 4 + 5 ",9.0), + test_t(" 5 + 4 ",9.0), + test_t(" 6 + 3 ",9.0), + test_t(" 7 + 2 ",9.0), + test_t(" 8 + 1 ",9.0), + test_t(" 9 + 0 ",9.0), + test_t("( 0 + 9 )",9.0), + test_t("( 1 + 8 )",9.0), + test_t("( 2 + 7 )",9.0), + test_t("( 3 + 6 )",9.0), + test_t("( 4 + 5 )",9.0), + test_t("( 5 + 4 )",9.0), + test_t("( 6 + 3 )",9.0), + test_t("( 7 + 2 )",9.0), + test_t("( 8 + 1 )",9.0), + test_t("( 9 + 0 )",9.0), + test_t("1+2",+3.0), + test_t("1-2",-1.0), + test_t("1*2",+2.0), + test_t("1/2",+0.5), + test_t("1.1+2.2", +3.3), + test_t("1.1-2.2", -1.1), + test_t("1.1*2.2",+2.42), + test_t("1.1/2.2", +0.5), + test_t("0-9",-9.0), + test_t("1-8",-7.0), + test_t("2-7",-5.0), + test_t("3-6",-3.0), + test_t("4-5",-1.0), + test_t("5-4",+1.0), + test_t("6-3",+3.0), + test_t("7-2",+5.0), + test_t("8-1",+7.0), + test_t("9-0",+9.0), + test_t(" 0 - 9 ",-9.0), + test_t(" 1 - 8 ",-7.0), + test_t(" 2 - 7 ",-5.0), + test_t(" 3 - 6 ",-3.0), + test_t(" 4 - 5 ",-1.0), + test_t(" 5 - 4 ",+1.0), + test_t(" 6 - 3 ",+3.0), + test_t(" 7 - 2 ",+5.0), + test_t(" 8 - 1 ",+7.0), + test_t(" 9 - 0 ",+9.0), + test_t("( 0 - 9 )",-9.0), + test_t("( 1 - 8 )",-7.0), + test_t("( 2 - 7 )",-5.0), + test_t("( 3 - 6 )",-3.0), + test_t("( 4 - 5 )",-1.0), + test_t("( 5 - 4 )",+1.0), + test_t("( 6 - 3 )",+3.0), + test_t("( 7 - 2 )",+5.0), + test_t("( 8 - 1 )",+7.0), + test_t("( 9 - 0 )",+9.0), + test_t("-(1+2)",-3.0), + test_t("+(1+2)",+3.0), + test_t("+(1-2)",-1.0), + test_t("-(1-2)",+1.0), + test_t("(-3*-6)",+18.0), + test_t("(-6*-3)",+18.0), + test_t("-(-3*-6)",-18.0), + test_t("-(-6*-3)",-18.0), + test_t("1.1+2.2+3.3",+6.6), + test_t("+1.1+2.2+3.3",+6.6), + test_t("-1.1-2.2-3.3",-6.6), + test_t("1.1*2.2*3.3",+7.986), + test_t("+1.1*2.2*3.3",+7.986), + test_t("-1.1*-2.2*-3.3",-7.986), + test_t("1 + 1/2",+1.5), + test_t("1 + (1/2)",+1.5), + test_t("1.1 + 1.1/2.2",+1.6), + test_t("1.1 + (1.1/2.2)",+1.6), + test_t("2 * 1/2",+1.0), + test_t("2 * (1/2)",+1.0), + test_t("2.2 * 1.1/2.2",+1.1), + test_t("2.2 * (1.1/2.2)",+1.1), + test_t("1^2",1.0), + test_t("2^1",2.0), + test_t("2^3",8.0), + test_t("-2^3",-8.0), + test_t("-2^4",-16.0), + test_t("(-2)^3",-8.0), + test_t("(-2)^4",+16.0), + test_t("3^2^4",43046721.0), + test_t("1.1^2.2",1.23328630055466251099), + test_t("2.2^1.1",2.3804822576003541627), + test_t("2.2^3.3",13.48946876053338489127), + test_t("3.3^2.2^1.1",17.15193942371376191362), + test_t("+3.3^2.2^1.1",17.15193942371376191362), + test_t("3.3^+2.2^1.1",17.15193942371376191362), + test_t("3.3^2.2^+1.1",17.15193942371376191362), + test_t("3.3^2.2^-1.1",1.65127293793867959137), + test_t("+3.3^+2.2^-1.1",1.65127293793867959137), + test_t("1.1^(1.1 * 2.2)",1.25941916576299080582), + test_t("2.2^(1.1 * 3.3)",17.49823848953534759743), + test_t("3.3^(1.1 * 2.2)",17.98058156638874965269), + test_t("1.1^-2.2/1.1",0.73712884727743375853), + test_t("1.1^+2.2/1.1",1.121169364140602282717273261774), + test_t("1.1^2.2/+1.1",1.121169364140602282717273261774), + test_t("1.1^+2.2/+1.1",1.121169364140602282717273261774), + test_t("1.1^+2.2/-1.1",-1.121169364140602282717273261774), + test_t("1.1^2.2/-1.1",-1.121169364140602282717273261774), + test_t("1.1^+2.2/-1.1",-1.121169364140602282717273261774), + test_t("+1.1^-2.2/1.1",0.73712884727743375853), + test_t("+1.1^+2.2/1.1",1.121169364140602282717273261774), + test_t("+1.1^2.2/+1.1",1.121169364140602282717273261774), + test_t("+1.1^+2.2/+1.1",1.121169364140602282717273261774), + test_t("+1.1^+2.2/-1.1",-1.121169364140602282717273261774), + test_t("+1.1^2.2/-1.1",-1.121169364140602282717273261774), + test_t("+1.1^+2.2/-1.1",-1.121169364140602282717273261774), + test_t("equal(1.23^3,(1.23 * 1.23 * 1.23))",1.0), + test_t("equal(1.23^-3,1/(1.23 * 1.23 * 1.23))",1.0), + test_t("equal((2.1 + 1.23^3),(2.1 + [1.23 * 1.23 * 1.23]))",1.0), + test_t("equal((2.1 - 1.23^3),(2.1 - [1.23 * 1.23 * 1.23]))",1.0), + test_t("equal((2.1 * 1.23^3),(2.1 * [1.23 * 1.23 * 1.23]))",1.0), + test_t("equal((2.1 / 1.23^3),(2.1 / [1.23 * 1.23 * 1.23]))",1.0), + test_t("equal((1.23^3 + 2.1),({1.23 * 1.23 * 1.23} + 2.1))",1.0), + test_t("equal((1.23^3 - 2.1),({1.23 * 1.23 * 1.23} - 2.1))",1.0), + test_t("equal((1.23^3 * 2.1),({1.23 * 1.23 * 1.23} * 2.1))",1.0), + test_t("equal((1.23^3 / 2.1),({1.23 * 1.23 * 1.23} / 2.1))",1.0), + test_t("equal(1.0^(1.0/2.0),sqrt(1.0))",1.0), + test_t("equal(1.0^(1.0/2.0),root(1.0,2.0))",1.0), + test_t("equal(1.0^(1.0/3.0),root(1.0,3.0))",1.0), + test_t("equal(1.0^(1.0/4.0),root(1.0,4.0))",1.0), + test_t("equal(1.0^(1.0/5.0),root(1.0,5.0))",1.0), + test_t("equal(1.0^(1.0/6.0),root(1.0,6.0))",1.0), + test_t("equal(1.0^(1.0/7.0),root(1.0,7.0))",1.0), + test_t("equal(1.0^(1.0/8.0),root(1.0,8.0))",1.0), + test_t("equal(1.0^(1.0/9.0),root(1.0,9.0))",1.0), + test_t("equal(2.0^(1.0/2.0),sqrt(2.0))",1.0), + test_t("equal(2.0^(1.0/2.0),root(2.0,2.0))",1.0), + test_t("equal(3.0^(1.0/3.0),root(3.0,3.0))",1.0), + test_t("equal(4.0^(1.0/4.0),root(4.0,4.0))",1.0), + test_t("equal(5.0^(1.0/5.0),root(5.0,5.0))",1.0), + test_t("equal(6.0^(1.0/6.0),root(6.0,6.0))",1.0), + test_t("equal(7.0^(1.0/7.0),root(7.0,7.0))",1.0), + test_t("equal(8.0^(1.0/8.0),root(8.0,8.0))",1.0), + test_t("equal(9.0^(1.0/9.0),root(9.0,9.0))",1.0), + test_t("1 < 2", 1.0), + test_t("1 <= 2", 1.0), + test_t("1.1 <= 2.2", 1.0), + test_t("(1.0 + 0.1) <= (2.0 + 0.2)", 1.0), + test_t("1 > 2", 0.0), + test_t("1 >= 2", 0.0), + test_t("1.1 >= 2.2", 0.0), + test_t("(1.0 + 0.1) >= (2.0 + 0.2)", 0.0), + test_t("1 <> 2", 1.0), + test_t("1 != 2", 1.0), + test_t("1.1 <> 2.2", 1.0), + test_t("1.1 != 2.2", 1.0), + test_t("(1.0 + 0.1) <> (2.0 + 0.2)", 1.0), + test_t("(1.0 + 0.1) != (2.0 + 0.2)", 1.0), + test_t("1 == 1", 1.0), + test_t("1.1 == 1.1", 1.0), + test_t("1 = 1", 1.0), + test_t("1.1 = 1.1", 1.0), + test_t("1 <> 1", 0.0), + test_t("1 != 1", 0.0), + test_t("1.1 <> 1.1", 0.0), + test_t("1.1 != 1.1", 0.0), + test_t("(1.0 + 0.1) <> (1.0 + 0.1)", 0.0), + test_t("(1.0 + 0.1) != (1.0 + 0.1)", 0.0), + test_t("equal(1.1,1.1)",1.0), + test_t("equal(1.1,2.2)",0.0), + test_t("not_equal(1.1,1.1)",0.0), + test_t("not_equal(1.1,2.2)",1.0), + test_t("1 and 1",1.0), + test_t("1 and 0",0.0), + test_t("0 and 1",0.0), + test_t("0 and 0",0.0), + test_t("1.0 and 1.0",1.0), + test_t("1.0 and 0.0",0.0), + test_t("0.0 and 1.0",0.0), + test_t("0.0 and 0.0",0.0), + test_t("(1 and 1)",1.0), + test_t("(1 and 0)",0.0), + test_t("(0 and 1)",0.0), + test_t("(0 and 0)",0.0), + test_t("(1.0 and 1.0)",1.0), + test_t("(1.0 and 0.0)",0.0), + test_t("(0.0 and 1.0)",0.0), + test_t("(0.0 and 0.0)",0.0), + test_t("1 or 1",1.0), + test_t("1 or 0",1.0), + test_t("0 or 1",1.0), + test_t("0 or 0",0.0), + test_t("1.0 or 1.0",1.0), + test_t("1.0 or 0.0",1.0), + test_t("0.0 or 1.0",1.0), + test_t("0.0 or 0.0",0.0), + test_t("(1 or 1)",1.0), + test_t("(1 or 0)",1.0), + test_t("(0 or 1)",1.0), + test_t("(0 or 0)",0.0), + test_t("(1.0 or 1.0)",1.0), + test_t("(1.0 or 0.0)",1.0), + test_t("(0.0 or 1.0)",1.0), + test_t("(0.0 or 0.0)",0.0), + test_t("1 nand 1",0.0), + test_t("1 nand 0",1.0), + test_t("0 nand 1",1.0), + test_t("0 nand 0",1.0), + test_t("1.0 nand 1.0",0.0), + test_t("1.0 nand 0.0",1.0), + test_t("0.0 nand 1.0",1.0), + test_t("0.0 nand 0.0",1.0), + test_t("(1 nand 1)",0.0), + test_t("(1 nand 0)",1.0), + test_t("(0 nand 1)",1.0), + test_t("(0 nand 0)",1.0), + test_t("(1.0 nand 1.0)",0.0), + test_t("(1.0 nand 0.0)",1.0), + test_t("(0.0 nand 1.0)",1.0), + test_t("(0.0 nand 0.0)",1.0), + test_t("1 nor 1",0.0), + test_t("1 nor 0",0.0), + test_t("0 nor 1",0.0), + test_t("0 nor 0",1.0), + test_t("1.0 nor 1.0",0.0), + test_t("1.0 nor 0.0",0.0), + test_t("0.0 nor 1.0",0.0), + test_t("0.0 nor 0.0",1.0), + test_t("(1 nor 1)",0.0), + test_t("(1 nor 0)",0.0), + test_t("(0 nor 1)",0.0), + test_t("(0 nor 0)",1.0), + test_t("(1.0 nor 1.0)",0.0), + test_t("(1.0 nor 0.0)",0.0), + test_t("(0.0 nor 1.0)",0.0), + test_t("(0.0 nor 0.0)",1.0), + test_t("0 xor 0",0.0), + test_t("0 xor 1",1.0), + test_t("1 xor 0",1.0), + test_t("1 xor 1",0.0), + test_t("0.0 xor 0.0",0.0), + test_t("0.0 xor 1.0",1.0), + test_t("1.0 xor 0.0",1.0), + test_t("1.0 xor 1.0",0.0), + test_t("(0 xor 0)",0.0), + test_t("(0 xor 1)",1.0), + test_t("(1 xor 0)",1.0), + test_t("(1 xor 1)",0.0), + test_t("(0.0 xor 0.0)",0.0), + test_t("(0.0 xor 1.0)",1.0), + test_t("(1.0 xor 0.0)",1.0), + test_t("(1.0 xor 1.0)",0.0), + test_t("1 & 1",1.0), + test_t("1 & 0",0.0), + test_t("0 & 1",0.0), + test_t("0 & 0",0.0), + test_t("1.0 & 1.0",1.0), + test_t("1.0 & 0.0",0.0), + test_t("0.0 & 1.0",0.0), + test_t("0.0 & 0.0",0.0), + test_t("(1 & 1)",1.0), + test_t("(1 & 0)",0.0), + test_t("(0 & 1)",0.0), + test_t("(0 & 0)",0.0), + test_t("(1.0 & 1.0)",1.0), + test_t("(1.0 & 0.0)",0.0), + test_t("(0.0 & 1.0)",0.0), + test_t("(0.0 & 0.0)",0.0), + test_t("1 | 1",1.0), + test_t("1 | 0",1.0), + test_t("0 | 1",1.0), + test_t("0 | 0",0.0), + test_t("1.0 | 1.0",1.0), + test_t("1.0 | 0.0",1.0), + test_t("0.0 | 1.0",1.0), + test_t("0.0 | 0.0",0.0), + test_t("(1 | 1)",1.0), + test_t("(1 | 0)",1.0), + test_t("(0 | 1)",1.0), + test_t("(0 | 0)",0.0), + test_t("(1.0 | 1.0)",1.0), + test_t("(1.0 | 0.0)",1.0), + test_t("(0.0 | 1.0)",1.0), + test_t("(0.0 | 0.0)",0.0), + test_t("(1 nand 1) == not(1 and 1)",1.0), + test_t("(1 nand 0) == not(1 and 0)",1.0), + test_t("(0 nand 1) == not(0 and 1)",1.0), + test_t("(0 nand 0) == not(0 and 0)",1.0), + test_t("(1 nor 1) == not(1 or 1)",1.0), + test_t("(1 nor 0) == not(1 or 0)",1.0), + test_t("(0 nor 1) == not(0 or 1)",1.0), + test_t("(0 nor 0) == not(0 or 0)",1.0), + test_t("(1.0 nand 1.0) == not(1.0 and 1.0)",1.0), + test_t("(1.0 nand 0.0) == not(1.0 and 0.0)",1.0), + test_t("(0.0 nand 1.0) == not(0.0 and 1.0)",1.0), + test_t("(0.0 nand 0.0) == not(0.0 and 0.0)",1.0), + test_t("(1.0 nor 1.0) == not(1.0 or 1.0)",1.0), + test_t("(1.0 nor 0.0) == not(1.0 or 0.0)",1.0), + test_t("(0.0 nor 1.0) == not(0.0 or 1.0)",1.0), + test_t("(0.0 nor 0.0) == not(0.0 or 0.0)",1.0), + test_t("(1 nand 1) == not(1 & 1)",1.0), + test_t("(1 nand 0) == not(1 & 0)",1.0), + test_t("(0 nand 1) == not(0 & 1)",1.0), + test_t("(0 nand 0) == not(0 & 0)",1.0), + test_t("(1 nor 1) == not(1 | 1)",1.0), + test_t("(1 nor 0) == not(1 | 0)",1.0), + test_t("(0 nor 1) == not(0 | 1)",1.0), + test_t("(0 nor 0) == not(0 | 0)",1.0), + test_t("(1.0 nand 1.0) == not(1.0 & 1.0)",1.0), + test_t("(1.0 nand 0.0) == not(1.0 & 0.0)",1.0), + test_t("(0.0 nand 1.0) == not(0.0 & 1.0)",1.0), + test_t("(0.0 nand 0.0) == not(0.0 & 0.0)",1.0), + test_t("(1.0 nor 1.0) == not(1.0 | 1.0)",1.0), + test_t("(1.0 nor 0.0) == not(1.0 | 0.0)",1.0), + test_t("(0.0 nor 1.0) == not(0.0 | 1.0)",1.0), + test_t("(0.0 nor 0.0) == not(0.0 | 0.0)",1.0), + test_t("mand(1,1)",1.0), + test_t("mand(1,0)",0.0), + test_t("mand(0,1)",0.0), + test_t("mand(0,0)",0.0), + test_t("mand(1.0,1.0)",1.0), + test_t("mand(1.0,0.0)",0.0), + test_t("mand(0.0,1.0)",0.0), + test_t("mand(0.0,0.0)",0.0), + test_t("mor(1,1)",1.0), + test_t("mor(1,0)",1.0), + test_t("mor(0,1)",1.0), + test_t("mor(0,0)",0.0), + test_t("mor(1.0,1.0)",1.0), + test_t("mor(1.0,0.0)",1.0), + test_t("mor(0.0,1.0)",1.0), + test_t("mor(0.0,0.0)",0.0), + test_t("(1 nand 1) == not(mand(1,1))",1.0), + test_t("(1 nand 0) == not(mand(1,0))",1.0), + test_t("(0 nand 1) == not(mand(0,1))",1.0), + test_t("(0 nand 0) == not(mand(0,0))",1.0), + test_t("(1 nor 1) == not(mor(1,1))",1.0), + test_t("(1 nor 0) == not(mor(1,0))",1.0), + test_t("(0 nor 1) == not(mor(0,1))",1.0), + test_t("(0 nor 0) == not(mor(0,0))",1.0), + test_t("(1.0 nand 1.0) == not(mand(1.0,1.0))",1.0), + test_t("(1.0 nand 0.0) == not(mand(1.0,0.0))",1.0), + test_t("(0.0 nand 1.0) == not(mand(0.0,1.0))",1.0), + test_t("(0.0 nand 0.0) == not(mand(0.0,0.0))",1.0), + test_t("(1.0 nor 1.0) == not(mor(1.0,1.0))",1.0), + test_t("(1.0 nor 0.0) == not(mor(1.0,0.0))",1.0), + test_t("(0.0 nor 1.0) == not(mor(0.0,1.0))",1.0), + test_t("(0.0 nor 0.0) == not(mor(0.0,0.0))",1.0), + test_t("abs(1)",1.0), + test_t("abs(-1)",1.0), + test_t("abs(1.0)",1.0), + test_t("abs(-1.0)",1.0), + test_t("min(1,2)",1.0), + test_t("min(1,2,3)",1.0), + test_t("min(1,2,3,4)",1.0), + test_t("min(1,2,3,4,5)",1.0), + test_t("min(1,2,3,4,5,6)",1.0), + test_t("min(1.1,2.2)",1.1), + test_t("min(1.1,2.2,3.3)",1.1), + test_t("min(1.1,2.2,3.3,4.4)",1.1), + test_t("min(1.1,2.2,3.3,4.4,5.5)",1.1), + test_t("min(1.1,2.2,3.3,4.4,5.5,6.6)",1.1), + test_t("min(min(1,2),min(3,4))",1.0), + test_t("max(1,2)",2.0), + test_t("max(1,2,3)",3.0), + test_t("max(1,2,3,4)",4.0), + test_t("max(1,2,3,4,5)",5.0), + test_t("max(1,2,3,4,5,6)",6.0), + test_t("max(1.1,2.2)",2.2), + test_t("max(1.1,2.2,3.3)",3.3), + test_t("max(1.1,2.2,3.3,4.4)",4.4), + test_t("max(1.1,2.2,3.3,4.4,5.5)",5.5), + test_t("max(1.1,2.2,3.3,4.4,5.5,6.6)",6.6), + test_t("max(max(1,2),max(3,4))",4.0), + test_t("avg(1,2)",1.5), + test_t("avg(1,2,3)",2.0), + test_t("avg(1,2,3,4)",2.5), + test_t("avg(1,2,3,4,5)",3.0), + test_t("avg(1.1,2.2)",1.65), + test_t("avg(1.1,2.2,3.3)",2.2), + test_t("avg(1.1,2.2,3.3,4.4)",2.75), + test_t("avg(1.1,2.2,3.3,4.4,5.5)",3.3), + test_t("avg(1.1,2.2,3.3,4.4,5.5,6.6)",3.85), + test_t("sum(1,2)",3.0), + test_t("sum(1,2,3)",6.0), + test_t("sum(1,2,3,4)",10), + test_t("sum(1,2,3,4,5)",15.0), + test_t("sum(1,2,3,4,5,6)",21), + test_t("sum(1.1,2.2)",3.3), + test_t("sum(1.1,2.2,3.3)",6.6), + test_t("sum(1.1,2.2,3.3,4.4)",11.0), + test_t("sum(1.1,2.2,3.3,4.4,5.5)",16.5), + test_t("sum(1.1,2.2,3.3,4.4,5.5,6.6)",23.1), + test_t("mul(1,2)",2.0), + test_t("mul(1,2,3)",6.0), + test_t("mul(1,2,3,4)",24.0), + test_t("mul(1,2,3,4,5)",120.0), + test_t("mul(1,2,3,4,5,6)",720.0), + test_t("mul(1.1,2.2)",2.42), + test_t("mul(1.1,2.2,3.3)",7.986), + test_t("mul(1.1,2.2,3.3,4.4)",35.1384), + test_t("mul(1.1,2.2,3.3,4.4,5.5)",193.2612), + test_t("mul(1.1,2.2,3.3,4.4,5.5,6.6)",1275.52392), + test_t("equal(sum(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),(1.1+2.2+3.3+4.4+5.5+6.6+7.7+8.8+9.9))",1.0), + test_t("equal(mul(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),(1.1*2.2*3.3*4.4*5.5*6.6*7.7*8.8*9.9))",1.0), + test_t("equal(min(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),1.1)",1.0), + test_t("equal(max(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),9.9)",1.0), + test_t("equal(avg(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9),5.5)",1.0), + test_t("floor(1.0)",1.0), + test_t("floor(1.1)",1.0), + test_t("floor(-1.0)",-1.0), + test_t("floor(-1.1)",-2.0), + test_t("ceil(1.0)",1.0), + test_t("ceil(1.1)",2.0), + test_t("ceil(-1.0)",-1.0), + test_t("ceil(-1.1)",-1.0), + test_t("round(1.1)",1.0), + test_t("round(1.49)",1.0), + test_t("round(1.5)",2.0), + test_t("round(1.9)",2.0), + test_t("roundn(1/3,2)",0.33), + test_t("roundn(1/3,5)",0.33333), + test_t("roundn(2/3,2)",0.67), + test_t("roundn(2/3,5)",0.66667), + test_t("roundn(1.0/3.0,2.0)",0.33), + test_t("roundn(1.0/3.0,5.0)",0.33333), + test_t("roundn(2.0/3.0,2.0)",0.67), + test_t("roundn(2.0/3.0,5.0)",0.66667), + test_t("cos(0.0)",1.0), + test_t("sin(0.0)",0.0), + test_t("equal(sin(pi/4.0),cos(pi/4.0))",1.0), + test_t("equal(sin(pi/6.0),cos(pi/3.0))",1.0), + test_t("(sin(pi/4.0) - cos(pi/4.0)) <= epsilon",1.0), + test_t("(cos(pi/3.0) - sin(pi/6.0)) <= epsilon",1.0), + test_t("sin(deg2rad(30))",0.5), + test_t("cos(deg2rad(60))",0.5), + test_t("sin(deg2rad(30)) + cos(deg2rad(60))",1.0), + test_t("equal(sin(deg2rad(30))/cos(deg2rad(30)),tan(deg2rad(30)))",1.0), + test_t("equal(sinh(pi),11.5487393572577483779773343153884) ",1.0), + test_t("equal(asinh(11.5487393572577483779773343153884),pi)",1.0), + test_t("equal(cosh(pi),11.5919532755215206277517520525601) ",1.0), + test_t("equal(acosh(11.5919532755215206277517520525601),pi)",1.0), + test_t("equal(tanh(pi),0.99627207622074994426469058001253) ",1.0), + test_t("equal(atanh(0.99627207622074994426469058001253),pi)",1.0), + test_t("exp(1.0)",2.71828182845904523536028747135266249775724), + test_t("exp(0.0)",1.0), + test_t("log(2.7182818284590451)",1.0), + test_t("log10(10.0)",1.0), + test_t("frac(12.34) + trunc(12.34)",12.34), + test_t("hypot(3.0,4.0)",5.0), + test_t("hypot(1.0,sqrt(3.0))",2.0), + test_t("if(1 < 2, 3, 4)",3.0), + test_t("if(1.1 < 2.2, 3.3, 4.4)",3.3), + test_t("if((1.0+1.1) < (2.0+1.2), 3.3, 4.4)",3.3), + test_t("if(1 = 2, 3, 4)",4.0), + test_t("if(1.1 = 2.2, 3.3, 4.4)",4.4), + test_t("if((1.0+1.1) = (2.0+1.2), 3.3, 4.4)",4.4), + test_t("if(1 == 2, 3, 4)",4.0), + test_t("if(1.1 == 2.2, 3.3, 4.4)",4.4), + test_t("if((1.0+1.1) == (2.0+1.2), 3.3, 4.4)",4.4), + test_t("if(1 >= 2, 3, 4)",4.0), + test_t("if(1.1 >= 2.2, 3.3, 4.4)",4.4), + test_t("if((1.0+1.1) >= (2.0+1.2), 3.3, 4.4)",4.4), + test_t("if(((1.0 + 2.0) == 3.0) and ((4.0 + 5.0) < 9.0),1,2)",2.0), + test_t("(3.0 - 1.0 - 2.0) == ((3.0 - 1.0) - 2.0)",1.0), + test_t("true == true",1.0), + test_t("false == false",1.0), + test_t("true != false",1.0), + test_t("false != true",1.0), + test_t("(1 < 2) == true",1.0), + test_t("(1 > 2) == false",1.0), + test_t("true == (1 < 2)",1.0), + test_t("false == (1 > 2)",1.0), + test_t("(1 > 2) != true",1.0), + test_t("(1 < 2) != false",1.0), + test_t("true != (1 > 2)",1.0), + test_t("false != (1 < 2)",1.0), + test_t("(true and true) == true",1.0), + test_t("(false and false) == false",1.0), + test_t("(true or true) == true",1.0), + test_t("(false or false) == false",1.0), + test_t("(true and false) == false",1.0), + test_t("(false and true) == false",1.0), + test_t("(true or false) == true",1.0), + test_t("(false or true) == true",1.0), + test_t("(true & true) == true",1.0), + test_t("(false & false) == false",1.0), + test_t("(true | true) == true",1.0), + test_t("(false | false) == false",1.0), + test_t("(true & false) == false",1.0), + test_t("(false & true) == false",1.0), + test_t("(true | false) == true",1.0), + test_t("(false | true) == true",1.0), + test_t("clamp(-1,1,+1)",1.0), + test_t("clamp(-1,-1.5,+1.0)",-1.0), + test_t("clamp(-1,+1.5,+1.0)",+1.0), + test_t("clamp(-1,-1.5,+1.0) + clamp(-1,+1.5,+1.0)",0.0), + test_t("inrange(-2,1,+2) == ((-2 <= 1) and (1 <= +2))",1.0), + test_t("inrange(-2,1,+2) == if(({-2 <= 1} and [1 <= +2]),1.0,0.0)",1.0), + test_t("sgn( 0)", 0.0), + test_t("sgn(+3)",+1.0), + test_t("sgn(-3)",-1.0), + test_t("equal($f00(1.1,2.2,3.3),(1.1+2.2)/3.3)",1.0), + 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-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), + test_t("1+2+3+4+5+6+7+8+9+0",45.0), + test_t("1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0",45.0), + test_t("1.0 + 2.0 + 3.0 + 4.0 + 5.0 + 6.0 + 7.0 + 8.0 + 9.0 + 0.0",45.0), + test_t("(1+2)+(3+4)+(5+6)+(7+8)+(9+0)",45.0), + test_t("(1-2)+(3-4)+(5-6)+(7-8)+(9-0)",+5.0), + test_t("(1+2)-(3+4)-(5+6)-(7+8)-(9+0)",-39.0), + test_t("(1.0+2.0)+(3.0+4.0)+(5.0+6.0)+(7.0+8.0)+(9.0+0.0)",45.0), + test_t("(1.0-2.0)+(3.0-4.0)+(5.0-6.0)+(7.0-8.0)+(9.0-0.0)",+5.0), + test_t("(1.0+2.0)-(3.0+4.0)-(5.0+6.0)-(7.0+8.0)-(9.0+0.0)",-39.0), + test_t("[(1.0+2.0)+[3.0+4.0]+(5.0+6.0)]+([7.0+8.0]+(9.0+0.0))",45.0), + test_t("([1.0-2.0]+(3.0-4.0)+[5.0-6.0])+[(7.0-8.0)+[9.0-0.0]]",+5.0), + test_t("((1.0+2.0))-[(3.0+4.0)]-((5.0+6.0))-[(7.0+8.0)]-((9.0+0.0))",-39.0), + test_t("{[(1.0+2.0)+[3.0+4.0]+({5.0+6.0})]}+({[7.0+8.0]+(9.0+0.0)})",45.0), + test_t("{([1.0-2.0]+(3.0-4.0)+[5.0-6.0])}+[({+7.0}-{+8.0})+[{+9.0-0.0}]]",+5.0), + test_t("((+1.0+2.0))-[({+3.0+4.0})]-(({+5.0+6.0}))-[({+7.0}+8.0)]-(({+9.0}+{0.0}))",-39.0), + test_t("1+2-3*4/5+6-7*8/9+0",0.37777777777777777778), + test_t("1.1+2.2-3.3*4.4/5.5+6.6-7.7*8.8/9.9+0.0",0.41555555555555555556), + test_t("(1+2)-(3*4)/(5+6)-(7*8)/(9+0)",-4.31313131313131313131), + test_t("1/1+1/2+1/3+1/4+1/5+1/6+1/7+1/8+1/9",2.82896825396825396825), + test_t("(1/1)+(1/2)+(1/3)+(1/4)+(1/5)+(1/6)+(1/7)+(1/8)+(1/9)",2.82896825396825396825), + test_t("1.0/1.0+1.0/2.0+1.0/3.0+1.0/4.0+1.0/5.0+1.0/6.0+1.0/7.0+1.0/8.0+1.0/9",2.82896825396825396825), + test_t("(1.0/1.0)+(1.0/2.0)+(1.0/3.0)+(1.0/4.0)+(1.0/5.0)+(1.0/6.0)+(1.0/7.0)+(1.0/8.0)+(1.0/9)",2.82896825396825396825), + test_t("1/1*1/2*1/3*1/4*1/5*1/6*1/7*1/8*1/9",0.00000275573192239859), + test_t("(1/1)*(1/2)*(1/3)*(1/4)*(1/5)*(1/6)*(1/7)*(1/8)*(1/9)",0.00000275573192239859), + test_t("1.0/1.0*1.0/2.0*1.0/3.0*1.0/4.0*1.0/5.0*1.0/6.0*1.0/7.0*1.0/8.0*1.0/9",0.00000275573192239859), + test_t("(1.0/1.0)*(1.0/2.0)*(1.0/3.0)*(1.0/4.0)*(1.0/5.0)*(1.0/6.0)*(1.0/7.0)*(1.0/8.0)*(1.0/9)",0.00000275573192239859), + test_t("equal(poly01(1.2345,2.2,1.1),(2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly02(1.2345,3.3,2.2,1.1),(3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly03(1.2345,4.4,3.3,2.2,1.1),(4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly04(1.2345,5.5,4.4,3.3,2.2,1.1),(5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly05(1.2345,6.6,5.5,4.4,3.3,2.2,1.1),(6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly06(1.2345,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly07(1.2345,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(8.8*1.2345^7+7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly08(1.2345,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(9.9*1.2345^8+8.8*1.2345^7+7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly09(1.2345,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(1.1*1.2345^9+9.9*1.2345^8+8.8*1.2345^7+7.7*1.2345^6+6.6*1.2345^5+5.5*1.2345^4+4.4*1.2345^3+3.3*1.2345^2+2.2*1.2345^1+1.1))",1.0), + test_t("equal(poly10(1.37,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(2.2*1.37^10+1.1*1.37^9+9.9*1.37^8+8.8*1.37^7+7.7*1.37^6+6.6*1.37^5+5.5*1.37^4+4.4*1.37^3+3.3*1.37^2+2.2*1.37^1+1.1))",1.0), + test_t("equal(poly11(1.37,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(3.3*1.37^11+2.2*1.37^10+1.1*1.37^9+9.9*1.37^8+8.8*1.37^7+7.7*1.37^6+6.6*1.37^5+5.5*1.37^4+4.4*1.37^3+3.3*1.37^2+2.2*1.37^1+1.1))",1.0), + test_t("equal(poly12(1.37,4.4,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(4.4*1.37^12+3.3*1.37^11+2.2*1.37^10+1.1*1.37^9+9.9*1.37^8+8.8*1.37^7+7.7*1.37^6+6.6*1.37^5+5.5*1.37^4+4.4*1.37^3+3.3*1.37^2+2.2*1.37^1+1.1))",1.0), + test_t("equal(\t \n(\n \r1.1\t\t - \n\n 2.2\n\n/\r3.3\t),(1.1-2.2/3.3))",1.0), + test_t("equal((pi^2^3),(pi^8))",1.0), + test_t("equal((pi^(2^3)),(pi^8))",1.0), + test_t("equal(pi^2^3-pi^8,0)",1.0), + test_t("equal((2*pi^2^3),2*(pi^8))",1.0), + test_t("equal((pi^2^3*2),2*(pi^8))",1.0), + test_t("equal((pi^2^3/2),(pi^8)/2)",1.0), + test_t("equal((pi^2.2^3.3),(pi^13.4894687605338489))",1.0), + test_t("equal((pi^(2.2^3.3)),(pi^13.4894687605338489))",1.0), + test_t("equal((2.2*pi^2.2^3.3),2.2*(pi^13.4894687605338489))",1.0), + test_t("equal((pi^2.2^3.3*2),2*(pi^13.4894687605338489))",1.0), + test_t("equal((pi^2.2^3.3/2.2),(pi^13.4894687605338489)/2.2)",1.0), + test_t("equal((pi^-2^3),1/(pi^8))",1.0), + test_t("equal((pi^(-2^3)),1/(pi^8))",1.0), + test_t("equal((pi^2^-3),(pi^(1/8)))",1.0), + test_t("equal((pi^(2^-3)),(pi^(1/8)))",1.0), + test_t("equal((pi^-2^-3),1/(pi^(1/8)))",1.0), + test_t("equal((pi^(-2^-3)),1/(pi^(1/8)))",1.0), + test_t("equal((-pi^2^3),(-pi^8))",1.0), + test_t("equal((-pi^(2^3)),(-pi^8))",1.0), + test_t("equal(-pi^2^3--pi^8,0)",1.0), + test_t("equal((2*-pi^2^3),2*(-pi^8))",1.0), + test_t("equal((-pi^2^3*2),2*(-pi^8))",1.0), + test_t("equal((-pi^2^3/2),(-pi^8)/2)",1.0), + test_t("equal((-pi^2.2^3.3),(-pi^13.4894687605338489))",1.0), + test_t("equal((-pi^(2.2^3.3)),(-pi^13.4894687605338489))",1.0), + test_t("equal((2.2*-pi^2.2^3.3),2.2*(-pi^13.4894687605338489))",1.0), + test_t("equal((-pi^2.2^3.3*2),2*(-pi^13.4894687605338489))",1.0), + test_t("equal((-pi^2.2^3.3/2.2),(-pi^13.4894687605338489)/2.2)",1.0), + test_t("equal((-pi^-2^3),1/(-pi^8))",1.0), + test_t("equal((-pi^(-2^3)),1/(-pi^8))",1.0), + test_t("equal((-pi^2^-3),(-pi^(1/8)))",1.0), + test_t("equal((-pi^(2^-3)),(-pi^(1/8)))",1.0), + test_t("equal((-pi^-2^-3),1/(-pi^(1/8)))",1.0), + test_t("equal((-pi^(-2^-3)),1/(-pi^(1/8)))",1.0), + test_t("equal((+pi^+2^+3),(+pi^+8))",1.0), + test_t("equal((+pi^(2^3)),(+pi^+8))",1.0), + test_t("equal(+pi^+2^+3-+pi^+8,0)",1.0), + test_t("equal((+2*+pi^+2^+3),+2*(+pi^+8))",1.0), + test_t("equal((+pi^+2^+3*+2),+2*(+pi^+8))",1.0), + test_t("equal((+pi^+2^+3/+2),(+pi^+8)/+2)",1.0), + test_t("equal((+pi^+2.2^+3.3),(+pi^+13.4894687605338489))",1.0), + test_t("equal((+pi^(+2.2^+3.3)),(+pi^+13.4894687605338489))",1.0), + test_t("equal((+2.2*+pi^+2.2^+3.3),+2.2*(+pi^+13.4894687605338489))",1.0), + test_t("equal((+pi^+2.2^+3.3*+2),+2*(+pi^+13.4894687605338489))",1.0), + test_t("equal((+pi^+2.2^+3.3/+2.2),(+pi^+13.4894687605338489)/+2.2)",1.0), + test_t("equal((+pi^-2^3),1/(+pi^+8))",1.0), + test_t("equal((+pi^(-2^3)),1/(+pi^+8))",1.0), + test_t("equal((+pi^2^-3),(+pi^(+1/+8)))",1.0), + test_t("equal((+pi^(2^-3)),(+pi^(+1/+8)))",1.0), + test_t("equal((+pi^-2^-3),1/(+pi^(+1/+8)))",1.0), + test_t("equal((+pi^(-2^-3)),1/(+pi^(+1/+8)))",1.0), + test_t("equal((-pi^+2^+3),(-pi^+8))",1.0), + test_t("equal((-pi^(2^3)),(-pi^+8))",1.0), + test_t("equal(-pi^+2^+3--pi^+8,0)",1.0), + test_t("equal((+2*-pi^+2^+3),2*(-pi^+8))",1.0), + test_t("equal((-pi^+2^+3*2),2*(-pi^+8))",1.0), + test_t("equal((-pi^+2^+3/+2),(-pi^+8)/+2)",1.0), + test_t("equal((-pi^+2.2^+3.3),(-pi^+13.4894687605338489))",1.0), + test_t("equal((-pi^(2.2^3.3)),(-pi^+13.4894687605338489))",1.0), + test_t("equal((+2.2*-pi^+2.2^+3.3),2.2*(-pi^+13.4894687605338489))",1.0), + test_t("equal((-pi^+2.2^+3.3*2),2*(-pi^+13.4894687605338489))",1.0), + test_t("equal((-pi^+2.2^+3.3/+2.2),(-pi^+13.4894687605338489)/+2.2)",1.0), + test_t("equal((-pi^-2^3),1/(-pi^+8))",1.0), + test_t("equal((-pi^(-2^3)),1/(-pi^+8))",1.0), + test_t("equal((-pi^2^-3),(-pi^(+1/+8)))",1.0), + test_t("equal((-pi^(2^-3)),(-pi^(+1/+8)))",1.0), + test_t("equal((-pi^-2^-3),1/(-pi^(+1/+8)))",1.0), + test_t("equal((-pi^(-2^-3)),1/(-pi^(+1/+8)))",1.0), + test_t("switch { case (1 <= 2) : 1; default: 1.12345; }",1.0), + test_t("switch { case (1 > 2) : 0; case (1 <= 2) : 1; default: 1.12345; }",1.0), + test_t("switch { case (1 <= 2) : switch { case (1 <= 2) : 1; default: 1.12345; }; default: 1.12345; }",1.0), + test_t("switch { case [1 <= 2] : 1; default: 1.12345; }",1.0), + test_t("switch { case [1 > 2] : 0; case [1 <= 2] : 1; default: 1.12345; }",1.0), + test_t("switch { case [1 <= 2] : switch { case [1 <= 2] : 1; default: 1.12345; }; default: 1.12345; }",1.0), + test_t("switch { case {1 <= 2} : 1; default: 1.12345; }",1.0), + test_t("switch { case {1 > 2} : 0; case {1 <= 2} : 1; default: 1.12345; }",1.0), + test_t("switch { case {1 <= 2} : switch { case {1 <= 2} : 1; default: 1.12345; }; default: 1.12345; }",1.0), + test_t("switch { case [(1 <= 2)] : {1}; default: 1.12345; }",1.0), + test_t("switch { case ([1 > 2]) : [0]; case ([1 <= 2]) : 1; default: 1.12345; }",1.0), + test_t("switch { case {(1 <= 2)} : switch { case ({1 <= 2}) : 1; default: 1.12345; }; default: 1.12345; }",1.0), + test_t("switch { case 1 > 1 : 1; case 2 > 2 : 2; case 3 = 3 : 3; case 4 > 4 : 4; default : 5; }",3.0), + test_t("repeat 1.1 + 2.2 until (1 < 2)",3.3), + test_t("repeat (1.1 + 2.2) until (1 < 2)",3.3), + test_t("repeat 1.1 + 2.2; until (1 < 2)",3.3), + test_t("repeat (1.1 + 2.2); until (1 < 2)",3.3), + test_t("repeat 1.1234; 1 < 2; 1.1 + 2.2 until (1 < 2)",3.3), + test_t("repeat 1.1234; 1 < 2; (1.1 + 2.2) until (1 < 2)",3.3), + test_t("repeat 1.1234; 1 < 2; 1.1 + 2.2; until (1 < 2)",3.3), + test_t("repeat 1.1234; 1 < 2; (1.1 + 2.2); until (1 < 2)",3.3), + test_t("[*] { case 1 < 2 : 1 / 2; case (1 < 3) : 2 / 2; case 1 < 4 : 3 / 2; case (1 < 5) : 4 / 2; }",2.0), + test_t(" 0 ? 1 : 2",2.0), + test_t(" 1 ? 3 : 4",3.0), + test_t("(0 ? 1 : 2) == 2",1.0), + test_t("(1 ? 3 : 4) == 3",1.0), + test_t("[(0)] ? [(1)] : [(2)]",2.0), + test_t("([(0)] ? [(1)] : [(2)]) == 2",1.0), + test_t("([(1)] ? [(3)] : [(4)]) == 3",1.0), + test_t("(1 < 2 ? 3 : 4) == 3",1.0), + test_t("(1 > 2 ? 3 : 4) == 4",1.0), + test_t("(1 < 2 ? 3 + 5 : 4) == 8",1.0), + test_t("(1 > 2 ? 3 : 4 + 5) == 9",1.0), + test_t("(2 < 3 + 3 ? 7 : 9) == 7",1.0), + test_t("(1 + 1 < 3 ? 7 : 9) == 7",1.0), + test_t("(1 + 1 < 3 + 3 ? 7 : 9) == 7",1.0), + test_t("(2 > 3 + 3 ? 7 : 9) == 9",1.0), + test_t("(1 + 1 > 3 ? 7 : 9) == 9",1.0), + test_t("(1 + 1 > 3 + 3 ? 7 : 9) == 9",1.0), + test_t("(2 < (3 + 3) ? 7 : 9) == 7",1.0), + test_t("((1 + 1) < 3 ? 7 : 9) == 7",1.0), + test_t("((1 + 1) < (3 + 3) ? 7 : 9) == 7",1.0), + test_t("(min(1,2) ? 1 + 3 : 1 + 4) == 4",1.0), + test_t("(min(0,1) ? 1 + 3 : 1 + 4) == 5",1.0), + test_t("if(1 < 2) 3; == 3",1.0), + test_t("if(1 > 2) 3; == null",1.0), + test_t("if(1 < 2) 3; else 4; == 3",1.0), + test_t("if(1 > 2) 3; else 4; == 4",1.0), + test_t("if(1 < 2) 3; else {1+2; 4;} == 3",1.0), + test_t("if(1 > 2) 3; else {1+2; 4;} == 4",1.0), + test_t("if(1 < 2) 3; else if (1 < 2) 4; == 3",1.0), + test_t("if(1 > 2) 3; else if (1 < 2) 4; == 4",1.0), + test_t("if(1 > 2) 3; else if (1 > 2) 4; == null",1.0), + test_t("if(1 < 2) 3; else if (1 < 2) {1+2; 4;} == 3",1.0), + test_t("if(1 > 2) 3; else if (1 < 2) {1+2; 4;} == 4",1.0), + test_t("if(1 > 2) 3; else if (1 > 2) {1+2; 4;} == null",1.0), + test_t("if(1 < 2) { 1+2; 3;} == 3",1.0), + test_t("if(1 > 2) { 1+2; 3;} == null",1.0), + test_t("if(1 < 2) { 1+2; 3;} else 4; == 3",1.0), + test_t("if(1 > 2) { 1+2; 3;} else 4; == 4",1.0), + test_t("if(1 < 2) { 1+2; 3;} else {1+2; 4;} == 3",1.0), + test_t("if(1 > 2) { 1+2; 3;} else {1+2; 4;} == 4",1.0), + test_t("if(1 < 2) { 1+2; 3;} else if (1 < 2) 4; == 3",1.0), + test_t("if(1 > 2) { 1+2; 3;} else if (1 < 2) 4; == 4",1.0), + test_t("if(1 > 2) { 1+2; 3;} else if (1 > 2) 4; == null",1.0), + test_t("if(1 < 2) { 1+2; 3;} else if (1 < 2) {1+2; 4;} == 3",1.0), + test_t("if(1 > 2) { 1+2; 3;} else if (1 < 2) {1+2; 4;} == 4",1.0), + test_t("if(1 > 2) { 1+2; 3;} else if (1 > 2) {1+2; 4;} == null",1.0) }; static const std::size_t test_list_size = sizeof(test_list) / sizeof(test_t); @@ -1223,359 +1223,359 @@ inline bool run_test01() { static const test_xy test_list[] = { - test_xy("x + y" ,T(2.2),T(3.3),T(5.5 )), - test_xy("x - y" ,T(3.3),T(2.2),T(1.1 )), - test_xy("x * y" ,T(3.3),T(2.2),T(7.26 )), - test_xy("x / y" ,T(3.3),T(2.2),T(1.5 )), - test_xy("(x + y) * (x + y)" ,T(2.2),T(3.3),T(30.25)), - test_xy("(x + y) / (x + y)" ,T(2.2),T(3.3),T(1.0 )), - test_xy("x + y > x and x + y > y" ,T(2.2),T(3.3),T(1.0)), - test_xy("1 + (x + y)" ,T(2.2),T(3.3),T(6.5 )), - test_xy("(x + y) - 1" ,T(2.2),T(3.3),T(4.5 )), - test_xy("1 + (x + y) * 2" ,T(2.2),T(3.3),T(12.0 )), - test_xy("2 * (x + y) - 1" ,T(2.2),T(3.3),T(10.0 )), - test_xy("y + (x + 1)" ,T(2.2),T(3.3),T(6.5 )), - test_xy("(x + 1) + y" ,T(2.2),T(3.3),T(6.5 )), - test_xy("2 * x" ,T(2.2),T(0.0),T(4.4)), - test_xy("x * 2" ,T(2.2),T(0.0),T(4.4)), - test_xy("1.1 + x",T(2.2),T(0.0),T(3.3)), - test_xy("x + 1.1",T(2.2),T(0.0),T(3.3)), - test_xy("x * 1 == x" ,T(2.0),T(3.0),T(1.0)), - test_xy("1 * x == x" ,T(2.0),T(3.0),T(1.0)), - test_xy("y * 1 == y" ,T(2.0),T(3.0),T(1.0)), - test_xy("1 * y == y" ,T(2.0),T(3.0),T(1.0)), - test_xy("x * 0 == 0" ,T(2.0),T(3.0),T(1.0)), - test_xy("0 * x == 0" ,T(2.0),T(3.0),T(1.0)), - test_xy("y * 0 == 0" ,T(2.0),T(3.0),T(1.0)), - test_xy("0 * y == 0" ,T(2.0),T(3.0),T(1.0)), - test_xy("x + 1 == 1 + x",T(2.0),T(3.0),T(1.0)), - test_xy("y + 1 == 1 + y",T(2.0),T(3.0),T(1.0)), - test_xy("x + y == y + x",T(2.0),T(3.0),T(1.0)), - test_xy("x * y == y * x",T(2.0),T(3.0),T(1.0)), - test_xy("x < y" ,T(2.0),T(3.0),T(1.0)), - test_xy("y > x" ,T(2.0),T(3.0),T(1.0)), - test_xy("x <= y" ,T(2.0),T(3.0),T(1.0)), - test_xy("y >= x" ,T(2.0),T(3.0),T(1.0)), - test_xy("x + y > y" ,T(2.0),T(3.0),T(1.0)), - test_xy("x + y > x" ,T(2.0),T(3.0),T(1.0)), - test_xy("x * y > y" ,T(2.0),T(3.0),T(1.0)), - test_xy("x * y > x" ,T(2.0),T(3.0),T(1.0)), - test_xy("(x + y) > y" ,T(2.0),T(3.0),T(1.0)), - test_xy("(x + y) > x" ,T(2.0),T(3.0),T(1.0)), - test_xy("(x * y) > y" ,T(2.0),T(3.0),T(1.0)), - test_xy("(x * y) > x" ,T(2.0),T(3.0),T(1.0)), - test_xy("(2x + 3y) == (2*x + 3*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy("2(x + y) == (2*x + 2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x + y)3 == (3*x + 3*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy("2x + 3y == 2*x + 3*y" ,T(2.0),T(3.0),T(1.0)), - test_xy("2(x + y) == 2*x + 2*y" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x + y)3 == 3*x + 3*y" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x)y == (x*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" x(y) == (x*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x) y == (x*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" x (y) == (x*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" ((x) y) == (x*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x (y)) == (x*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x)3 == (x*3)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" x(3) == (x*3)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x) 3 == (x*3)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" x (3) == (x*3)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" ((x) 3) == (x*3)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (x (3)) == (x*3)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (2)y == (2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" 2(y) == (2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (2) y == (2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" 2 (y) == (2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" ((2) y) == (2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy(" (2 (y)) == (2*y)" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; (a)(3) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; (a){3} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; (a)[3] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; {a}(3) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; {a}{3} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; {a}[3] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; (a)(b) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; (a){b} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; (a)[b] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; {a}(b) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; {a}{b} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; {a}[b] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; (a)(a+1) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; (a){a+1} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; (a)[a+1] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; {a}(a+1) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; {a}{a+1} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; {a}[a+1] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; (b-1)(b) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; (b-1){b} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; (b-1)[b] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; {b-1}(b) == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; {b-1}{b} == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("var a := 2; var b := 3; {b-1}[b] == 6" ,T(2.0),T(3.0),T(1.0)), - test_xy("equal(x^2.2^1.1,17.15193942371376191362)" ,T(3.3),T(0.0),T(1.0)), - test_xy("equal(3.3^x^1.1,17.15193942371376191362)" ,T(2.2),T(0.0),T(1.0)), - test_xy("equal(3.3^2.2^x,17.15193942371376191362)" ,T(1.1),T(0.0),T(1.0)), - test_xy("equal(x^2.2^y,17.15193942371376191362)" ,T(3.3),T(1.1),T(1.0)), - test_xy("equal(x^y^1.1,17.15193942371376191362)" ,T(3.3),T(2.2),T(1.0)), - test_xy("equal(3.3^x^y,17.15193942371376191362)" ,T(2.2),T(1.1),T(1.0)), - test_xy("equal(x+y^3/7,x+(y*y*y)/7)",T(2.0),T(3.0),T(1.0)), - test_xy("equal(1-x^3+y^2*7,1-(x*x*x)+(y*y)*7)",T(2.0),T(3.0),T(1.0)), - test_xy("equal( x^0,1)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^1,x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^2,x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^3,x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^4,x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^5,x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^6,x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^7,x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^8,x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^9,x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^10,x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^11,x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^12,x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^13,x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^14,x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^15,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^16,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^17,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^18,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^19,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^20,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^21,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^22,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^23,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^24,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^25,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( y^0,1)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^1,y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^2,y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^3,y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^4,y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^5,y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^6,y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^7,y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^8,y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^9,y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^10,y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^11,y*y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^12,y*y*y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^13,y*y*y*y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^14,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("equal(y^15,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("equal(y^16,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("equal(y^17,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("equal(y^18,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("equal(y^19,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("equal(y^20,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("equal(y^21,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("equal(y^22,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("equal(y^23,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("equal(y^24,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("equal(y^25,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("equal( x^-0,1/1)",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-1,1/(x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-2,1/(x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-3,1/(x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-4,1/(x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-5,1/(x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-6,1/(x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-7,1/(x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-8,1/(x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( x^-9,1/(x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-10,1/(x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-11,1/(x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-12,1/(x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-13,1/(x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-14,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-15,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-16,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-17,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-18,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-19,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-20,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-21,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-22,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-23,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-24,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal(x^-25,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), - test_xy("equal( y^-0,1/1)",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-1,1/(y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-2,1/(y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-3,1/(y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-4,1/(y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-5,1/(y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-6,1/(y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-7,1/(y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-8,1/(y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal( y^-9,1/(y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^-10,1/(y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^-11,1/(y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^-12,1/(y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^-13,1/(y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), - test_xy("equal(y^-14,1/(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("equal(y^-15,1/(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("equal(y^-16,1/(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("equal(y^-17,1/(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("equal(y^-18,1/(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("equal(y^-19,1/(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("equal(y^-20,1/(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("equal(y^-21,1/(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("equal(y^-22,1/(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("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("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("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("(2 + x) + 7",T(3.0),T(0.0),T((2.0 + 3.0) + 7.0)), - test_xy("(2 + x) - 7",T(3.0),T(0.0),T((2.0 + 3.0) - 7.0)), - test_xy("(2 - x) + 7",T(3.0),T(0.0),T((2.0 - 3.0) + 7.0)), - test_xy("(2 - x) - 7",T(3.0),T(0.0),T((2.0 - 3.0) - 7.0)), - test_xy("(2 * x) * 7",T(3.0),T(0.0),T((2.0 * 3.0) * 7.0)), - test_xy("(2 * x) / 7",T(3.0),T(0.0),T((2.0 * 3.0) / 7.0)), - test_xy("(2 / x) * 7",T(3.0),T(0.0),T((2.0 / 3.0) * 7.0)), - test_xy("(2 / x) / 7",T(3.0),T(0.0),T((2.0 / 3.0) / 7.0)), - test_xy("2 + (x + 7)",T(3.0),T(0.0),T(2.0 + (3.0 + 7.0))), - test_xy("2 + (x - 7)",T(3.0),T(0.0),T(2.0 + (3.0 - 7.0))), - test_xy("2 - (x + 7)",T(3.0),T(0.0),T(2.0 - (3.0 + 7.0))), - test_xy("2 - (x - 7)",T(3.0),T(0.0),T(2.0 - (3.0 - 7.0))), - test_xy("2 * (x * 7)",T(3.0),T(0.0),T(2.0 * (3.0 * 7.0))), - test_xy("2 * (x / 7)",T(3.0),T(0.0),T(2.0 * (3.0 / 7.0))), - test_xy("2 / (x * 7)",T(3.0),T(0.0),T(2.0 / (3.0 * 7.0))), - test_xy("2 / (x / 7)",T(3.0),T(0.0),T(2.0 / (3.0 / 7.0))), - test_xy("2 + (7 + x)",T(3.0),T(0.0),T(2.0 + (7.0 + 3.0))), - test_xy("2 + (7 - x)",T(3.0),T(0.0),T(2.0 + (7.0 - 3.0))), - test_xy("2 - (7 + x)",T(3.0),T(0.0),T(2.0 - (7.0 + 3.0))), - test_xy("2 - (7 - x)",T(3.0),T(0.0),T(2.0 - (7.0 - 3.0))), - test_xy("2 * (7 * x)",T(3.0),T(0.0),T(2.0 * (7.0 * 3.0))), - test_xy("2 * (7 / x)",T(3.0),T(0.0),T(2.0 * (7.0 / 3.0))), - test_xy("2 / (7 * x)",T(3.0),T(0.0),T(2.0 / (7.0 * 3.0))), - test_xy("2 / (7 / x)",T(3.0),T(0.0),T(2.0 / (7.0 / 3.0))), - test_xy("(x + 2) + 7",T(3.0),T(0.0),T((3.0 + 2.0) + 7.0)), - test_xy("(x + 2) - 7",T(3.0),T(0.0),T((3.0 + 2.0) - 7.0)), - test_xy("(x - 2) + 7",T(3.0),T(0.0),T((3.0 - 2.0) + 7.0)), - test_xy("(x - 2) - 7",T(3.0),T(0.0),T((3.0 - 2.0) - 7.0)), - test_xy("(x * 2) * 7",T(3.0),T(0.0),T((3.0 * 2.0) * 7.0)), - test_xy("(x * 2) / 7",T(3.0),T(0.0),T((3.0 * 2.0) / 7.0)), - test_xy("(x / 2) * 7",T(3.0),T(0.0),T((3.0 / 2.0) * 7.0)), - test_xy("(x / 2) / 7",T(3.0),T(0.0),T((3.0 / 2.0) / 7.0)), - test_xy("((2 + x) + (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) + (3.0 + 9.0)))), - test_xy("((2 + x) - (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) - (3.0 + 9.0)))), - test_xy("((2 - x) - (3 - y))",T(7.0),T(9.0),T(((2.0 - 7.0) - (3.0 - 9.0)))), - test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), - test_xy("((x + 2) + (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) + (9.0 + 3.0)))), - test_xy("((x + 2) - (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) - (9.0 + 3.0)))), - test_xy("((x - 2) - (y - 3))",T(7.0),T(9.0),T(((7.0 - 2.0) - (9.0 - 3.0)))), - test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), - test_xy("((2 + x) + (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) + (9.0 + 3.0)))), - test_xy("((2 + x) - (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) - (9.0 + 3.0)))), - test_xy("((2 - x) - (y - 3))",T(7.0),T(9.0),T(((2.0 - 7.0) - (9.0 - 3.0)))), - test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), - test_xy("((x + 2) + (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) + (3.0 + 9.0)))), - test_xy("((x + 2) - (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) - (3.0 + 9.0)))), - test_xy("((x - 2) - (3 - y))",T(7.0),T(9.0),T(((7.0 - 2.0) - (3.0 - 9.0)))), - test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), - test_xy("((2 * x) / (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) / (3.0 * 9.0)))), - test_xy("((2 / x) * (3 / y))",T(7.0),T(9.0),T(((2.0 / 7.0) * (3.0 / 9.0)))), - test_xy("((2 * x) / (3 / y))",T(7.0),T(9.0),T(((2.0 * 7.0) / (3.0 / 9.0)))), - test_xy("((2 / x) / (3 * y))",T(7.0),T(9.0),T(((2.0 / 7.0) / (3.0 * 9.0)))), - test_xy("((x * 2) / (y * 3))",T(7.0),T(9.0),T(((7.0 * 2.0) / (9.0 * 3.0)))), - test_xy("((x / 2) * (y / 3))",T(7.0),T(9.0),T(((7.0 / 2.0) * (9.0 / 3.0)))), - test_xy("((x * 2) / (y / 3))",T(7.0),T(9.0),T(((7.0 * 2.0) / (9.0 / 3.0)))), - test_xy("((x / 2) / (y * 3))",T(7.0),T(9.0),T(((7.0 / 2.0) / (9.0 * 3.0)))), - test_xy("((2 * x) / (y * 3))",T(7.0),T(9.0),T(((2.0 * 7.0) / (9.0 * 3.0)))), - test_xy("((2 / x) * (y / 3))",T(7.0),T(9.0),T(((2.0 / 7.0) * (9.0 / 3.0)))), - test_xy("((2 * x) / (y / 3))",T(7.0),T(9.0),T(((2.0 * 7.0) / (9.0 / 3.0)))), - test_xy("((2 / x) / (y * 3))",T(7.0),T(9.0),T(((2.0 / 7.0) / (9.0 * 3.0)))), - test_xy("((x * 2) / (3 * y))",T(7.0),T(9.0),T(((7.0 * 2.0) / (3.0 * 9.0)))), - test_xy("((x / 2) * (3 / y))",T(7.0),T(9.0),T(((7.0 / 2.0) * (3.0 / 9.0)))), - test_xy("((x * 2) / (3 / y))",T(7.0),T(9.0),T(((7.0 * 2.0) / (3.0 / 9.0)))), - test_xy("((x / 2) / (3 * y))",T(7.0),T(9.0),T(((7.0 / 2.0) / (3.0 * 9.0)))), - test_xy("([(min(x,8) + y) + 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) - 4.0))), - test_xy("([(min(x,8) + y) + 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) + 4.0))), - test_xy("([(min(x,8) + y) + 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) * 4.0))), - test_xy("([(min(x,8) + y) + 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) / 4.0))), - test_xy("([(min(x,8) + y) - 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) - 4.0))), - test_xy("([(min(x,8) + y) - 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) + 4.0))), - test_xy("([(min(x,8) + y) - 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) * 4.0))), - test_xy("([(min(x,8) + y) - 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) / 4.0))), - test_xy("([(min(x,8) + y) * 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) - 4.0))), - test_xy("([(min(x,8) + y) * 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) + 4.0))), - test_xy("([(min(x,8) + y) * 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) * 4.0))), - test_xy("([(min(x,8) + y) * 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) / 4.0))), - test_xy("([(min(x,8) + y) / 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) - 4.0))), - test_xy("([(min(x,8) + y) / 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) + 4.0))), - test_xy("([(min(x,8) + y) / 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) * 4.0))), - test_xy("([(min(x,8) + y) / 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) / 4.0))), - test_xy("(4 - [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 + (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 + [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 + (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 * [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 + (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 / [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 + (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 - [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 - (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 + [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 - (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 * [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 - (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 / [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 - (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 - [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 * (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 + [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 * (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 * [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 * (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 / [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 * (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 - [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 / (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 + [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 / (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 * [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 / (std::min(7.0,8.0) + 9.0))))), - test_xy("(4 / [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 / (std::min(7.0,8.0) + 9.0))))), - test_xy("((2 * x) + (2 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) + (2.0 * 9.0)))), - test_xy("((2 * x) - (2 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) - (2.0 * 9.0)))), - test_xy("((2 * x) + (y * 2))",T(7.0),T(9.0),T(((2.0 * 7.0) + (9.0 * 2.0)))), - test_xy("((x * 2) - (y * 2))",T(7.0),T(9.0),T(((7.0 * 2.0) - (9.0 * 2.0)))), - test_xy("0 * (abs (x) + acos (y) + asin (x) + atan (y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (ceil (x) + cos (y) + cosh (x) + exp (y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (floor(x) + log (y) + log10(x) + round(y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (sin (x) + sinh (y) + sqrt (x) + tan (y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (sec (x) + csc (y) + tanh (x) + cot (y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (erf (x) + erfc (y) + sgn (y) + frac (y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (log1p(x) + expm1(y) + acosh(x) + asinh(y))",T(1.0),T(1.0),T(0.0)), - test_xy("0 * (deg2grad(x) + grad2deg(y) + rad2deg(x) + deg2rad(y))",T(1.0),T(1.0),T(0.0)), - test_xy("switch { case (x <= y) : (y - x); default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case (x > y) : 0; case (x <= y) : (y - x); default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case (x <= y) : switch { case (x <= y) : (y - x); default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case [x <= y] : [y - x]; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case [x > y] : 0; case [x <= y] : [y - x]; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case [x <= y] : switch { case [x <= y] : {y - x}; default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case {x <= y} : x; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case {x > y} : 0; case {x <= y} : {y - x}; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case {x <= y} : switch { case {x <= y} : x; default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case [(x <= y)] : {y - x}; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case ([x > y]) : [0]; case ([x <= y]) : [y - x]; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("switch { case {(x <= y)} : switch { case ({x <= y}) : x; default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), - test_xy("[*]{ case x < y : x + y; case y < x : y - x; }",T(2.0),T(3.0),T(5.0)), - test_xy("[*]{ case x > y : x + y; case y > x : y - x; }",T(2.0),T(3.0),T(1.0)), - test_xy("[*]{ case x > y : x - y; case y < x : y + x; }",T(2.0),T(3.0),T(0.0)), - test_xy("0 ? x : y" ,T(1.0),T(2.0),T( 2.0)), - test_xy("1 ? x : y" ,T(1.0),T(2.0),T( 1.0)), - test_xy("x ? x : y" ,T(1.0),T(2.0),T( 1.0)), - test_xy("x ? x : y" ,T(0.0),T(2.0),T( 2.0)), - test_xy("(x + y < 4) ? 1 : 2" ,T(1.0),T(2.0),T( 1.0)), - test_xy("(x + y > 4) ? 1 : 2" ,T(1.0),T(2.0),T( 2.0)), - test_xy("x < y ? x + y : x - y" ,T(1.0),T(2.0),T( 3.0)), - test_xy("x > y ? x + y : x - y" ,T(1.0),T(2.0),T(-1.0)), - test_xy("(x + x < y ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), - test_xy("(x + x < y + y ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), - test_xy("(x > y + y ? 7 : 9) == 9" ,T(1.0),T(3.0),T( 1.0)), - test_xy("(x + x > y ? 7 : 9) == 9" ,T(1.0),T(3.0),T( 1.0)), - test_xy("(x + x > y + 3 ? 7 : 9) == 9" ,T(1.0),T(3.0),T( 1.0)), - test_xy("(x < (y + y) ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), - test_xy("((x + x) < y ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), - test_xy("((x + x) < (y + y) ? 7 : 9) == 7",T(1.0),T(3.0),T( 1.0)), - test_xy("(x += 2 ) == 3 " ,T(1),T(3),T(1)), - test_xy("(x += 2y) == 7 " ,T(1),T(3),T(1)), - test_xy("(x -= 2 ) == -1 " ,T(1),T(3),T(1)), - test_xy("(x -= 2y) == -5 " ,T(1),T(3),T(1)), - test_xy("(x *= 2 ) == 2 " ,T(1),T(3),T(1)), - test_xy("(x *= 2y) == 6 " ,T(1),T(3),T(1)), - test_xy("(x /= 2 ) == (1/2)" ,T(1),T(3),T(1)), - test_xy("(x /= 2y) == (1/6)" ,T(1),T(3),T(1)), - test_xy("for(var i := 0; (i < 10);) { i += 1; }; x;" ,T(1),T(20),T( 1)), - test_xy("for(var i := 0; (i < 10) and (i != y); i+=2) { x += i; }; x;" ,T(1),T(20),T(21)), - test_xy("for(var i := 0; (i < 10) and (i != y);) { x += i; i+=2; }; x;",T(1),T(20),T(21)), - test_xy("for(var i := 0; (i < y); i += 1) { if (i <= (y / 2)) x += i; else break; }; x;" ,T(0),T(10),T(15)), - test_xy("for(var i := 0; (i < y); i += 1) { if (i <= (y / 2)) continue; else x += i; }; x;" ,T(0),T(10),T(30)) + test_xy("x + y" ,T(2.2),T(3.3),T(5.5 )), + test_xy("x - y" ,T(3.3),T(2.2),T(1.1 )), + test_xy("x * y" ,T(3.3),T(2.2),T(7.26 )), + test_xy("x / y" ,T(3.3),T(2.2),T(1.5 )), + test_xy("(x + y) * (x + y)" ,T(2.2),T(3.3),T(30.25)), + test_xy("(x + y) / (x + y)" ,T(2.2),T(3.3),T(1.0 )), + test_xy("x + y > x and x + y > y" ,T(2.2),T(3.3),T(1.0)), + test_xy("1 + (x + y)" ,T(2.2),T(3.3),T(6.5 )), + test_xy("(x + y) - 1" ,T(2.2),T(3.3),T(4.5 )), + test_xy("1 + (x + y) * 2" ,T(2.2),T(3.3),T(12.0 )), + test_xy("2 * (x + y) - 1" ,T(2.2),T(3.3),T(10.0 )), + test_xy("y + (x + 1)" ,T(2.2),T(3.3),T(6.5 )), + test_xy("(x + 1) + y" ,T(2.2),T(3.3),T(6.5 )), + test_xy("2 * x" ,T(2.2),T(0.0),T(4.4)), + test_xy("x * 2" ,T(2.2),T(0.0),T(4.4)), + test_xy("1.1 + x",T(2.2),T(0.0),T(3.3)), + test_xy("x + 1.1",T(2.2),T(0.0),T(3.3)), + test_xy("x * 1 == x" ,T(2.0),T(3.0),T(1.0)), + test_xy("1 * x == x" ,T(2.0),T(3.0),T(1.0)), + test_xy("y * 1 == y" ,T(2.0),T(3.0),T(1.0)), + test_xy("1 * y == y" ,T(2.0),T(3.0),T(1.0)), + test_xy("x * 0 == 0" ,T(2.0),T(3.0),T(1.0)), + test_xy("0 * x == 0" ,T(2.0),T(3.0),T(1.0)), + test_xy("y * 0 == 0" ,T(2.0),T(3.0),T(1.0)), + test_xy("0 * y == 0" ,T(2.0),T(3.0),T(1.0)), + test_xy("x + 1 == 1 + x",T(2.0),T(3.0),T(1.0)), + test_xy("y + 1 == 1 + y",T(2.0),T(3.0),T(1.0)), + test_xy("x + y == y + x",T(2.0),T(3.0),T(1.0)), + test_xy("x * y == y * x",T(2.0),T(3.0),T(1.0)), + test_xy("x < y" ,T(2.0),T(3.0),T(1.0)), + test_xy("y > x" ,T(2.0),T(3.0),T(1.0)), + test_xy("x <= y" ,T(2.0),T(3.0),T(1.0)), + test_xy("y >= x" ,T(2.0),T(3.0),T(1.0)), + test_xy("x + y > y" ,T(2.0),T(3.0),T(1.0)), + test_xy("x + y > x" ,T(2.0),T(3.0),T(1.0)), + test_xy("x * y > y" ,T(2.0),T(3.0),T(1.0)), + test_xy("x * y > x" ,T(2.0),T(3.0),T(1.0)), + test_xy("(x + y) > y" ,T(2.0),T(3.0),T(1.0)), + test_xy("(x + y) > x" ,T(2.0),T(3.0),T(1.0)), + test_xy("(x * y) > y" ,T(2.0),T(3.0),T(1.0)), + test_xy("(x * y) > x" ,T(2.0),T(3.0),T(1.0)), + test_xy("(2x + 3y) == (2*x + 3*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy("2(x + y) == (2*x + 2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x + y)3 == (3*x + 3*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy("2x + 3y == 2*x + 3*y" ,T(2.0),T(3.0),T(1.0)), + test_xy("2(x + y) == 2*x + 2*y" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x + y)3 == 3*x + 3*y" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x)y == (x*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" x(y) == (x*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x) y == (x*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" x (y) == (x*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" ((x) y) == (x*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x (y)) == (x*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x)3 == (x*3)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" x(3) == (x*3)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x) 3 == (x*3)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" x (3) == (x*3)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" ((x) 3) == (x*3)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (x (3)) == (x*3)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (2)y == (2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" 2(y) == (2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (2) y == (2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" 2 (y) == (2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" ((2) y) == (2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy(" (2 (y)) == (2*y)" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; (a)(3) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; (a){3} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; (a)[3] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; {a}(3) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; {a}{3} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; {a}[3] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; (a)(b) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; (a){b} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; (a)[b] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; {a}(b) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; {a}{b} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; {a}[b] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; (a)(a+1) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; (a){a+1} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; (a)[a+1] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; {a}(a+1) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; {a}{a+1} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; {a}[a+1] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; (b-1)(b) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; (b-1){b} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; (b-1)[b] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; {b-1}(b) == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; {b-1}{b} == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("var a := 2; var b := 3; {b-1}[b] == 6" ,T(2.0),T(3.0),T(1.0)), + test_xy("equal(x^2.2^1.1,17.15193942371376191362)" ,T(3.3),T(0.0),T(1.0)), + test_xy("equal(3.3^x^1.1,17.15193942371376191362)" ,T(2.2),T(0.0),T(1.0)), + test_xy("equal(3.3^2.2^x,17.15193942371376191362)" ,T(1.1),T(0.0),T(1.0)), + test_xy("equal(x^2.2^y,17.15193942371376191362)" ,T(3.3),T(1.1),T(1.0)), + test_xy("equal(x^y^1.1,17.15193942371376191362)" ,T(3.3),T(2.2),T(1.0)), + test_xy("equal(3.3^x^y,17.15193942371376191362)" ,T(2.2),T(1.1),T(1.0)), + test_xy("equal(x+y^3/7,x+(y*y*y)/7)",T(2.0),T(3.0),T(1.0)), + test_xy("equal(1-x^3+y^2*7,1-(x*x*x)+(y*y)*7)",T(2.0),T(3.0),T(1.0)), + test_xy("equal( x^0,1)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^1,x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^2,x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^3,x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^4,x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^5,x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^6,x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^7,x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^8,x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^9,x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^10,x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^11,x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^12,x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^13,x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^14,x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^15,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^16,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^17,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^18,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^19,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^20,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^21,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^22,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^23,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^24,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^25,x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( y^0,1)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^1,y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^2,y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^3,y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^4,y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^5,y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^6,y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^7,y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^8,y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^9,y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^10,y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^11,y*y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^12,y*y*y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^13,y*y*y*y*y*y*y*y*y*y*y*y*y)",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^14,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("equal(y^15,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("equal(y^16,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("equal(y^17,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("equal(y^18,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("equal(y^19,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("equal(y^20,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("equal(y^21,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("equal(y^22,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("equal(y^23,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("equal(y^24,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("equal(y^25,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("equal( x^-0,1/1)",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-1,1/(x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-2,1/(x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-3,1/(x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-4,1/(x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-5,1/(x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-6,1/(x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-7,1/(x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-8,1/(x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( x^-9,1/(x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-10,1/(x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-11,1/(x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-12,1/(x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-13,1/(x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-14,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-15,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-16,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-17,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-18,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-19,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-20,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-21,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-22,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-23,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-24,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal(x^-25,1/(x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x))",T(12.34),T(0.0),T(1.0)), + test_xy("equal( y^-0,1/1)",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-1,1/(y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-2,1/(y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-3,1/(y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-4,1/(y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-5,1/(y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-6,1/(y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-7,1/(y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-8,1/(y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal( y^-9,1/(y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^-10,1/(y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^-11,1/(y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^-12,1/(y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^-13,1/(y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("equal(y^-14,1/(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("equal(y^-15,1/(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("equal(y^-16,1/(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("equal(y^-17,1/(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("equal(y^-18,1/(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("equal(y^-19,1/(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("equal(y^-20,1/(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("equal(y^-21,1/(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("equal(y^-22,1/(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("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("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("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("(2 + x) + 7",T(3.0),T(0.0),T((2.0 + 3.0) + 7.0)), + test_xy("(2 + x) - 7",T(3.0),T(0.0),T((2.0 + 3.0) - 7.0)), + test_xy("(2 - x) + 7",T(3.0),T(0.0),T((2.0 - 3.0) + 7.0)), + test_xy("(2 - x) - 7",T(3.0),T(0.0),T((2.0 - 3.0) - 7.0)), + test_xy("(2 * x) * 7",T(3.0),T(0.0),T((2.0 * 3.0) * 7.0)), + test_xy("(2 * x) / 7",T(3.0),T(0.0),T((2.0 * 3.0) / 7.0)), + test_xy("(2 / x) * 7",T(3.0),T(0.0),T((2.0 / 3.0) * 7.0)), + test_xy("(2 / x) / 7",T(3.0),T(0.0),T((2.0 / 3.0) / 7.0)), + test_xy("2 + (x + 7)",T(3.0),T(0.0),T(2.0 + (3.0 + 7.0))), + test_xy("2 + (x - 7)",T(3.0),T(0.0),T(2.0 + (3.0 - 7.0))), + test_xy("2 - (x + 7)",T(3.0),T(0.0),T(2.0 - (3.0 + 7.0))), + test_xy("2 - (x - 7)",T(3.0),T(0.0),T(2.0 - (3.0 - 7.0))), + test_xy("2 * (x * 7)",T(3.0),T(0.0),T(2.0 * (3.0 * 7.0))), + test_xy("2 * (x / 7)",T(3.0),T(0.0),T(2.0 * (3.0 / 7.0))), + test_xy("2 / (x * 7)",T(3.0),T(0.0),T(2.0 / (3.0 * 7.0))), + test_xy("2 / (x / 7)",T(3.0),T(0.0),T(2.0 / (3.0 / 7.0))), + test_xy("2 + (7 + x)",T(3.0),T(0.0),T(2.0 + (7.0 + 3.0))), + test_xy("2 + (7 - x)",T(3.0),T(0.0),T(2.0 + (7.0 - 3.0))), + test_xy("2 - (7 + x)",T(3.0),T(0.0),T(2.0 - (7.0 + 3.0))), + test_xy("2 - (7 - x)",T(3.0),T(0.0),T(2.0 - (7.0 - 3.0))), + test_xy("2 * (7 * x)",T(3.0),T(0.0),T(2.0 * (7.0 * 3.0))), + test_xy("2 * (7 / x)",T(3.0),T(0.0),T(2.0 * (7.0 / 3.0))), + test_xy("2 / (7 * x)",T(3.0),T(0.0),T(2.0 / (7.0 * 3.0))), + test_xy("2 / (7 / x)",T(3.0),T(0.0),T(2.0 / (7.0 / 3.0))), + test_xy("(x + 2) + 7",T(3.0),T(0.0),T((3.0 + 2.0) + 7.0)), + test_xy("(x + 2) - 7",T(3.0),T(0.0),T((3.0 + 2.0) - 7.0)), + test_xy("(x - 2) + 7",T(3.0),T(0.0),T((3.0 - 2.0) + 7.0)), + test_xy("(x - 2) - 7",T(3.0),T(0.0),T((3.0 - 2.0) - 7.0)), + test_xy("(x * 2) * 7",T(3.0),T(0.0),T((3.0 * 2.0) * 7.0)), + test_xy("(x * 2) / 7",T(3.0),T(0.0),T((3.0 * 2.0) / 7.0)), + test_xy("(x / 2) * 7",T(3.0),T(0.0),T((3.0 / 2.0) * 7.0)), + test_xy("(x / 2) / 7",T(3.0),T(0.0),T((3.0 / 2.0) / 7.0)), + test_xy("((2 + x) + (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) + (3.0 + 9.0)))), + test_xy("((2 + x) - (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) - (3.0 + 9.0)))), + test_xy("((2 - x) - (3 - y))",T(7.0),T(9.0),T(((2.0 - 7.0) - (3.0 - 9.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((x + 2) + (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) + (9.0 + 3.0)))), + test_xy("((x + 2) - (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) - (9.0 + 3.0)))), + test_xy("((x - 2) - (y - 3))",T(7.0),T(9.0),T(((7.0 - 2.0) - (9.0 - 3.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((2 + x) + (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) + (9.0 + 3.0)))), + test_xy("((2 + x) - (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) - (9.0 + 3.0)))), + test_xy("((2 - x) - (y - 3))",T(7.0),T(9.0),T(((2.0 - 7.0) - (9.0 - 3.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((x + 2) + (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) + (3.0 + 9.0)))), + test_xy("((x + 2) - (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) - (3.0 + 9.0)))), + test_xy("((x - 2) - (3 - y))",T(7.0),T(9.0),T(((7.0 - 2.0) - (3.0 - 9.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((2 * x) / (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) / (3.0 * 9.0)))), + test_xy("((2 / x) * (3 / y))",T(7.0),T(9.0),T(((2.0 / 7.0) * (3.0 / 9.0)))), + test_xy("((2 * x) / (3 / y))",T(7.0),T(9.0),T(((2.0 * 7.0) / (3.0 / 9.0)))), + test_xy("((2 / x) / (3 * y))",T(7.0),T(9.0),T(((2.0 / 7.0) / (3.0 * 9.0)))), + test_xy("((x * 2) / (y * 3))",T(7.0),T(9.0),T(((7.0 * 2.0) / (9.0 * 3.0)))), + test_xy("((x / 2) * (y / 3))",T(7.0),T(9.0),T(((7.0 / 2.0) * (9.0 / 3.0)))), + test_xy("((x * 2) / (y / 3))",T(7.0),T(9.0),T(((7.0 * 2.0) / (9.0 / 3.0)))), + test_xy("((x / 2) / (y * 3))",T(7.0),T(9.0),T(((7.0 / 2.0) / (9.0 * 3.0)))), + test_xy("((2 * x) / (y * 3))",T(7.0),T(9.0),T(((2.0 * 7.0) / (9.0 * 3.0)))), + test_xy("((2 / x) * (y / 3))",T(7.0),T(9.0),T(((2.0 / 7.0) * (9.0 / 3.0)))), + test_xy("((2 * x) / (y / 3))",T(7.0),T(9.0),T(((2.0 * 7.0) / (9.0 / 3.0)))), + test_xy("((2 / x) / (y * 3))",T(7.0),T(9.0),T(((2.0 / 7.0) / (9.0 * 3.0)))), + test_xy("((x * 2) / (3 * y))",T(7.0),T(9.0),T(((7.0 * 2.0) / (3.0 * 9.0)))), + test_xy("((x / 2) * (3 / y))",T(7.0),T(9.0),T(((7.0 / 2.0) * (3.0 / 9.0)))), + test_xy("((x * 2) / (3 / y))",T(7.0),T(9.0),T(((7.0 * 2.0) / (3.0 / 9.0)))), + test_xy("((x / 2) / (3 * y))",T(7.0),T(9.0),T(((7.0 / 2.0) / (3.0 * 9.0)))), + test_xy("([(min(x,8) + y) + 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) - 4.0))), + test_xy("([(min(x,8) + y) + 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) + 4.0))), + test_xy("([(min(x,8) + y) + 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) * 4.0))), + test_xy("([(min(x,8) + y) + 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) + 3.0) / 4.0))), + test_xy("([(min(x,8) + y) - 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) - 4.0))), + test_xy("([(min(x,8) + y) - 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) + 4.0))), + test_xy("([(min(x,8) + y) - 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) * 4.0))), + test_xy("([(min(x,8) + y) - 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) - 3.0) / 4.0))), + test_xy("([(min(x,8) + y) * 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) - 4.0))), + test_xy("([(min(x,8) + y) * 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) + 4.0))), + test_xy("([(min(x,8) + y) * 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) * 4.0))), + test_xy("([(min(x,8) + y) * 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) * 3.0) / 4.0))), + test_xy("([(min(x,8) + y) / 3] - 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) - 4.0))), + test_xy("([(min(x,8) + y) / 3] + 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) + 4.0))), + test_xy("([(min(x,8) + y) / 3] * 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) * 4.0))), + test_xy("([(min(x,8) + y) / 3] / 4)",T(7.0),T(9.0),T((((std::min(7.0,8.0) + 9.0) / 3.0) / 4.0))), + test_xy("(4 - [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 + (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 + [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 + (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 * [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 + (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 / [3 + (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 + (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 - [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 - (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 + [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 - (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 * [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 - (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 / [3 - (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 - (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 - [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 * (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 + [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 * (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 * [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 * (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 / [3 * (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 * (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 - [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 - (3.0 / (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 + [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 + (3.0 / (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 * [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 * (3.0 / (std::min(7.0,8.0) + 9.0))))), + test_xy("(4 / [3 / (min(x,8) + y)])",T(7.0),T(9.0),T((4.0 / (3.0 / (std::min(7.0,8.0) + 9.0))))), + test_xy("((2 * x) + (2 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) + (2.0 * 9.0)))), + test_xy("((2 * x) - (2 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) - (2.0 * 9.0)))), + test_xy("((2 * x) + (y * 2))",T(7.0),T(9.0),T(((2.0 * 7.0) + (9.0 * 2.0)))), + test_xy("((x * 2) - (y * 2))",T(7.0),T(9.0),T(((7.0 * 2.0) - (9.0 * 2.0)))), + test_xy("0 * (abs (x) + acos (y) + asin (x) + atan (y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (ceil (x) + cos (y) + cosh (x) + exp (y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (floor(x) + log (y) + log10(x) + round(y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (sin (x) + sinh (y) + sqrt (x) + tan (y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (sec (x) + csc (y) + tanh (x) + cot (y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (erf (x) + erfc (y) + sgn (y) + frac (y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (log1p(x) + expm1(y) + acosh(x) + asinh(y))",T(1.0),T(1.0),T(0.0)), + test_xy("0 * (deg2grad(x) + grad2deg(y) + rad2deg(x) + deg2rad(y))",T(1.0),T(1.0),T(0.0)), + test_xy("switch { case (x <= y) : (y - x); default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case (x > y) : 0; case (x <= y) : (y - x); default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case (x <= y) : switch { case (x <= y) : (y - x); default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case [x <= y] : [y - x]; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case [x > y] : 0; case [x <= y] : [y - x]; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case [x <= y] : switch { case [x <= y] : {y - x}; default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case {x <= y} : x; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case {x > y} : 0; case {x <= y} : {y - x}; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case {x <= y} : switch { case {x <= y} : x; default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case [(x <= y)] : {y - x}; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case ([x > y]) : [0]; case ([x <= y]) : [y - x]; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("switch { case {(x <= y)} : switch { case ({x <= y}) : x; default: 1.12345; }; default: 1.12345; }",T(1.0),T(2.0),T(1.0)), + test_xy("[*]{ case x < y : x + y; case y < x : y - x; }",T(2.0),T(3.0),T(5.0)), + test_xy("[*]{ case x > y : x + y; case y > x : y - x; }",T(2.0),T(3.0),T(1.0)), + test_xy("[*]{ case x > y : x - y; case y < x : y + x; }",T(2.0),T(3.0),T(0.0)), + test_xy("0 ? x : y" ,T(1.0),T(2.0),T( 2.0)), + test_xy("1 ? x : y" ,T(1.0),T(2.0),T( 1.0)), + test_xy("x ? x : y" ,T(1.0),T(2.0),T( 1.0)), + test_xy("x ? x : y" ,T(0.0),T(2.0),T( 2.0)), + test_xy("(x + y < 4) ? 1 : 2" ,T(1.0),T(2.0),T( 1.0)), + test_xy("(x + y > 4) ? 1 : 2" ,T(1.0),T(2.0),T( 2.0)), + test_xy("x < y ? x + y : x - y" ,T(1.0),T(2.0),T( 3.0)), + test_xy("x > y ? x + y : x - y" ,T(1.0),T(2.0),T(-1.0)), + test_xy("(x + x < y ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), + test_xy("(x + x < y + y ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), + test_xy("(x > y + y ? 7 : 9) == 9" ,T(1.0),T(3.0),T( 1.0)), + test_xy("(x + x > y ? 7 : 9) == 9" ,T(1.0),T(3.0),T( 1.0)), + test_xy("(x + x > y + 3 ? 7 : 9) == 9" ,T(1.0),T(3.0),T( 1.0)), + test_xy("(x < (y + y) ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), + test_xy("((x + x) < y ? 7 : 9) == 7" ,T(1.0),T(3.0),T( 1.0)), + test_xy("((x + x) < (y + y) ? 7 : 9) == 7",T(1.0),T(3.0),T( 1.0)), + test_xy("(x += 2 ) == 3 " ,T(1),T(3),T(1)), + test_xy("(x += 2y) == 7 " ,T(1),T(3),T(1)), + test_xy("(x -= 2 ) == -1 " ,T(1),T(3),T(1)), + test_xy("(x -= 2y) == -5 " ,T(1),T(3),T(1)), + test_xy("(x *= 2 ) == 2 " ,T(1),T(3),T(1)), + test_xy("(x *= 2y) == 6 " ,T(1),T(3),T(1)), + test_xy("(x /= 2 ) == (1/2)" ,T(1),T(3),T(1)), + test_xy("(x /= 2y) == (1/6)" ,T(1),T(3),T(1)), + test_xy("for(var i := 0; (i < 10);) { i += 1; }; x;" ,T(1),T(20),T( 1)), + test_xy("for(var i := 0; (i < 10) and (i != y); i+=2) { x += i; }; x;" ,T(1),T(20),T(21)), + test_xy("for(var i := 0; (i < 10) and (i != y);) { x += i; i+=2; }; x;",T(1),T(20),T(21)), + test_xy("for(var i := 0; (i < y); i += 1) { if (i <= (y / 2)) x += i; else break; }; x;" ,T(0),T(10),T(15)), + test_xy("for(var i := 0; (i < y); i += 1) { if (i <= (y / 2)) continue; else x += i; }; x;" ,T(0),T(10),T(30)) }; static const std::size_t test_list_size = sizeof(test_list) / sizeof(test_xy); @@ -1854,396 +1854,396 @@ inline bool run_test02() { static const test_ab test_list[] = { - test_ab("'aaa' == 'aaa'" ,"","",T(1.0)), - test_ab("'aaa' < 'bbb'" ,"","",T(1.0)), - test_ab("'aaa' <= 'bbb'" ,"","",T(1.0)), - test_ab("'bbb' > 'aaa'" ,"","",T(1.0)), - test_ab("'bbb' >= 'aaa'" ,"","",T(1.0)), - test_ab("'aaa' != 'aaa'" ,"","",T(0.0)), - test_ab("'aaa' != 'bbb'" ,"","",T(1.0)), - test_ab("'aaa' + '123' == 'aaa123'" ,"","",T(1.0)), - test_ab("'aaa123' == 'aaa' + '123'" ,"","",T(1.0)), - test_ab("('aaa' + '123') == 'aaa123'" ,"","",T(1.0)), - test_ab("'aaa123' == ('aaa' + '123')" ,"","",T(1.0)), - test_ab("'aaa' in 'aaa123'" ,"","",T(1.0)), - test_ab("'123' in 'aaa123'" ,"","",T(1.0)), - test_ab("'a123b' like '*123*'" ,"","",T(1.0)), - test_ab("'a123b' like '*123?'" ,"","",T(1.0)), - test_ab("'1XYZ2' ilike '*xyz*'" ,"","",T(1.0)), - test_ab("'1XYZ2' ilike '*xyz?'" ,"","",T(1.0)), - test_ab("inrange('aaa','bbb','ccc')" ,"","",T(1.0)), - test_ab("a == b" ,"aaa","aaa",T(1.0)), - test_ab("a != b" ,"aaa","bbb",T(1.0)), - test_ab("a < b" ,"aaa","bbb",T(1.0)), - test_ab("a <= b" ,"aaa","bbb",T(1.0)), - test_ab("b > a" ,"aaa","bbb",T(1.0)), - test_ab("b >= a" ,"aaa","bbb",T(1.0)), - test_ab("a in b" ,"aaa","aaa123",T(1.0)), - test_ab("a in b" ,"123","aaa123",T(1.0)), - test_ab("a == 'aaa'" ,"aaa","aaa",T(1.0)), - test_ab("'aaa' == a" ,"aaa","aaa",T(1.0)), - test_ab("a != 'bbb'" ,"aaa","bbb",T(1.0)), - test_ab("'bbb' != a" ,"aaa","bbb",T(1.0)), - test_ab("a < 'bbb'" ,"aaa","bbb",T(1.0)), - test_ab("a <= 'bbb'" ,"aaa","bbb",T(1.0)), - test_ab("'bbb' > a" ,"aaa","bbb",T(1.0)), - test_ab("'bbb' >= a" ,"aaa","bbb",T(1.0)), - test_ab("a in 'aaa123'" ,"aaa","aaa123",T(1.0)), - test_ab("a in 'aaa123'" ,"123","aaa123",T(1.0)), - test_ab("'aaa' in b" ,"aaa","aaa123",T(1.0)), - test_ab("'123' in b" ,"aaa","aaa123",T(1.0)), - test_ab("(a < b) or (a == b)" ,"aaa","bbb",T(1.0)), - test_ab("(a == b) or (a < b)" ,"aaa","bbb",T(1.0)), - test_ab("(b > a) or (b == a)" ,"aaa","bbb",T(1.0)), - test_ab("(b == a) or (b > a)" ,"aaa","bbb",T(1.0)), - test_ab("(a < b) and (b > a)" ,"aaa","bbb",T(1.0)), - test_ab("a like '*123*'" ,"a123b","",T(1.0)), - test_ab("a like '*123?'" ,"a123b","",T(1.0)), - test_ab("'a123b' like b" ,"a123b","*123*",T(1.0)), - test_ab("'a123b' like b" ,"a123b","*123?",T(1.0)), - test_ab("a ilike '*xyz*'" ,"1XYZ2","",T(1.0)), - test_ab("a ilike '*xyz?'" ,"1XYZ2","",T(1.0)), - test_ab("'1XYZ2' ilike b" ,"","*xyz*",T(1.0)), - test_ab("'1XYZ2' ilike b" ,"","*xyz?",T(1.0)), - test_ab("inrange(a,'bbb',c)" ,"aaa","bbb",T(1.0)), - test_ab("inrange('aaa',b,'ccc')" ,"aaa","bbb",T(1.0)), - test_ab("inrange(a,b,c)" ,"aaa","bbb",T(1.0)), - test_ab("inrange(a,b,'ccc')" ,"aaa","bbb",T(1.0)), - test_ab("inrange('aaa',b,c)" ,"aaa","bbb",T(1.0)), - test_ab("inrange('aaa',b,c)" ,"aaa","bbb",T(1.0)), - test_ab("'01234567890123456789'[0:9] == '0123456789' ","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] == '0123456789'[:] ","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] == '0123456789'[0:]","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] == '0123456789'[:9]","","",T(1.0)), - test_ab("'01234567890123456789'[:9] == '0123456789'[:9]","","",T(1.0)), - test_ab("'01234567890123456789'[10:] == '0123456789'[:] ","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] != '123456789' ","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] != '123456789'[:] ","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] != '123456789'[0:] ","","",T(1.0)), - test_ab("'01234567890123456789'[0:9] != '123456789'[:8] ","","",T(1.0)), - test_ab("'01234567890123456789'[:9] != '123456789'[:8] ","","",T(1.0)), - test_ab("'01234567890123456789'[10:] != '123456789'[:] ","","",T(1.0)), - test_ab("'01234567890123456789'[2*6:10+6] == '23456' ","","",T(1.0)), - test_ab("'0123456789' == '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'0123456789'[:] == '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'0123456789'[0:] == '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'0123456789'[:9] == '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'0123456789'[:9] == '01234567890123456789'[:9] ","","",T(1.0)), - test_ab("'0123456789'[:] == '01234567890123456789'[10:]","","",T(1.0)), - test_ab("'0123456789'[3:3] == '3'[:] ","","",T(1.0)), - test_ab("'0123456789'[3:3] == '3'[0:0] ","","",T(1.0)), - test_ab("'123456789' != '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'123456789'[:] != '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'123456789'[0:] != '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'123456789'[:8] != '01234567890123456789'[0:9]","","",T(1.0)), - test_ab("'123456789'[:8] != '01234567890123456789'[:9] ","","",T(1.0)), - test_ab("'123456789'[:] != '01234567890123456789'[10:]","","",T(1.0)), - test_ab("'23456' == '01234567890123456789'[2*6:10+6] ","","",T(1.0)), - test_ab("'01234567890123456789'[r0: 6] == '23456' ","","",T(1.0)), - test_ab("'01234567890123456789'[2: r1] == '23456' ","","",T(1.0)), - test_ab("'01234567890123456789'[r0:3*2] == '23456' ","","",T(1.0)), - test_ab("'01234567890123456789'[1+1:r1] == '23456' ","","",T(1.0)), - test_ab("'01234567890123456789'[r0: ] == '234567890123456789' ","","",T(1.0)), - test_ab("'01234567890123456789'[: r1] == '0123456' ","","",T(1.0)), - test_ab("'01234567890123456789'[r0:r1] == '23456' ","","",T(1.0)), - test_ab("'01234567890123456789'[r0:r1+2] == '2345678' ","","",T(1.0)), - test_ab("'01234567890123456789'[r0+2:r1] == '456' ","","",T(1.0)), - test_ab("'01234567890123456789'[r1-r0:] == '4567890123456789' ","","",T(1.0)), - test_ab("'01234567890123456789'[:r1-r0] == '01234' ","","",T(1.0)), - test_ab("'23456' == '01234567890123456789'[r0: 6] ","","",T(1.0)), - test_ab("'23456' == '01234567890123456789'[2: r1] ","","",T(1.0)), - test_ab("'23456' == '01234567890123456789'[r0:3*2] ","","",T(1.0)), - test_ab("'23456' == '01234567890123456789'[1+1:r1] ","","",T(1.0)), - test_ab("'234567890123456789' == '01234567890123456789'[r0: ] ","","",T(1.0)), - test_ab("'0123456' == '01234567890123456789'[: r1] ","","",T(1.0)), - test_ab("'23456' == '01234567890123456789'[r0:r1] ","","",T(1.0)), - test_ab("'2345678' == '01234567890123456789'[r0:r1+2] ","","",T(1.0)), - test_ab("'456' == '01234567890123456789'[r0+2:r1] ","","",T(1.0)), - test_ab("'4567890123456789' == '01234567890123456789'[r1-r0:] ","","",T(1.0)), - test_ab("'01234' == '01234567890123456789'[:r1-r0] ","","",T(1.0)), - test_ab("a[r0: 6] == '23456' ","01234567890123456789","",T(1.0)), - test_ab("a[2: r1] == '23456' ","01234567890123456789","",T(1.0)), - test_ab("a[r0:3*2] == '23456' ","01234567890123456789","",T(1.0)), - test_ab("a[1+1:r1] == '23456' ","01234567890123456789","",T(1.0)), - test_ab("a[r0: ] == '234567890123456789' ","01234567890123456789","",T(1.0)), - test_ab("a[: r1] == '0123456' ","01234567890123456789","",T(1.0)), - test_ab("a[r0:r1] == '23456' ","01234567890123456789","",T(1.0)), - test_ab("a[r0:r1+2] == '2345678' ","01234567890123456789","",T(1.0)), - test_ab("a[r0+2:r1] == '456' ","01234567890123456789","",T(1.0)), - test_ab("a[r1-r0:] == '4567890123456789' ","01234567890123456789","",T(1.0)), - test_ab("a[:r1-r0] == '01234' ","01234567890123456789","",T(1.0)), - test_ab("'23456' == a[r0: 6] ","01234567890123456789","",T(1.0)), - test_ab("'23456' == a[2: r1] ","01234567890123456789","",T(1.0)), - test_ab("'23456' == a[r0:3*2] ","01234567890123456789","",T(1.0)), - test_ab("'23456' == a[1+1:r1] ","01234567890123456789","",T(1.0)), - test_ab("'234567890123456789' == a[r0: ] ","01234567890123456789","",T(1.0)), - test_ab("'0123456' == a[: r1] ","01234567890123456789","",T(1.0)), - test_ab("'23456' == a[r0:r1] ","01234567890123456789","",T(1.0)), - test_ab("'2345678' == a[r0:r1+2] ","01234567890123456789","",T(1.0)), - test_ab("'456' == a[r0+2:r1] ","01234567890123456789","",T(1.0)), - test_ab("'4567890123456789' == a[r1-r0:] ","01234567890123456789","",T(1.0)), - test_ab("'01234' == a[:r1-r0] ","01234567890123456789","",T(1.0)), - test_ab("a[r0: 6] == b ","01234567890123456789","23456",T(1.0)), - test_ab("a[2: r1] == b ","01234567890123456789","23456",T(1.0)), - test_ab("a[r0:3*2] == b ","01234567890123456789","23456",T(1.0)), - test_ab("a[1+1:r1] == b ","01234567890123456789","23456",T(1.0)), - test_ab("a[r0: ] == b ","01234567890123456789","234567890123456789",T(1.0)), - test_ab("a[: r1] == b ","01234567890123456789","0123456",T(1.0)), - test_ab("a[r0:r1] == b ","01234567890123456789","23456",T(1.0)), - test_ab("a[r0:r1+2] == b ","01234567890123456789","2345678",T(1.0)), - test_ab("a[r0+2:r1] == b ","01234567890123456789","456",T(1.0)), - test_ab("a[r1-r0:] == b ","01234567890123456789","4567890123456789",T(1.0)), - test_ab("a[:r1-r0] == b ","01234567890123456789","01234",T(1.0)), - test_ab("b == a[r0: 6] ","01234567890123456789","23456",T(1.0)), - test_ab("b == a[2: r1] ","01234567890123456789","23456",T(1.0)), - test_ab("b == a[r0:3*2] ","01234567890123456789","23456",T(1.0)), - test_ab("b == a[1+1:r1] ","01234567890123456789","23456",T(1.0)), - test_ab("b == a[r0: ] ","01234567890123456789","234567890123456789",T(1.0)), - test_ab("b == a[: r1] ","01234567890123456789","0123456",T(1.0)), - test_ab("b == a[r0:r1] ","01234567890123456789","23456",T(1.0)), - test_ab("b == a[r0:r1+2] ","01234567890123456789","2345678",T(1.0)), - test_ab("b == a[r0+2:r1] ","01234567890123456789","456",T(1.0)), - test_ab("b == a[r1-r0:] ","01234567890123456789","4567890123456789",T(1.0)), - test_ab("b == a[:r1-r0] ","01234567890123456789","01234",T(1.0)), - test_ab("'01234567890123456789'[0:9] == a ","0123456789","",T(1.0)), - test_ab("'01234567890123456789'[0:9] == a[:] ","0123456789","",T(1.0)), - test_ab("'01234567890123456789'[0:9] == a[0:] ","0123456789","",T(1.0)), - test_ab("'01234567890123456789'[0:9] == a[:9] ","0123456789","",T(1.0)), - test_ab("'01234567890123456789'[:9] == a[:9] ","0123456789","",T(1.0)), - test_ab("'01234567890123456789'[10:] == a[:] ","0123456789","",T(1.0)), - test_ab("'01234567890123456789'[0:9] != a ","123456789" ,"",T(1.0)), - test_ab("'01234567890123456789'[0:9] != a[:] ","123456789" ,"",T(1.0)), - test_ab("'01234567890123456789'[0:9] != a[0:] ","123456789" ,"",T(1.0)), - test_ab("'01234567890123456789'[0:9] != a[:8] ","123456789" ,"",T(1.0)), - test_ab("'01234567890123456789'[:9] != a[:8] ","123456789" ,"",T(1.0)), - test_ab("'01234567890123456789'[10:] != a[:] ","123456789" ,"",T(1.0)), - test_ab("'01234567890123456789'[2*6:10+6] == a","23456" ,"",T(1.0)), - test_ab("'23456' == a[:] ","23456" ,"",T(1.0)), - test_ab("a == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), - test_ab("a[:] == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), - test_ab("a[0:] == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), - test_ab("a[:9] == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), - test_ab("a[:9] == '01234567890123456789'[:9] ","0123456789","",T(1.0)), - test_ab("a[:] == '01234567890123456789'[10:] ","0123456789","",T(1.0)), - test_ab("a != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), - test_ab("a[:] != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), - test_ab("a[0:] != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), - test_ab("a[:8] != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), - test_ab("a[:8] != '01234567890123456789'[:9] ","123456789" ,"",T(1.0)), - test_ab("a[:] != '01234567890123456789'[10:] ","123456789" ,"",T(1.0)), - test_ab("a == '01234567890123456789'[2*6:10+6]","23456" ,"",T(1.0)), - test_ab("a[:] == '23456' ","23456" ,"",T(1.0)), - test_ab("a[0:9] == b ","01234567890123456789","0123456789",T(1.0)), - test_ab("a[0:9] == b[:] ","01234567890123456789","0123456789",T(1.0)), - test_ab("a[0:9] == b[0:] ","01234567890123456789","0123456789",T(1.0)), - test_ab("a[0:9] == b[:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("a[:9] == b[:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("a[10:] == b[:] ","01234567890123456789","0123456789",T(1.0)), - test_ab("a[0:9] != b ","01234567890123456789","123456789" ,T(1.0)), - test_ab("a[0:9] != b[:] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("a[0:9] != b[0:] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("a[0:9] != b[:8] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("a[:9] != b[:8] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("a[10:] != b[:] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("a[2*6:10+6] == b ","01234567890123456789","23456" ,T(1.0)), - test_ab("b == a[0:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("b[:] == a[0:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("b[0:] == a[0:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("b[:9] == a[0:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("b[:9] == a[:9] ","01234567890123456789","0123456789",T(1.0)), - test_ab("b[:] == a[10:] ","01234567890123456789","0123456789",T(1.0)), - test_ab("b != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("b[:] != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("b[0:] != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("b[:8] != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("b[:8] != a[:9] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("b[:] != a[10:] ","01234567890123456789","123456789" ,T(1.0)), - test_ab("b == a[2*6:10+6] ","01234567890123456789","23456" ,T(1.0)), - test_ab("a[2:6] == b" ,"0123456789","23456" ,T(1.0)), - test_ab("a == b[2:6]" ,"23456","0123456789" ,T(1.0)), - test_ab("a[1+1:2*3] == b" ,"0123456789","23456" ,T(1.0)), - test_ab("a == b[4/2:sqrt(36)]","23456","0123456789" ,T(1.0)), - test_ab("a[0:6] == b" ,"0123456789","0123456",T(1.0)), - test_ab("a[:6] == b" ,"0123456789","0123456",T(1.0)), - test_ab("a[4/2-2:2+4] == b" ,"0123456789","0123456",T(1.0)), - test_ab("a[:12/2] == b" ,"0123456789","0123456",T(1.0)), - test_ab("a[0:] == b" ,"0123456","0123456" ,T(1.0)), - test_ab("a[:] == b" ,"0123456","0123456" ,T(1.0)), - test_ab("a == b[0:6]" ,"0123456","0123456789",T(1.0)), - test_ab("a == b[:6]" ,"0123456","0123456789",T(1.0)), - test_ab("a == b[4/2-2:2+4]" ,"0123456","0123456789",T(1.0)), - test_ab("a == b[:12/2]" ,"0123456","0123456789",T(1.0)), - test_ab("a == b[0:]" ,"0123456","0123456" ,T(1.0)), - test_ab("a == b[:]" ,"0123456","0123456" ,T(1.0)), - test_ab("a[:9] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), - test_ab("a[0:9] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), - test_ab("a[0:] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), - test_ab("a[:] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), - test_ab("a[:] == b[10:]" ,"0123456789","01234567890123456789",T(1.0)), - test_ab("'!@#$%^&*([{}])-=' != ')]}{[(*&^%$#@!'","","",T(1.0)), - test_ab("('!@#$%^&*([{}])-=') != (')]}{[(*&^%$#@!')","","",T(1.0)), - test_ab("{[('a')]} == [{('a')}]","","",T(1.0)), - test_ab("{[('!@#$%^&*([{}])-=')]} != [{(')]}{[(*&^%$#@!')}]","","",T(1.0)), - test_ab("'!@#$%^&*([{}])-=' == '!@#$%^&*([{}])-='","","",T(1.0)), - test_ab("('!@#$%^&*([{}])-=') == ('!@#$%^&*([{}])-=')","","",T(1.0)), - test_ab("{[('!@#$%^&*([{}])-=')]} == [{('!@#$%^&*([{}])-=')}]","","",T(1.0)), - test_ab("'1234\\\\abc\nxyz\r890\tqaz\\'567' == a","1234\\abc\nxyz\r890\tqaz'567","",T(1.0)), - test_ab("a == '1234\\\\abc\nxyz\r890\tqaz\\'567'","1234\\abc\nxyz\r890\tqaz'567","",T(1.0)), - test_ab("'123'[] == 3" ,"","" ,T(1.0)), - test_ab("3 == '123'[]" ,"","" ,T(1.0)), - test_ab("'123'[] + '1234'[] == 7" ,"","" ,T(1.0)), - test_ab("abs('123'[] - '1234'[]) == 1" ,"","" ,T(1.0)), - test_ab("'1234'[] == a[]" ,"1234","" ,T(1.0)), - test_ab("'123'[] + a[] == 7" ,"1234","" ,T(1.0)), - test_ab("abs(a[] - '12345'[]) == 1" ,"1234","" ,T(1.0)), - test_ab("'1234'[] + '12345'[] == a[] + b[]" ,"1234","12345" ,T(1.0)), - test_ab("abs('123'[] -'1234'[]) == abs(a[] - b[])" ,"1234","12345",T(1.0)), - test_ab("(a + b) == 'abc123' ","abc","123" ,T(1.0)), - test_ab("(a + '123') == 'abc123' ","abc","123" ,T(1.0)), - test_ab("('abc' + b) == 'abc123' ","abc","123" ,T(1.0)), - test_ab("(a + '1') == 'abc1' ","abc","123" ,T(1.0)), - test_ab("('a' + b) == 'a123' ","abc","123" ,T(1.0)), - test_ab("(a[2:7] + b) == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), - test_ab("(a + b[2:7]) == 'abc234567' ","abc","0123456789" ,T(1.0)), - test_ab("(a[2:7] + '0123') == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), - test_ab("('abc' + b[2:7]) == 'abc234567' ","abc","0123456789" ,T(1.0)), - test_ab("(a[2:2] + b[3:3]) == 'c3' ","abc","0123456789" ,T(1.0)), - test_ab("(a[3:] + b) == 'defghij0123' ","abcdefghij","0123",T(1.0)), - test_ab("('abc' + b[:7]) == 'abc01234567' ","abc","0123456789" ,T(1.0)), - test_ab("a + '123' == 'abc'+ b ","abc" , "123" , T(1.0)), - test_ab("a[0:2] + '123' == 'abc' + b[0:2] ","abcXYZ", "123XYZ", T(1.0)), - test_ab("a[ :2] + '123' == 'abc' + b[ :2] ","abcXYZ", "123XYZ", T(1.0)), - test_ab("a[3: ] + '123' == 'abc' + b[3: ]","XYZabc", "XYZ123", T(1.0)), - test_ab("a[3:a[] - 1] + '123' == 'abc' + b[3:b[] - 1]","XYZabc", "XYZ123", T(1.0)), - test_ab("(a[r0:r2] + b) == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), - test_ab("(a + b[r0:r2]) == 'abc234567' ","abc","0123456789" ,T(1.0)), - test_ab("(a[r0:r2] + '0123') == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), - test_ab("('abc' + b[r0:r2]) == 'abc234567' ","abc","0123456789" ,T(1.0)), - test_ab("(a[r0:r0] + b[r3:r3]) == 'c3' ","abc","0123456789" ,T(1.0)), - test_ab("(a[r3:] + b) == 'defghij0123' ","abcdefghij","0123",T(1.0)), - test_ab("('abc' + b[:r2]) == 'abc01234567' ","abc","0123456789" ,T(1.0)), - test_ab("a[0:r0] + '123' == 'abc' + b[0:r0] ","abcXYZ", "123XYZ", T(1.0)), - test_ab("a[ :r0] + '123' == 'abc' + b[ :r0] ","abcXYZ", "123XYZ", T(1.0)), - test_ab("a[r3: ] + '123' == 'abc' + b[r3: ]","XYZabc", "XYZ123", T(1.0)), - test_ab("a[r3:a[] - 1] + '123' == 'abc' + b[r3:b[] - 1]","XYZabc", "XYZ123", T(1.0)), - test_ab("(a[r0:r0] + b[r3:r0+1]) == 'c3' ","abc","0123456789" ,T(1.0)), - test_ab("(a[r0+1:] + b) == 'defghij0123' ","abcdefghij","0123",T(1.0)), - test_ab("a[r0+1: ] + '123' == 'abc' + b[r0+1: ]","XYZabc", "XYZ123", T(1.0)), - test_ab("a[r0+1:a[] - 1] + '123' == 'abc' + b[r0+1:b[] - 1]","XYZabc", "XYZ123", T(1.0)), - test_ab("(a + b)[ :13] == 'abcdefghij0123' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[ 6: ] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[ 2:3r1-1] == 'cdefghij01234567' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a[2:7] + b[2:7]) == 'cdefgh234567' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a[2:7] + b[2:7])[3:8] == 'fgh234' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[r0 - 2: r1 + r2] == 'abcdefghij0123' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[r0*r3:] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[3r0: ] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[2r3: ] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a + b)[2:3r1 - 1] == 'cdefghij01234567' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a[r0:7] + b[r0:r2])== 'cdefgh234567' ", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a[r1 / r3:7] + b[r0:r2])[3:r2 + 1] == 'fgh234'", "abcdefghij", "0123456789" ,T(1.0)), - test_ab("(a += b) == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += '123') == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += b[3:5]) == 'abc123' ", "abc","XXX123XXX" ,T(1.0)), - test_ab("(a += 'XXX123XXX'[3:5]) == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += b)[:] == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += '123')[:] == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += b[3:5])[:] == 'abc123' ", "abc","XXX123XXX" ,T(1.0)), - test_ab("(a += 'XXX123XXX'[3:5])[:] == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += b[r1/2:r1-1]) == 'abc123' ", "abc","XXX123XXX" ,T(1.0)), - test_ab("(a += 'XXX123XXX'[r0+1:r1-1]) == 'abc123' ", "abc","123" ,T(1.0)), - test_ab("(a += b)[] == 6 ", "abc","123" ,T(1.0)), - test_ab("(a += '123')[] == 6 ", "abc","123" ,T(1.0)), - test_ab("(a += b[3:5])[] == 6 ", "abc","XXX123XXX" ,T(1.0)), - test_ab("(a += b[r0+1:r1-1])[] == 6 ", "abc","XXX123XXX" ,T(1.0)), - test_ab("(a + b)[:][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[:][:][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[:][:][:][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[:][:][:][:][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[:][:][:][:][:][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[:][:][:][:][:][:][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[:][:][:][:][:][:][:][]== 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5] == 'abc123' ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][1:4] == 'bc12' ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][1:4][1:2] == 'c1' ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][1:4][1:2][0:0] == 'c' ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][] == 6 ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][1:4][] == 4 ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][1:4][1:2][] == 2 ","abc","123" ,T(1.0)), - test_ab("(a + b)[0:5][1:4][1:2][0:0][] == 1 ","abc","123" ,T(1.0)), - test_ab("(a[ : ] := b); (a == 'ABCDEFGHIJ');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[0: ] := b); (a == 'ABCDEFGHIJ');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[ :9] := b); (a == 'ABCDEFGHIJ');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[3:7] := b); (a == '012ABCDE89');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[2:8] := b); (a == '01ABCDEFG9');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[1:9] := b); (a == '0ABCDEFGHI');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[0:0] := b); (a == 'A123456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[1:1] := b); (a == '0A23456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[2:2] := b); (a == '01A3456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[3:3] := b); (a == '012A456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[4:4] := b); (a == '0123A56789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[5:5] := b); (a == '01234A6789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[6:6] := b); (a == '012345A789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[7:7] := b); (a == '0123456A89');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[8:8] := b); (a == '01234567A9');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[9:9] := b); (a == '012345678A');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[0:1] := b); (a == 'AB23456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[1:2] := b); (a == '0AB3456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[2:3] := b); (a == '01AB456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[3:4] := b); (a == '012AB56789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[4:5] := b); (a == '0123AB6789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[5:6] := b); (a == '01234AB789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[6:7] := b); (a == '012345AB89');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[7:8] := b); (a == '0123456AB9');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[8:9] := b); (a == '01234567AB');", "0123456789","ABCDEFGHIJ" ,T(1.0)), - test_ab("(a[ : ] := b[3:b[] - 3]); (a == 'ABCDEFGHIJ');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[0: ] := b[3:b[] - 3]); (a == 'ABCDEFGHIJ');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[ :9] := b[3:b[] - 3]); (a == 'ABCDEFGHIJ');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[3:7] := b[3:b[] - 3]); (a == '012ABCDE89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[2:8] := b[3:b[] - 3]); (a == '01ABCDEFG9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[1:9] := b[3:b[] - 3]); (a == '0ABCDEFGHI');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[0:0] := b[3:b[] - 3]); (a == 'A123456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[1:1] := b[3:b[] - 3]); (a == '0A23456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[2:2] := b[3:b[] - 3]); (a == '01A3456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[3:3] := b[3:b[] - 3]); (a == '012A456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[4:4] := b[3:b[] - 3]); (a == '0123A56789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[5:5] := b[3:b[] - 3]); (a == '01234A6789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[6:6] := b[3:b[] - 3]); (a == '012345A789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[7:7] := b[3:b[] - 3]); (a == '0123456A89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[8:8] := b[3:b[] - 3]); (a == '01234567A9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[9:9] := b[3:b[] - 3]); (a == '012345678A');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[0:1] := b[3:b[] - 3]); (a == 'AB23456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[1:2] := b[3:b[] - 3]); (a == '0AB3456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[2:3] := b[3:b[] - 3]); (a == '01AB456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[3:4] := b[3:b[] - 3]); (a == '012AB56789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[4:5] := b[3:b[] - 3]); (a == '0123AB6789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[5:6] := b[3:b[] - 3]); (a == '01234AB789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[6:7] := b[3:b[] - 3]); (a == '012345AB89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[7:8] := b[3:b[] - 3]); (a == '0123456AB9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[8:9] := b[3:b[] - 3]); (a == '01234567AB');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[0:9] := b); (a == 'A123456789');", "0123456789","A" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'AB23456789');", "0123456789","AB" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABC3456789');", "0123456789","ABC" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABCD456789');", "0123456789","ABCD" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABCDE56789');", "0123456789","ABCDE" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABCDEF6789');", "0123456789","ABCDEF" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABCDEFG789');", "0123456789","ABCDEFG" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABCDEFGH89');", "0123456789","ABCDEFGH" ,T(1.0)), - test_ab("(a[0:9] := b); (a == 'ABCDEFGHI9');", "0123456789","ABCDEFGHI" ,T(1.0)), - test_ab("(a[3:9] := b); (a == '012A456789');", "0123456789","A" ,T(1.0)), - test_ab("(a[3:9] := b); (a == '012AB56789');", "0123456789","AB" ,T(1.0)), - test_ab("(a[3:9] := b); (a == '012ABC6789');", "0123456789","ABC" ,T(1.0)), - test_ab("(a[3:9] := b); (a == '012ABCD789');", "0123456789","ABCD" ,T(1.0)), - test_ab("(a[3:9] := b); (a == '012ABCDE89');", "0123456789","ABCDE" ,T(1.0)), - test_ab("(a[3:9] := b); (a == '012ABCDEF9');", "0123456789","ABCDEF" ,T(1.0)), - test_ab("(a[r1 / r0:r2] := b[3:b[] - r3]); (a == '012ABCDE89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("(a[r0:r2 + 1] := b[r3:b[] - r3]); (a == '01ABCDEFG9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), - test_ab("'\\0x30\\0x31\\0x32\\0x33\\0x34\\0x35\\0x36\\0x37\\0x38\\0x39' == '0123456789'","","",T(1.0)), - test_ab("'abc\\0x30\\0x31\\0x32\\0x33xyz' == 'abc0123xyz'" ,"","",T(1.0)), - test_ab("'\\0x30\\n\\0x31\\n\\0x32\\n\\0x33' == '0\\n1\\n2\\n3'" ,"","",T(1.0)), - test_ab("('\\0x30' + '') == '0'" ,"","",T(1.0)), - test_ab("('\\0x30' + '\\0x31\\0x32') == '012'" ,"","",T(1.0)), - test_ab("('\\0x30' + '\\0x31\\0x32' + '\\0x33\\0x34\\0x35') == '012345'" ,"","",T(1.0)) + test_ab("'aaa' == 'aaa'" ,"","",T(1.0)), + test_ab("'aaa' < 'bbb'" ,"","",T(1.0)), + test_ab("'aaa' <= 'bbb'" ,"","",T(1.0)), + test_ab("'bbb' > 'aaa'" ,"","",T(1.0)), + test_ab("'bbb' >= 'aaa'" ,"","",T(1.0)), + test_ab("'aaa' != 'aaa'" ,"","",T(0.0)), + test_ab("'aaa' != 'bbb'" ,"","",T(1.0)), + test_ab("'aaa' + '123' == 'aaa123'" ,"","",T(1.0)), + test_ab("'aaa123' == 'aaa' + '123'" ,"","",T(1.0)), + test_ab("('aaa' + '123') == 'aaa123'" ,"","",T(1.0)), + test_ab("'aaa123' == ('aaa' + '123')" ,"","",T(1.0)), + test_ab("'aaa' in 'aaa123'" ,"","",T(1.0)), + test_ab("'123' in 'aaa123'" ,"","",T(1.0)), + test_ab("'a123b' like '*123*'" ,"","",T(1.0)), + test_ab("'a123b' like '*123?'" ,"","",T(1.0)), + test_ab("'1XYZ2' ilike '*xyz*'" ,"","",T(1.0)), + test_ab("'1XYZ2' ilike '*xyz?'" ,"","",T(1.0)), + test_ab("inrange('aaa','bbb','ccc')" ,"","",T(1.0)), + test_ab("a == b" ,"aaa","aaa",T(1.0)), + test_ab("a != b" ,"aaa","bbb",T(1.0)), + test_ab("a < b" ,"aaa","bbb",T(1.0)), + test_ab("a <= b" ,"aaa","bbb",T(1.0)), + test_ab("b > a" ,"aaa","bbb",T(1.0)), + test_ab("b >= a" ,"aaa","bbb",T(1.0)), + test_ab("a in b" ,"aaa","aaa123",T(1.0)), + test_ab("a in b" ,"123","aaa123",T(1.0)), + test_ab("a == 'aaa'" ,"aaa","aaa",T(1.0)), + test_ab("'aaa' == a" ,"aaa","aaa",T(1.0)), + test_ab("a != 'bbb'" ,"aaa","bbb",T(1.0)), + test_ab("'bbb' != a" ,"aaa","bbb",T(1.0)), + test_ab("a < 'bbb'" ,"aaa","bbb",T(1.0)), + test_ab("a <= 'bbb'" ,"aaa","bbb",T(1.0)), + test_ab("'bbb' > a" ,"aaa","bbb",T(1.0)), + test_ab("'bbb' >= a" ,"aaa","bbb",T(1.0)), + test_ab("a in 'aaa123'" ,"aaa","aaa123",T(1.0)), + test_ab("a in 'aaa123'" ,"123","aaa123",T(1.0)), + test_ab("'aaa' in b" ,"aaa","aaa123",T(1.0)), + test_ab("'123' in b" ,"aaa","aaa123",T(1.0)), + test_ab("(a < b) or (a == b)" ,"aaa","bbb",T(1.0)), + test_ab("(a == b) or (a < b)" ,"aaa","bbb",T(1.0)), + test_ab("(b > a) or (b == a)" ,"aaa","bbb",T(1.0)), + test_ab("(b == a) or (b > a)" ,"aaa","bbb",T(1.0)), + test_ab("(a < b) and (b > a)" ,"aaa","bbb",T(1.0)), + test_ab("a like '*123*'" ,"a123b","",T(1.0)), + test_ab("a like '*123?'" ,"a123b","",T(1.0)), + test_ab("'a123b' like b" ,"a123b","*123*",T(1.0)), + test_ab("'a123b' like b" ,"a123b","*123?",T(1.0)), + test_ab("a ilike '*xyz*'" ,"1XYZ2","",T(1.0)), + test_ab("a ilike '*xyz?'" ,"1XYZ2","",T(1.0)), + test_ab("'1XYZ2' ilike b" ,"","*xyz*",T(1.0)), + test_ab("'1XYZ2' ilike b" ,"","*xyz?",T(1.0)), + test_ab("inrange(a,'bbb',c)" ,"aaa","bbb",T(1.0)), + test_ab("inrange('aaa',b,'ccc')" ,"aaa","bbb",T(1.0)), + test_ab("inrange(a,b,c)" ,"aaa","bbb",T(1.0)), + test_ab("inrange(a,b,'ccc')" ,"aaa","bbb",T(1.0)), + test_ab("inrange('aaa',b,c)" ,"aaa","bbb",T(1.0)), + test_ab("inrange('aaa',b,c)" ,"aaa","bbb",T(1.0)), + test_ab("'01234567890123456789'[0:9] == '0123456789' ","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] == '0123456789'[:] ","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] == '0123456789'[0:]","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] == '0123456789'[:9]","","",T(1.0)), + test_ab("'01234567890123456789'[:9] == '0123456789'[:9]","","",T(1.0)), + test_ab("'01234567890123456789'[10:] == '0123456789'[:] ","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] != '123456789' ","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] != '123456789'[:] ","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] != '123456789'[0:] ","","",T(1.0)), + test_ab("'01234567890123456789'[0:9] != '123456789'[:8] ","","",T(1.0)), + test_ab("'01234567890123456789'[:9] != '123456789'[:8] ","","",T(1.0)), + test_ab("'01234567890123456789'[10:] != '123456789'[:] ","","",T(1.0)), + test_ab("'01234567890123456789'[2*6:10+6] == '23456' ","","",T(1.0)), + test_ab("'0123456789' == '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'0123456789'[:] == '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'0123456789'[0:] == '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'0123456789'[:9] == '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'0123456789'[:9] == '01234567890123456789'[:9] ","","",T(1.0)), + test_ab("'0123456789'[:] == '01234567890123456789'[10:]","","",T(1.0)), + test_ab("'0123456789'[3:3] == '3'[:] ","","",T(1.0)), + test_ab("'0123456789'[3:3] == '3'[0:0] ","","",T(1.0)), + test_ab("'123456789' != '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'123456789'[:] != '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'123456789'[0:] != '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'123456789'[:8] != '01234567890123456789'[0:9]","","",T(1.0)), + test_ab("'123456789'[:8] != '01234567890123456789'[:9] ","","",T(1.0)), + test_ab("'123456789'[:] != '01234567890123456789'[10:]","","",T(1.0)), + test_ab("'23456' == '01234567890123456789'[2*6:10+6] ","","",T(1.0)), + test_ab("'01234567890123456789'[r0: 6] == '23456' ","","",T(1.0)), + test_ab("'01234567890123456789'[2: r1] == '23456' ","","",T(1.0)), + test_ab("'01234567890123456789'[r0:3*2] == '23456' ","","",T(1.0)), + test_ab("'01234567890123456789'[1+1:r1] == '23456' ","","",T(1.0)), + test_ab("'01234567890123456789'[r0: ] == '234567890123456789' ","","",T(1.0)), + test_ab("'01234567890123456789'[: r1] == '0123456' ","","",T(1.0)), + test_ab("'01234567890123456789'[r0:r1] == '23456' ","","",T(1.0)), + test_ab("'01234567890123456789'[r0:r1+2] == '2345678' ","","",T(1.0)), + test_ab("'01234567890123456789'[r0+2:r1] == '456' ","","",T(1.0)), + test_ab("'01234567890123456789'[r1-r0:] == '4567890123456789' ","","",T(1.0)), + test_ab("'01234567890123456789'[:r1-r0] == '01234' ","","",T(1.0)), + test_ab("'23456' == '01234567890123456789'[r0: 6] ","","",T(1.0)), + test_ab("'23456' == '01234567890123456789'[2: r1] ","","",T(1.0)), + test_ab("'23456' == '01234567890123456789'[r0:3*2] ","","",T(1.0)), + test_ab("'23456' == '01234567890123456789'[1+1:r1] ","","",T(1.0)), + test_ab("'234567890123456789' == '01234567890123456789'[r0: ] ","","",T(1.0)), + test_ab("'0123456' == '01234567890123456789'[: r1] ","","",T(1.0)), + test_ab("'23456' == '01234567890123456789'[r0:r1] ","","",T(1.0)), + test_ab("'2345678' == '01234567890123456789'[r0:r1+2] ","","",T(1.0)), + test_ab("'456' == '01234567890123456789'[r0+2:r1] ","","",T(1.0)), + test_ab("'4567890123456789' == '01234567890123456789'[r1-r0:] ","","",T(1.0)), + test_ab("'01234' == '01234567890123456789'[:r1-r0] ","","",T(1.0)), + test_ab("a[r0: 6] == '23456' ","01234567890123456789","",T(1.0)), + test_ab("a[2: r1] == '23456' ","01234567890123456789","",T(1.0)), + test_ab("a[r0:3*2] == '23456' ","01234567890123456789","",T(1.0)), + test_ab("a[1+1:r1] == '23456' ","01234567890123456789","",T(1.0)), + test_ab("a[r0: ] == '234567890123456789' ","01234567890123456789","",T(1.0)), + test_ab("a[: r1] == '0123456' ","01234567890123456789","",T(1.0)), + test_ab("a[r0:r1] == '23456' ","01234567890123456789","",T(1.0)), + test_ab("a[r0:r1+2] == '2345678' ","01234567890123456789","",T(1.0)), + test_ab("a[r0+2:r1] == '456' ","01234567890123456789","",T(1.0)), + test_ab("a[r1-r0:] == '4567890123456789' ","01234567890123456789","",T(1.0)), + test_ab("a[:r1-r0] == '01234' ","01234567890123456789","",T(1.0)), + test_ab("'23456' == a[r0: 6] ","01234567890123456789","",T(1.0)), + test_ab("'23456' == a[2: r1] ","01234567890123456789","",T(1.0)), + test_ab("'23456' == a[r0:3*2] ","01234567890123456789","",T(1.0)), + test_ab("'23456' == a[1+1:r1] ","01234567890123456789","",T(1.0)), + test_ab("'234567890123456789' == a[r0: ] ","01234567890123456789","",T(1.0)), + test_ab("'0123456' == a[: r1] ","01234567890123456789","",T(1.0)), + test_ab("'23456' == a[r0:r1] ","01234567890123456789","",T(1.0)), + test_ab("'2345678' == a[r0:r1+2] ","01234567890123456789","",T(1.0)), + test_ab("'456' == a[r0+2:r1] ","01234567890123456789","",T(1.0)), + test_ab("'4567890123456789' == a[r1-r0:] ","01234567890123456789","",T(1.0)), + test_ab("'01234' == a[:r1-r0] ","01234567890123456789","",T(1.0)), + test_ab("a[r0: 6] == b ","01234567890123456789","23456",T(1.0)), + test_ab("a[2: r1] == b ","01234567890123456789","23456",T(1.0)), + test_ab("a[r0:3*2] == b ","01234567890123456789","23456",T(1.0)), + test_ab("a[1+1:r1] == b ","01234567890123456789","23456",T(1.0)), + test_ab("a[r0: ] == b ","01234567890123456789","234567890123456789",T(1.0)), + test_ab("a[: r1] == b ","01234567890123456789","0123456",T(1.0)), + test_ab("a[r0:r1] == b ","01234567890123456789","23456",T(1.0)), + test_ab("a[r0:r1+2] == b ","01234567890123456789","2345678",T(1.0)), + test_ab("a[r0+2:r1] == b ","01234567890123456789","456",T(1.0)), + test_ab("a[r1-r0:] == b ","01234567890123456789","4567890123456789",T(1.0)), + test_ab("a[:r1-r0] == b ","01234567890123456789","01234",T(1.0)), + test_ab("b == a[r0: 6] ","01234567890123456789","23456",T(1.0)), + test_ab("b == a[2: r1] ","01234567890123456789","23456",T(1.0)), + test_ab("b == a[r0:3*2] ","01234567890123456789","23456",T(1.0)), + test_ab("b == a[1+1:r1] ","01234567890123456789","23456",T(1.0)), + test_ab("b == a[r0: ] ","01234567890123456789","234567890123456789",T(1.0)), + test_ab("b == a[: r1] ","01234567890123456789","0123456",T(1.0)), + test_ab("b == a[r0:r1] ","01234567890123456789","23456",T(1.0)), + test_ab("b == a[r0:r1+2] ","01234567890123456789","2345678",T(1.0)), + test_ab("b == a[r0+2:r1] ","01234567890123456789","456",T(1.0)), + test_ab("b == a[r1-r0:] ","01234567890123456789","4567890123456789",T(1.0)), + test_ab("b == a[:r1-r0] ","01234567890123456789","01234",T(1.0)), + test_ab("'01234567890123456789'[0:9] == a ","0123456789","",T(1.0)), + test_ab("'01234567890123456789'[0:9] == a[:] ","0123456789","",T(1.0)), + test_ab("'01234567890123456789'[0:9] == a[0:] ","0123456789","",T(1.0)), + test_ab("'01234567890123456789'[0:9] == a[:9] ","0123456789","",T(1.0)), + test_ab("'01234567890123456789'[:9] == a[:9] ","0123456789","",T(1.0)), + test_ab("'01234567890123456789'[10:] == a[:] ","0123456789","",T(1.0)), + test_ab("'01234567890123456789'[0:9] != a ","123456789" ,"",T(1.0)), + test_ab("'01234567890123456789'[0:9] != a[:] ","123456789" ,"",T(1.0)), + test_ab("'01234567890123456789'[0:9] != a[0:] ","123456789" ,"",T(1.0)), + test_ab("'01234567890123456789'[0:9] != a[:8] ","123456789" ,"",T(1.0)), + test_ab("'01234567890123456789'[:9] != a[:8] ","123456789" ,"",T(1.0)), + test_ab("'01234567890123456789'[10:] != a[:] ","123456789" ,"",T(1.0)), + test_ab("'01234567890123456789'[2*6:10+6] == a","23456" ,"",T(1.0)), + test_ab("'23456' == a[:] ","23456" ,"",T(1.0)), + test_ab("a == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), + test_ab("a[:] == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), + test_ab("a[0:] == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), + test_ab("a[:9] == '01234567890123456789'[0:9] ","0123456789","",T(1.0)), + test_ab("a[:9] == '01234567890123456789'[:9] ","0123456789","",T(1.0)), + test_ab("a[:] == '01234567890123456789'[10:] ","0123456789","",T(1.0)), + test_ab("a != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), + test_ab("a[:] != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), + test_ab("a[0:] != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), + test_ab("a[:8] != '01234567890123456789'[0:9] ","123456789" ,"",T(1.0)), + test_ab("a[:8] != '01234567890123456789'[:9] ","123456789" ,"",T(1.0)), + test_ab("a[:] != '01234567890123456789'[10:] ","123456789" ,"",T(1.0)), + test_ab("a == '01234567890123456789'[2*6:10+6]","23456" ,"",T(1.0)), + test_ab("a[:] == '23456' ","23456" ,"",T(1.0)), + test_ab("a[0:9] == b ","01234567890123456789","0123456789",T(1.0)), + test_ab("a[0:9] == b[:] ","01234567890123456789","0123456789",T(1.0)), + test_ab("a[0:9] == b[0:] ","01234567890123456789","0123456789",T(1.0)), + test_ab("a[0:9] == b[:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("a[:9] == b[:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("a[10:] == b[:] ","01234567890123456789","0123456789",T(1.0)), + test_ab("a[0:9] != b ","01234567890123456789","123456789" ,T(1.0)), + test_ab("a[0:9] != b[:] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("a[0:9] != b[0:] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("a[0:9] != b[:8] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("a[:9] != b[:8] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("a[10:] != b[:] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("a[2*6:10+6] == b ","01234567890123456789","23456" ,T(1.0)), + test_ab("b == a[0:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("b[:] == a[0:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("b[0:] == a[0:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("b[:9] == a[0:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("b[:9] == a[:9] ","01234567890123456789","0123456789",T(1.0)), + test_ab("b[:] == a[10:] ","01234567890123456789","0123456789",T(1.0)), + test_ab("b != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("b[:] != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("b[0:] != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("b[:8] != a[0:9] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("b[:8] != a[:9] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("b[:] != a[10:] ","01234567890123456789","123456789" ,T(1.0)), + test_ab("b == a[2*6:10+6] ","01234567890123456789","23456" ,T(1.0)), + test_ab("a[2:6] == b" ,"0123456789","23456" ,T(1.0)), + test_ab("a == b[2:6]" ,"23456","0123456789" ,T(1.0)), + test_ab("a[1+1:2*3] == b" ,"0123456789","23456" ,T(1.0)), + test_ab("a == b[4/2:sqrt(36)]","23456","0123456789" ,T(1.0)), + test_ab("a[0:6] == b" ,"0123456789","0123456",T(1.0)), + test_ab("a[:6] == b" ,"0123456789","0123456",T(1.0)), + test_ab("a[4/2-2:2+4] == b" ,"0123456789","0123456",T(1.0)), + test_ab("a[:12/2] == b" ,"0123456789","0123456",T(1.0)), + test_ab("a[0:] == b" ,"0123456","0123456" ,T(1.0)), + test_ab("a[:] == b" ,"0123456","0123456" ,T(1.0)), + test_ab("a == b[0:6]" ,"0123456","0123456789",T(1.0)), + test_ab("a == b[:6]" ,"0123456","0123456789",T(1.0)), + test_ab("a == b[4/2-2:2+4]" ,"0123456","0123456789",T(1.0)), + test_ab("a == b[:12/2]" ,"0123456","0123456789",T(1.0)), + test_ab("a == b[0:]" ,"0123456","0123456" ,T(1.0)), + test_ab("a == b[:]" ,"0123456","0123456" ,T(1.0)), + test_ab("a[:9] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), + test_ab("a[0:9] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), + test_ab("a[0:] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), + test_ab("a[:] == b[0:9]" ,"0123456789","01234567890123456789",T(1.0)), + test_ab("a[:] == b[10:]" ,"0123456789","01234567890123456789",T(1.0)), + test_ab("'!@#$%^&*([{}])-=' != ')]}{[(*&^%$#@!'","","",T(1.0)), + test_ab("('!@#$%^&*([{}])-=') != (')]}{[(*&^%$#@!')","","",T(1.0)), + test_ab("{[('a')]} == [{('a')}]","","",T(1.0)), + test_ab("{[('!@#$%^&*([{}])-=')]} != [{(')]}{[(*&^%$#@!')}]","","",T(1.0)), + test_ab("'!@#$%^&*([{}])-=' == '!@#$%^&*([{}])-='","","",T(1.0)), + test_ab("('!@#$%^&*([{}])-=') == ('!@#$%^&*([{}])-=')","","",T(1.0)), + test_ab("{[('!@#$%^&*([{}])-=')]} == [{('!@#$%^&*([{}])-=')}]","","",T(1.0)), + test_ab("'1234\\\\abc\nxyz\r890\tqaz\\'567' == a","1234\\abc\nxyz\r890\tqaz'567","",T(1.0)), + test_ab("a == '1234\\\\abc\nxyz\r890\tqaz\\'567'","1234\\abc\nxyz\r890\tqaz'567","",T(1.0)), + test_ab("'123'[] == 3" ,"","" ,T(1.0)), + test_ab("3 == '123'[]" ,"","" ,T(1.0)), + test_ab("'123'[] + '1234'[] == 7" ,"","" ,T(1.0)), + test_ab("abs('123'[] - '1234'[]) == 1" ,"","" ,T(1.0)), + test_ab("'1234'[] == a[]" ,"1234","" ,T(1.0)), + test_ab("'123'[] + a[] == 7" ,"1234","" ,T(1.0)), + test_ab("abs(a[] - '12345'[]) == 1" ,"1234","" ,T(1.0)), + test_ab("'1234'[] + '12345'[] == a[] + b[]" ,"1234","12345" ,T(1.0)), + test_ab("abs('123'[] -'1234'[]) == abs(a[] - b[])" ,"1234","12345",T(1.0)), + test_ab("(a + b) == 'abc123' ","abc","123" ,T(1.0)), + test_ab("(a + '123') == 'abc123' ","abc","123" ,T(1.0)), + test_ab("('abc' + b) == 'abc123' ","abc","123" ,T(1.0)), + test_ab("(a + '1') == 'abc1' ","abc","123" ,T(1.0)), + test_ab("('a' + b) == 'a123' ","abc","123" ,T(1.0)), + test_ab("(a[2:7] + b) == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), + test_ab("(a + b[2:7]) == 'abc234567' ","abc","0123456789" ,T(1.0)), + test_ab("(a[2:7] + '0123') == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), + test_ab("('abc' + b[2:7]) == 'abc234567' ","abc","0123456789" ,T(1.0)), + test_ab("(a[2:2] + b[3:3]) == 'c3' ","abc","0123456789" ,T(1.0)), + test_ab("(a[3:] + b) == 'defghij0123' ","abcdefghij","0123",T(1.0)), + test_ab("('abc' + b[:7]) == 'abc01234567' ","abc","0123456789" ,T(1.0)), + test_ab("a + '123' == 'abc'+ b ","abc" , "123" , T(1.0)), + test_ab("a[0:2] + '123' == 'abc' + b[0:2] ","abcXYZ", "123XYZ", T(1.0)), + test_ab("a[ :2] + '123' == 'abc' + b[ :2] ","abcXYZ", "123XYZ", T(1.0)), + test_ab("a[3: ] + '123' == 'abc' + b[3: ]","XYZabc", "XYZ123", T(1.0)), + test_ab("a[3:a[] - 1] + '123' == 'abc' + b[3:b[] - 1]","XYZabc", "XYZ123", T(1.0)), + test_ab("(a[r0:r2] + b) == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), + test_ab("(a + b[r0:r2]) == 'abc234567' ","abc","0123456789" ,T(1.0)), + test_ab("(a[r0:r2] + '0123') == 'cdefgh0123' ","abcdefghij","0123",T(1.0)), + test_ab("('abc' + b[r0:r2]) == 'abc234567' ","abc","0123456789" ,T(1.0)), + test_ab("(a[r0:r0] + b[r3:r3]) == 'c3' ","abc","0123456789" ,T(1.0)), + test_ab("(a[r3:] + b) == 'defghij0123' ","abcdefghij","0123",T(1.0)), + test_ab("('abc' + b[:r2]) == 'abc01234567' ","abc","0123456789" ,T(1.0)), + test_ab("a[0:r0] + '123' == 'abc' + b[0:r0] ","abcXYZ", "123XYZ", T(1.0)), + test_ab("a[ :r0] + '123' == 'abc' + b[ :r0] ","abcXYZ", "123XYZ", T(1.0)), + test_ab("a[r3: ] + '123' == 'abc' + b[r3: ]","XYZabc", "XYZ123", T(1.0)), + test_ab("a[r3:a[] - 1] + '123' == 'abc' + b[r3:b[] - 1]","XYZabc", "XYZ123", T(1.0)), + test_ab("(a[r0:r0] + b[r3:r0+1]) == 'c3' ","abc","0123456789" ,T(1.0)), + test_ab("(a[r0+1:] + b) == 'defghij0123' ","abcdefghij","0123",T(1.0)), + test_ab("a[r0+1: ] + '123' == 'abc' + b[r0+1: ]","XYZabc", "XYZ123", T(1.0)), + test_ab("a[r0+1:a[] - 1] + '123' == 'abc' + b[r0+1:b[] - 1]","XYZabc", "XYZ123", T(1.0)), + test_ab("(a + b)[ :13] == 'abcdefghij0123' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[ 6: ] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[ 2:3r1-1] == 'cdefghij01234567' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a[2:7] + b[2:7]) == 'cdefgh234567' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a[2:7] + b[2:7])[3:8] == 'fgh234' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[r0 - 2: r1 + r2] == 'abcdefghij0123' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[r0*r3:] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[3r0: ] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[2r3: ] == 'ghij0123456789' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a + b)[2:3r1 - 1] == 'cdefghij01234567' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a[r0:7] + b[r0:r2])== 'cdefgh234567' ", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a[r1 / r3:7] + b[r0:r2])[3:r2 + 1] == 'fgh234'", "abcdefghij", "0123456789" ,T(1.0)), + test_ab("(a += b) == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += '123') == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += b[3:5]) == 'abc123' ", "abc","XXX123XXX" ,T(1.0)), + test_ab("(a += 'XXX123XXX'[3:5]) == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += b)[:] == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += '123')[:] == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += b[3:5])[:] == 'abc123' ", "abc","XXX123XXX" ,T(1.0)), + test_ab("(a += 'XXX123XXX'[3:5])[:] == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += b[r1/2:r1-1]) == 'abc123' ", "abc","XXX123XXX" ,T(1.0)), + test_ab("(a += 'XXX123XXX'[r0+1:r1-1]) == 'abc123' ", "abc","123" ,T(1.0)), + test_ab("(a += b)[] == 6 ", "abc","123" ,T(1.0)), + test_ab("(a += '123')[] == 6 ", "abc","123" ,T(1.0)), + test_ab("(a += b[3:5])[] == 6 ", "abc","XXX123XXX" ,T(1.0)), + test_ab("(a += b[r0+1:r1-1])[] == 6 ", "abc","XXX123XXX" ,T(1.0)), + test_ab("(a + b)[:][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[:][:][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[:][:][:][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[:][:][:][:][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[:][:][:][:][:][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[:][:][:][:][:][:][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[:][:][:][:][:][:][:][]== 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5] == 'abc123' ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][1:4] == 'bc12' ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][1:4][1:2] == 'c1' ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][1:4][1:2][0:0] == 'c' ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][] == 6 ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][1:4][] == 4 ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][1:4][1:2][] == 2 ","abc","123" ,T(1.0)), + test_ab("(a + b)[0:5][1:4][1:2][0:0][] == 1 ","abc","123" ,T(1.0)), + test_ab("(a[ : ] := b); (a == 'ABCDEFGHIJ');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[0: ] := b); (a == 'ABCDEFGHIJ');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[ :9] := b); (a == 'ABCDEFGHIJ');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[3:7] := b); (a == '012ABCDE89');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[2:8] := b); (a == '01ABCDEFG9');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[1:9] := b); (a == '0ABCDEFGHI');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[0:0] := b); (a == 'A123456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[1:1] := b); (a == '0A23456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[2:2] := b); (a == '01A3456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[3:3] := b); (a == '012A456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[4:4] := b); (a == '0123A56789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[5:5] := b); (a == '01234A6789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[6:6] := b); (a == '012345A789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[7:7] := b); (a == '0123456A89');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[8:8] := b); (a == '01234567A9');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[9:9] := b); (a == '012345678A');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[0:1] := b); (a == 'AB23456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[1:2] := b); (a == '0AB3456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[2:3] := b); (a == '01AB456789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[3:4] := b); (a == '012AB56789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[4:5] := b); (a == '0123AB6789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[5:6] := b); (a == '01234AB789');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[6:7] := b); (a == '012345AB89');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[7:8] := b); (a == '0123456AB9');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[8:9] := b); (a == '01234567AB');", "0123456789","ABCDEFGHIJ" ,T(1.0)), + test_ab("(a[ : ] := b[3:b[] - 3]); (a == 'ABCDEFGHIJ');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[0: ] := b[3:b[] - 3]); (a == 'ABCDEFGHIJ');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[ :9] := b[3:b[] - 3]); (a == 'ABCDEFGHIJ');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[3:7] := b[3:b[] - 3]); (a == '012ABCDE89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[2:8] := b[3:b[] - 3]); (a == '01ABCDEFG9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[1:9] := b[3:b[] - 3]); (a == '0ABCDEFGHI');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[0:0] := b[3:b[] - 3]); (a == 'A123456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[1:1] := b[3:b[] - 3]); (a == '0A23456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[2:2] := b[3:b[] - 3]); (a == '01A3456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[3:3] := b[3:b[] - 3]); (a == '012A456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[4:4] := b[3:b[] - 3]); (a == '0123A56789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[5:5] := b[3:b[] - 3]); (a == '01234A6789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[6:6] := b[3:b[] - 3]); (a == '012345A789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[7:7] := b[3:b[] - 3]); (a == '0123456A89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[8:8] := b[3:b[] - 3]); (a == '01234567A9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[9:9] := b[3:b[] - 3]); (a == '012345678A');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[0:1] := b[3:b[] - 3]); (a == 'AB23456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[1:2] := b[3:b[] - 3]); (a == '0AB3456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[2:3] := b[3:b[] - 3]); (a == '01AB456789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[3:4] := b[3:b[] - 3]); (a == '012AB56789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[4:5] := b[3:b[] - 3]); (a == '0123AB6789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[5:6] := b[3:b[] - 3]); (a == '01234AB789');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[6:7] := b[3:b[] - 3]); (a == '012345AB89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[7:8] := b[3:b[] - 3]); (a == '0123456AB9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[8:9] := b[3:b[] - 3]); (a == '01234567AB');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[0:9] := b); (a == 'A123456789');", "0123456789","A" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'AB23456789');", "0123456789","AB" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABC3456789');", "0123456789","ABC" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABCD456789');", "0123456789","ABCD" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABCDE56789');", "0123456789","ABCDE" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABCDEF6789');", "0123456789","ABCDEF" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABCDEFG789');", "0123456789","ABCDEFG" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABCDEFGH89');", "0123456789","ABCDEFGH" ,T(1.0)), + test_ab("(a[0:9] := b); (a == 'ABCDEFGHI9');", "0123456789","ABCDEFGHI" ,T(1.0)), + test_ab("(a[3:9] := b); (a == '012A456789');", "0123456789","A" ,T(1.0)), + test_ab("(a[3:9] := b); (a == '012AB56789');", "0123456789","AB" ,T(1.0)), + test_ab("(a[3:9] := b); (a == '012ABC6789');", "0123456789","ABC" ,T(1.0)), + test_ab("(a[3:9] := b); (a == '012ABCD789');", "0123456789","ABCD" ,T(1.0)), + test_ab("(a[3:9] := b); (a == '012ABCDE89');", "0123456789","ABCDE" ,T(1.0)), + test_ab("(a[3:9] := b); (a == '012ABCDEF9');", "0123456789","ABCDEF" ,T(1.0)), + test_ab("(a[r1 / r0:r2] := b[3:b[] - r3]); (a == '012ABCDE89');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("(a[r0:r2 + 1] := b[r3:b[] - r3]); (a == '01ABCDEFG9');", "0123456789","xyzABCDEFGHIJxyz",T(1.0)), + test_ab("'\\0x30\\0x31\\0x32\\0x33\\0x34\\0x35\\0x36\\0x37\\0x38\\0x39' == '0123456789'","","",T(1.0)), + test_ab("'abc\\0x30\\0x31\\0x32\\0x33xyz' == 'abc0123xyz'" ,"","",T(1.0)), + test_ab("'\\0x30\\n\\0x31\\n\\0x32\\n\\0x33' == '0\\n1\\n2\\n3'" ,"","",T(1.0)), + test_ab("('\\0x30' + '') == '0'" ,"","",T(1.0)), + test_ab("('\\0x30' + '\\0x31\\0x32') == '012'" ,"","",T(1.0)), + test_ab("('\\0x30' + '\\0x31\\0x32' + '\\0x33\\0x34\\0x35') == '012345'" ,"","",T(1.0)) }; static const std::size_t test_list_size = sizeof(test_list) / sizeof(test_ab); @@ -2287,7 +2287,8 @@ inline bool run_test02() parser.error().c_str(), test.expr.c_str()); - return false; + result = false; + continue; } } @@ -2303,7 +2304,9 @@ inline bool run_test02() test.expr.c_str(), (double)test.result, (double)expr_result); + result = false; + continue; } } @@ -2347,18 +2350,21 @@ inline bool run_test02() { printf("run_test02() - Evaluation Error [2]: Expression: [%s]\tExpected: True\n", expression_str.c_str()); + return false; } else if ("234567" != s0) { printf("run_test02() - Evaluation Error [2]: Expression: [%s]\tInvalid value for s0\n", expression_str.c_str()); + return false; } else if ("xyz" != s1) { printf("run_test02() - Evaluation Error [2]: Expression: [%s]\tInvalid value for s1\n", expression_str.c_str()); + return false; } } @@ -2385,19 +2391,19 @@ inline bool run_test03() static const std::string variable_list[] = { - "A", "A0", "aA", "Aa0", "b", "B1", "Bb", "bB1", - "c", "C2", "Cc", "Cc2", "D", "D3", "dD", "dD3", - "E", "E4", "eE", "Ee4", "f", "F5", "Ff", "fF5", - "g", "G6", "Gg", "Gg6", "H", "H7", "hH", "hH7", - "I", "I8", "iI", "Ii8", "j", "J9", "Jj", "jJ9", - "k", "K0", "Kk", "Kk0", "L", "L1", "lL", "lL1", - "M", "M2", "mM", "Mm2", "n", "N3", "Nn", "nN3", - "o", "O4", "Oo", "Oo4", "P", "P5", "pP", "pP5", - "Q", "Q6", "qQ", "Qq6", "r", "R7", "Rr", "rR7", - "s", "S8", "Ss", "Ss8", "T", "T9", "tT", "tT9", - "U", "U0", "uU", "Uu0", "v", "V1", "Vv", "vV1", - "w", "W2", "Ww", "Ww2", "X", "X3", "xX", "xX3", - "Y", "Y4", "yY", "Yy4", "z", "Z5", "Zz", "zZ5" + "A", "A0", "aA", "Aa0", "b", "B1", "Bb", "bB1", + "c", "C2", "Cc", "Cc2", "D", "D3", "dD", "dD3", + "E", "E4", "eE", "Ee4", "f", "F5", "Ff", "fF5", + "g", "G6", "Gg", "Gg6", "H", "H7", "hH", "hH7", + "I", "I8", "iI", "Ii8", "j", "J9", "Jj", "jJ9", + "k", "K0", "Kk", "Kk0", "L", "L1", "lL", "lL1", + "M", "M2", "mM", "Mm2", "n", "N3", "Nn", "nN3", + "o", "O4", "Oo", "Oo4", "P", "P5", "pP", "pP5", + "Q", "Q6", "qQ", "Qq6", "r", "R7", "Rr", "rR7", + "s", "S8", "Ss", "Ss8", "T", "T9", "tT", "tT9", + "U", "U0", "uU", "Uu0", "v", "V1", "Vv", "vV1", + "w", "W2", "Ww", "Ww2", "X", "X3", "xX", "xX3", + "Y", "Y4", "yY", "Yy4", "z", "Z5", "Zz", "zZ5" }; static const std::size_t variable_list_size = sizeof(variable_list) / sizeof(std::string); @@ -2406,7 +2412,8 @@ inline bool run_test03() for (std::size_t r = 0; r < rounds; ++r) { - exprtk::symbol_table symbol_table; + exprtk::symbol_table symbol_table_0; + exprtk::symbol_table symbol_table_1; exprtk::expression expression; std::vector v; @@ -2415,21 +2422,28 @@ inline bool run_test03() for (std::size_t i = 0; i < variable_list_size; ++i) { v[i] = T(i); - symbol_table.add_variable(variable_list[i],v[i]); + if (i & 1) + symbol_table_0.add_variable(variable_list[i],v[i]); + else + symbol_table_1.add_variable(variable_list[i],v[i]); } - if (variable_list_size != symbol_table.variable_count()) + std::size_t total_symbol_count = symbol_table_0.variable_count() + + symbol_table_1.variable_count(); + + if (variable_list_size != total_symbol_count) { printf("run_test03() - Error - Invalid number of variables in symbol_table! Expected: %d got: %d\n", static_cast(variable_list_size), - static_cast(symbol_table.variable_count())); + static_cast(total_symbol_count)); return false; } - symbol_table.add_constants(); + symbol_table_0.add_constants(); - expression.register_symbol_table(symbol_table); + expression.register_symbol_table(symbol_table_0); + expression.register_symbol_table(symbol_table_1); { exprtk::parser parser; @@ -2739,141 +2753,141 @@ inline bool run_test08() static const std::string expr_str[] = { - "x", "y", "z", "w", "u", - "x + y + z + w + u", - "x + y / z * w ^ u", - "x:=1.1", "y:=2.2", "z:=3.3", "w:=4.4", "u:=5.5", - "x:=x+1.1", "y:=y+2.2", "z:=z+3.3", "w:=w+4.4", "u:=u+5.5", - "x:=1.1+x", "y:=2.2+y", "z:=3.3+z", "w:=4.4+w", "u:=5.5+u", - "x:=(x <= 1.1)", - "y:=(2.2 >= y)", - "z:=(3.3 and z)", - "w:=(4.4 or w)", - "u:=(u xor 5.5)", - "min(x,y) + min(x,y,z) + min(x,y,z,w) + min(x,y,z,w,y)", - "max(x,y) + max(x,y,z) + max(x,y,z,w) + max(x,y,z,w,y)", - "avg(x,y)", - "avg(x,y,z)", - "avg(x,y,z,w)", - "avg(x,y,z,w,u)", - "(u := u := min(x:=1,y:=2,z:=3)) == 1", - "(2x+3y+4z+5w)==(2*x+3*y+4*z+5*w)", - "(3(x+y)/2+1)==(3*(x+y)/2+1)", - "((x+y)3+1/4)==((x+y)*3+1/4)", - "((x+y)z+1/2)==((x+y)*z+1/2)", - "(x+y^3/z) == (x+(y*y*y)/z)", - "(z-x^3+y^2*7) == (z-(x*x*x)+(y*y)*7)", - "(3min(x,y))==(3*min(x,y))", - "(sin(x)y)==(sin(x)*y)", - "(sin(x)cos(y)+1)==(sin(x)*cos(y)+1)", - "(sgn(sin(x))cos(sgn(y))+1)==(sgn(sin(x))*cos(sgn(y))+1)", - "equal($f00(x,y,z),(x+y)/z)", - "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-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($f92(x,y,z,w),x and y ? z : w)", - "equal($f93(x,y,z,w),x or y ? z : w)", - "equal($f94(x,y,z,w),x < y ? z : w)", - "equal($f95(x,y,z,w),x <= y ? z : w)", - "equal($f96(x,y,z,w),x > y ? z : w)", - "equal($f97(x,y,z,w),x >= y ? z : w)", - "equal($f98(x,y,z,w),equal(x,y) ? z : w)", - "equal($f99(x,y,z,w),x*sin(y)+z*cos(w))" + "x", "y", "z", "w", "u", + "x + y + z + w + u", + "x + y / z * w ^ u", + "x:=1.1", "y:=2.2", "z:=3.3", "w:=4.4", "u:=5.5", + "x:=x+1.1", "y:=y+2.2", "z:=z+3.3", "w:=w+4.4", "u:=u+5.5", + "x:=1.1+x", "y:=2.2+y", "z:=3.3+z", "w:=4.4+w", "u:=5.5+u", + "x:=(x <= 1.1)", + "y:=(2.2 >= y)", + "z:=(3.3 and z)", + "w:=(4.4 or w)", + "u:=(u xor 5.5)", + "min(x,y) + min(x,y,z) + min(x,y,z,w) + min(x,y,z,w,y)", + "max(x,y) + max(x,y,z) + max(x,y,z,w) + max(x,y,z,w,y)", + "avg(x,y)", + "avg(x,y,z)", + "avg(x,y,z,w)", + "avg(x,y,z,w,u)", + "(u := u := min(x:=1,y:=2,z:=3)) == 1", + "(2x+3y+4z+5w)==(2*x+3*y+4*z+5*w)", + "(3(x+y)/2+1)==(3*(x+y)/2+1)", + "((x+y)3+1/4)==((x+y)*3+1/4)", + "((x+y)z+1/2)==((x+y)*z+1/2)", + "(x+y^3/z) == (x+(y*y*y)/z)", + "(z-x^3+y^2*7) == (z-(x*x*x)+(y*y)*7)", + "(3min(x,y))==(3*min(x,y))", + "(sin(x)y)==(sin(x)*y)", + "(sin(x)cos(y)+1)==(sin(x)*cos(y)+1)", + "(sgn(sin(x))cos(sgn(y))+1)==(sgn(sin(x))*cos(sgn(y))+1)", + "equal($f00(x,y,z),(x+y)/z)", + "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-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($f92(x,y,z,w),x and y ? z : w)", + "equal($f93(x,y,z,w),x or y ? z : w)", + "equal($f94(x,y,z,w),x < y ? z : w)", + "equal($f95(x,y,z,w),x <= y ? z : w)", + "equal($f96(x,y,z,w),x > y ? z : w)", + "equal($f97(x,y,z,w),x >= y ? z : w)", + "equal($f98(x,y,z,w),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); @@ -3637,255 +3651,275 @@ inline bool run_test10() { std::string expression_list[] = { - "var x; 1", - "var x := 1; x", - "var x := 1; var y := 2; 1", - "var x := 1; var y := 2; x", - "var x:=6; var y:=4; x + -3 == 3", - "var x:=6; var y:=4; x - -3 == 9", - "var x:=6; var y:=4; x * -3 == -18", - "var x:=6; var y:=4; x / -3 == -2", - "var x:=6; var y:=4; -x + -3 == -9", - "var x:=6; var y:=4; -x - -3 == -3", - "var x:=6; var y:=4; -x * -3 == 18", - "var x:=6; var y:=4; -x / -3 == 2", - "var x:=6; var y:=4; -3 + -x == -9", - "var x:=6; var y:=4; -3 - -x == 3", - "var x:=6; var y:=4; -3 * -x == 18", - "var x:=6; var y:=4; -3 / -x == 0.5", - "var x:=6; var y:=4; 3 + -x == -3", - "var x:=6; var y:=4; 3 - -x == 9", - "var x:=6; var y:=4; 3 * -x == -18", - "var x:=6; var y:=4; 3 / -x == -0.5", - "var x := 3; var y := 6; x + -y == -3", - "var x := 3; var y := 6; x - -y == 9", - "var x := 3; var y := 6; -x + -y == -9", - "var x := 3; var y := 6; -x - -y == 3", - "var x := 3; var y := 6; -x * -y == 18", - "var x := 6; var y := 3; -x / -y == 2", - "var x := 3; var y := 6; -(-x * -y) == -18", - "var x := 6; var y := 3; -(-x / -y) == -2", - "var x:=1; 2+(3+abs(x)) == 6 ", - "var x:=1; (3+abs(x))+2 == 6 ", - "var x:=1; 2+(abs(x)+3) == 6 ", - "var x:=1; (abs(x)+3)+2 == 6 ", - "var x:=1; 2+(3-abs(x)) == 4 ", - "var x:=1; (3-abs(x))+2 == 4 ", - "var x:=1; 2+(abs(x)-3) == 0 ", - "var x:=1; (abs(x)-3)+2 == 0 ", - "var x:=1; 2-(3+abs(x)) == -2 ", - "var x:=1; (3+abs(x))-2 == 2 ", - "var x:=1; 2-(abs(x)+3) == -2 ", - "var x:=1; (abs(x)+3)-2 == 2 ", - "var x:=1; 2*(3*abs(x)) == 6 ", - "var x:=1; (3*abs(x))*2 == 6 ", - "var x:=1; 2*(abs(x)*3) == 6 ", - "var x:=1; (abs(x)*3)*2 == 6 ", - "var x:=1; 2*(3/abs(x)) == 6 ", - "var x:=1; (3/abs(x))*2 == 6 ", - "var x:=1; 2*(abs(x)/3) == (2/3)", - "var x:=1; (abs(x)/3)*2 == (2/3)", - "var x:=1; 2/(3*abs(x)) == (2/3)", - "var x:=1; (3*abs(x))/2 == (3/2)", - "var x:=1; 2/(abs(x)*3) == (2/3)", - "var x:=1; (abs(x)*3)/2 == (3/2)", - "var x:=1; 2/(3/abs(x)) == (2/3)", - "var x:=1; (3/abs(x))/2 == (3/2)", - "var x:=1; 2/(abs(x)/3) == 6 ", - "var x:=1; (abs(x)/3)/2 == (1/6)", - "var x:=3; var y:=6; -(-x)*-(-y) == 18", - "var x:=3; var y:=6; -(-x)*-(-(-y)) == -18", - "var x:=3; var y:=6; -(-(-x))*-(-y) == -18", - "var x:=3; var y:=6; -(-(-x))*-(-(-y)) == 18", - "var x:=3; var y:=6; -(-(x+y))*-(-(y+x)) == 81", - "var x:=3; var y:=6; -(-(-(x+y)))*-(-(y+x)) == -81", - "var x:=3; var y:=6; -(-(x+y))*-(-(-(y+x))) == -81", - "var x:=3; var y:=6; -(-(-(x+y)))*-(-(-(y+x))) == 81", - "var x:= 2; var y := 3; (-abs(x)+-abs(y)) == -5 ", - "var x:= 2; var y := 3; (-abs(x)--abs(y)) == 1 ", - "var x:= 2; var y := 3; (-abs(x)*-abs(y)) == 6 ", - "var x:= 2; var y := 3; (-abs(x)/-abs(y)) == (2/3) ", - "var x:= 2; var y := 3; (-abs(x)+abs(y)) == 1 ", - "var x:= 2; var y := 3; (-abs(x)-abs(y)) == -5 ", - "var x:= 2; var y := 3; (-abs(x)*abs(y)) == -6 ", - "var x:= 2; var y := 3; (-abs(x)/abs(y)) == -(2/3) ", - "var x:= 2; var y := 3; (abs(x)+-abs(y)) == -1 ", - "var x:= 2; var y := 3; (abs(x)--abs(y)) == 5 ", - "var x:= 2; var y := 3; (abs(x)*-abs(y)) == -6 ", - "var x:= 2; var y := 3; (abs(x)/-abs(y)) == -(2/3) ", - "var x:= 2; var y := 3; (-abs(x + 0)+-abs(y - 0)) == -5 ", - "var x:= 2; var y := 3; (-abs(x + 0)--abs(y - 0)) == 1 ", - "var x:= 2; var y := 3; (-abs(x + 0)*-abs(y - 0)) == 6 ", - "var x:= 2; var y := 3; (-abs(x + 0)/-abs(y - 0)) == (2/3) ", - "var x:= 2; var y := 3; (-abs(x + 0)+abs(y - 0)) == 1 ", - "var x:= 2; var y := 3; (-abs(x + 0)-abs(y - 0)) == -5 ", - "var x:= 2; var y := 3; (-abs(x + 0)*abs(y - 0)) == -6 ", - "var x:= 2; var y := 3; (-abs(x + 0)/abs(y - 0)) == -(2/3) ", - "var x:= 2; var y := 3; (abs(x + 0)+-abs(y - 0)) == -1 ", - "var x:= 2; var y := 3; (abs(x + 0)--abs(y - 0)) == 5 ", - "var x:= 2; var y := 3; (abs(x + 0)*-abs(y - 0)) == -6 ", - "var x:= 2; var y := 3; (abs(x + 0)/-abs(y - 0)) == -(2/3) ", - "var x := 1; var y := 2; swap(x,y); (x == 2) and (y == 1)", - "var x := 1; var y := 2; x <=> y ; (x == 2) and (y == 1)", - "var v[2] := {1,2}; swap(v[0],v[1]); (v[0] == 2) and (v[1] == 1)", - "var v[2] := {1,2}; v[0] <=> v[1] ; (v[0] == 2) and (v[1] == 1)", - "var x := 1; var y := 2; ~(swap(x,y),(x == 2) and (y == 1))", - "var x := 1; var y := 2; ~(x <=> y , (x == 2) and (y == 1))", - "var v[2] := {1,2}; ~(swap(v[0],v[1]), (v[0] == 2) and (v[1] == 1))", - "var v[2] := {1,2}; ~(v[0] <=> v[1] , (v[0] == 2) and (v[1] == 1))", - "var v[2] := {1,2}; swap(v[zero],v[one]); (v[zero] == 2) and (v[one] == 1)", - "var v[2] := {1,2}; v[zero] <=> v[one] ; (v[zero] == 2) and (v[one] == 1)", - "var v[2] := {1,2}; ~(swap(v[zero],v[one]), (v[zero] == 2) and (v[one] == 1))", - "var v[2] := {1,2}; ~(v[zero] <=> v[one] , (v[zero] == 2) and (v[one] == 1))", - "var v[2] := {1,2}; swap(v[2 * zero],v[(2 * one) / (1 + 1)]); (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1)", - "var v[2] := {1,2}; v[2 * zero] <=> v[(2*one)/(1+1)] ; (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1)", - "var v[2] := {1,2}; ~(swap(v[2 * zero],v[(2 * one) / (1 + 1)]), (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1))", - "var v[2] := {1,2}; ~(v[2 * zero] <=> v[(2 * one) / (1 + 1)] , (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1))", - "var x := 1; var y := 2; var v[2] := {3,4}; swap(x,v[0]); swap(v[1],y); (x == 3) and (y == 4)", - "var x := 1; var y := 2; var v[2] := {3,4}; x <=> v[0]; v[1] <=> y; (x == 3) and (y == 4)", - "var x := 1; var y := 2; var v[2] := {3,4}; swap(x,v[zero]); swap(v[one],y); (x == 3) and (y == 4)", - "var x := 1; var y := 2; var v[2] := {3,4}; x <=> v[zero]; v[one] <=> y; (x == 3) and (y == 4)", - "var x := 1; var y := 2; var v[2] := {3,4}; swap(x,v[2 * zero]); swap(v[(2 * one) / (1 + 1)],y); (x == 3) and (y == 4)", - "var x := 1; var y := 2; var v[2] := {3,4}; x <=> v[zero / 3]; v[(2 * one)/(1 + 1)] <=> y; (x == 3) and (y == 4)", - "~{ var x := 1 } + ~{ var x := 2 } == 3", - "(~{ var x := 1 } + ~{ var x := 2 }) == (~{ var x := 2 } + ~{ var x := 1 })", - "(~{ var x := 1 } + ~{ var x := 2 } + ~{~{ var x := 1 } + ~{ var x := 2 }}) == 6", - "(~{ var x[3] := [1] } + ~{ var x[6] := {6,5,4,3,2,1}}) == 7", - "(~{ var x[6] := {6,5,4,3,2,1} } + ~{ var x := 1 }) == 7", - "(~{ var x := 1 } + ~{ var x[6] := {6,5,4,3,2,1} }) == 7", - "var x[3] := {}; (x[0] == 0) and (x[1] == 0) and (x[2] == 0)", - "var x[3] := {1,2}; (x[0] == 1) and (x[1] == 2) and (x[2] == 0)", - "var x[3] := {1,2,3}; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", - "var x[3] := [1]; (x[0] == 1) and (x[1] == 1) and (x[2] == 1)", - "var v[3] := [1]; v += 1; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 2)", - "var v[3] := [1]; v -= 1; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 0)", - "var v[3] := [1]; v *= 2; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 2)", - "var v[3] := [3]; v /= 3; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 1)", - "var v[3] := {1,2, 3}; v += 1; (v[0] == 2) and (v[1] == 3) and (v[2] == 4)", - "var v[3] := {1,2, 3}; v -= 1; (v[0] == 0) and (v[1] == 1) and (v[2] == 2)", - "var v[3] := {1,2, 3}; v *= 2; (v[0] == 2) and (v[1] == 4) and (v[2] == 6)", - "var v[3] := {3,9,15}; v /= 3; (v[0] == 1) and (v[1] == 3) and (v[2] == 5)", - "var v0[3] := [1]; var v1[3] := [1]; v0 += v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 2)", - "var v0[3] := [1]; var v1[3] := [1]; v0 -= v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 0)", - "var v0[3] := [1]; var v1[3] := [2]; v0 *= v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 2)", - "var v0[3] := [3]; var v1[3] := [3]; v0 /= v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 1)", - "var v0[3] := {1,2, 3}; var v1[3] := {1,1,1}; v0 += v1; (v0[0] == 2) and (v0[1] == 3) and (v0[2] == 4)", - "var v0[3] := {1,2, 3}; var v1[3] := {1,1,1}; v0 -= v1; (v0[0] == 0) and (v0[1] == 1) and (v0[2] == 2)", - "var v0[3] := {1,2, 3}; var v1[3] := {2,2,2}; v0 *= v1; (v0[0] == 2) and (v0[1] == 4) and (v0[2] == 6)", - "var v0[3] := {3,9,15}; var v1[3] := {3,3,3}; v0 /= v1; (v0[0] == 1) and (v0[1] == 3) and (v0[2] == 5)", - "var x[3] := {}; var y[4] := {1,2,3,4}; x := y; (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", - "var x[3] := {}; var y[3] := {1,2,3}; x := y; (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", - "var x[3] := {}; var y[2] := {1,2}; x := y; (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == 0)", - "var x[3] := {}; var y[1] := {1}; x := y; (x[0] == y[0]) and (x[1] == 0) and (x[2] == 0)", - "var x[3] := {}; var y[4] := {1,2,3,4}; x := (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", - "var x[3] := {}; var y[3] := {1,2,3}; x := (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", - "var x[3] := {}; var y[2] := {1,2}; x := (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == 0)", - "var x[3] := {}; var y[1] := {1}; x := (y+=1); (x[0] == y[0]) and (x[1] == 0) and (x[2] == 0)", - "var x[3] := {}; var y[4] := {1,2,3,4}; x += (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", - "var x[3] := {}; var y[3] := {1,2,3}; x += (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", - "var x[3] := {}; var y[2] := {1,2}; x += (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == 0)", - "var x[3] := {}; var y[1] := {1}; x += (y+=1); (x[0] == y[0]) and (x[1] == 0) and (x[2] == 0)", - "var x[3] := [9]; var y[4] := {1,2,3,4}; x <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", - "var x[3] := [9]; var y[3] := {1,2,3}; x <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", - "var x[3] := [9]; var y[2] := {1,2}; x <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 9)", - "var x[3] := [9]; var y[1] := {1}; x <=> y; (x[0] == 1) and (x[1] == 9) and (x[2] == 9)", - "var x[3] := [9]; var y[4] := {1,2,3,4}; x <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", - "var x[3] := [9]; var y[3] := {1,2,3}; x <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", - "var x[3] := [9]; var y[2] := {1,2}; x <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 9)", - "var x[3] := [9]; var y[1] := {1}; x <=> (y += 1); (x[0] == 2) and (x[1] == 9) and (x[2] == 9)", - "var x[3] := [8]; var y[4] := {1,2,3,4}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", - "var x[3] := [8]; var y[3] := {1,2,3}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", - "var x[3] := [8]; var y[2] := {1,2}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 9)", - "var x[3] := [8]; var y[1] := {1}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 9) and (x[2] == 9)", - "var x[3] := [8]; var y[4] := {1,2,3,4}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", - "var x[3] := [8]; var y[3] := {1,2,3}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", - "var x[3] := [8]; var y[2] := {1,2}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 9)", - "var x[3] := [8]; var y[1] := {1}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 9) and (x[2] == 9)", - "var x[3] := [0]; var y[4] := {1,2,3,4}; x < y", - "var x[3] := [0]; var y[3] := {1,2,3}; x < y", - "var x[3] := [0]; var y[2] := {1,2}; x < y", - "var x[3] := [0]; var y[1] := {1}; x < y", - "var x[3] := [0]; var y[4] := {1,2,3,4}; x <= y", - "var x[3] := [0]; var y[3] := {1,2,3}; x <= y", - "var x[3] := [0]; var y[2] := {1,2}; x <= y", - "var x[3] := [0]; var y[1] := {1}; x <= y", - "var x[3] := [5]; var y[4] := {1,2,3,4}; x > y", - "var x[3] := [5]; var y[3] := {1,2,3}; x > y", - "var x[3] := [5]; var y[2] := {1,2}; x > y", - "var x[3] := [5]; var y[1] := {1}; x > y", - "var x[3] := [5]; var y[4] := {1,2,3,4}; x >= y", - "var x[3] := [5]; var y[3] := {1,2,3}; x >= y", - "var x[3] := [5]; var y[2] := {1,2}; x >= y", - "var x[3] := [5]; var y[1] := {1}; x >= y", - "var x[3] := [1]; var y[4] := [1]; x == y", - "var x[3] := [1]; var y[3] := [1]; x == y", - "var x[3] := [1]; var y[2] := [1]; x == y", - "var x[3] := [1]; var y[1] := [1]; x == y", - "var x[3] := [1]; var y[4] := [2]; x != y", - "var x[3] := [1]; var y[3] := [2]; x != y", - "var x[3] := [1]; var y[2] := [2]; x != y", - "var x[3] := [1]; var y[1] := [2]; x != y", - "var x[3] := [0]; var y[4] := {5,6,7,8}; (x += 1) < y", - "var x[3] := [0]; var y[3] := {5,6,7}; (x += 1) < y", - "var x[3] := [0]; var y[2] := {5,6}; (x += 1) < y", - "var x[3] := [0]; var y[1] := {5}; (x += 1) < y", - "var x[3] := [0]; var y[4] := {1,2,3,4}; x < (y += 1)", - "var x[3] := [0]; var y[3] := {1,2,3}; x < (y += 1)", - "var x[3] := [0]; var y[2] := {1,2}; x < (y += 1)", - "var x[3] := [0]; var y[1] := {1}; x < (y += 1)", - "var x[3] := [0]; var y[4] := {5,6,7,8}; (x += 1) < (y += 1)", - "var x[3] := [0]; var y[3] := {5,6,7}; (x += 1) < (y += 1)", - "var x[3] := [0]; var y[2] := {5,6}; (x += 1) < (y += 1)", - "var x[3] := [0]; var y[1] := {5}; (x += 1) < (y += 1)", - "var x[3] := {1,2,3}; var y := 5; x < y ", - "var x[3] := {1,2,3}; var y := 3; x < y + 1 ", - "var x[3] := {1,2,3}; var y := 5; x <= y ", - "var x[3] := {1,2,3}; var y := 3; x <= y + 1", - "var x[3] := {1,1,1}; var y := 1; x == y ", - "var x[3] := {1,1,1}; var y := 2; x == y - 1", - "var x[3] := {1,2,3}; var y := 5; y > x ", - "var x[3] := {1,2,3}; var y := 3; y >= x ", - "var x[3] := {1,2,3}; var y := 5; y + 1 > x ", - "var x[3] := {1,1,1}; var y := 1; y == x ", - "var x[3] := {1,1,1}; var y := 2; y - 1 == x", - "var x[3] := {1,2,3}; var y := 5; (x += 1) < y ", - "var x[3] := {1,2,3}; var y := 3; (x -= 1) < y + 1 ", - "var x[3] := {1,2,3}; var y := 5; (x -= 1) <= y ", - "var x[3] := {2,2,2}; var y := 1; (x -= 1) == y ", - "var x[3] := {1,2,3}; var y := 5; y > (x += 1) ", - "var x[3] := {1,2,3}; var y := 5; y + 1 > (x += 1) ", - "var x[3] := {2,2,2}; var y := 1; y == (x -= 1) ", - "var x[3] := {2,2,2}; var y := 0; y + 1 == (x -= 1)", - "var x[3] := [1]; var y[4] := {1,2,3,4}; var z[3] := [1]; z := (x + y); z == (x + y)", - "var x[3] := [1]; var y[3] := {1,2,3}; var z[3] := [1]; z := (x - y); z == (x - y)", - "var x[3] := [1]; var y[2] := {1,2}; var z[3] := [1]; z := (x / y); z == (x / y)", - "var x[3] := [1]; var y[1] := {1}; var z[3] := [1]; z := (x * y); z == (x * y)", - "var x[3] := [1]; var y[4] := {1,2,3,4}; var z[3] := [1]; z := 2(x + y); z == (x + y)2", - "var x[3] := [1]; var y[3] := {1,2,3}; var z[3] := [1]; z := 2(x - y); z == (x - y)2", - "var x[3] := [1]; var y[2] := {1,2}; var z[3] := [1]; z := 2(x / y); z == (x / y)2", - "var x[3] := [1]; var y[1] := {1}; var z[3] := [1]; z := 2(x * y); z == (x * y)2", - "var x[3] := [1]; var y[4] := {1,2,3,4}; var z[3] := [1]; z := 2(x + y)/3; z == 2(x + y)/3", - "var x[3] := [1]; var y[3] := {1,2,3}; var z[3] := [1]; z := 2(x - y)/3; z == 2(x - y)/3", - "var x[3] := [1]; var y[2] := {1,2}; var z[3] := [1]; z := 2(x / y)/3; z == 2(x / y)/3", - "var x[3] := [1]; var y[1] := {1}; var z[3] := [1]; z := 2(x * y)/3; z == 2(x * y)/3", - "var x[6] := {1,2,3,4,5,6}; equal(sqrt(sum([x - avg(x)]^2) / x[]),1.7078251277)", - "var x[3] := {-1,-2,-3}; sum(abs(x) ) == 6", - "var x[3] := {0.1,0.2,0.3}; sum(trunc(x)) == 0", + "var x; 1", + "var x := 1; x", + "var x := 1; var y := 2; 1", + "var x := 1; var y := 2; x", + "var x:=6; var y:=4; x + -3 == 3", + "var x:=6; var y:=4; x - -3 == 9", + "var x:=6; var y:=4; x * -3 == -18", + "var x:=6; var y:=4; x / -3 == -2", + "var x:=6; var y:=4; -x + -3 == -9", + "var x:=6; var y:=4; -x - -3 == -3", + "var x:=6; var y:=4; -x * -3 == 18", + "var x:=6; var y:=4; -x / -3 == 2", + "var x:=6; var y:=4; -3 + -x == -9", + "var x:=6; var y:=4; -3 - -x == 3", + "var x:=6; var y:=4; -3 * -x == 18", + "var x:=6; var y:=4; -3 / -x == 0.5", + "var x:=6; var y:=4; 3 + -x == -3", + "var x:=6; var y:=4; 3 - -x == 9", + "var x:=6; var y:=4; 3 * -x == -18", + "var x:=6; var y:=4; 3 / -x == -0.5", + "var x := 3; var y := 6; x + -y == -3", + "var x := 3; var y := 6; x - -y == 9", + "var x := 3; var y := 6; -x + -y == -9", + "var x := 3; var y := 6; -x - -y == 3", + "var x := 3; var y := 6; -x * -y == 18", + "var x := 6; var y := 3; -x / -y == 2", + "var x := 3; var y := 6; -(-x * -y) == -18", + "var x := 6; var y := 3; -(-x / -y) == -2", + "var x:=1; 2+(3+abs(x)) == 6 ", + "var x:=1; (3+abs(x))+2 == 6 ", + "var x:=1; 2+(abs(x)+3) == 6 ", + "var x:=1; (abs(x)+3)+2 == 6 ", + "var x:=1; 2+(3-abs(x)) == 4 ", + "var x:=1; (3-abs(x))+2 == 4 ", + "var x:=1; 2+(abs(x)-3) == 0 ", + "var x:=1; (abs(x)-3)+2 == 0 ", + "var x:=1; 2-(3+abs(x)) == -2 ", + "var x:=1; (3+abs(x))-2 == 2 ", + "var x:=1; 2-(abs(x)+3) == -2 ", + "var x:=1; (abs(x)+3)-2 == 2 ", + "var x:=1; 2*(3*abs(x)) == 6 ", + "var x:=1; (3*abs(x))*2 == 6 ", + "var x:=1; 2*(abs(x)*3) == 6 ", + "var x:=1; (abs(x)*3)*2 == 6 ", + "var x:=1; 2*(3/abs(x)) == 6 ", + "var x:=1; (3/abs(x))*2 == 6 ", + "var x:=1; 2*(abs(x)/3) == (2/3)", + "var x:=1; (abs(x)/3)*2 == (2/3)", + "var x:=1; 2/(3*abs(x)) == (2/3)", + "var x:=1; (3*abs(x))/2 == (3/2)", + "var x:=1; 2/(abs(x)*3) == (2/3)", + "var x:=1; (abs(x)*3)/2 == (3/2)", + "var x:=1; 2/(3/abs(x)) == (2/3)", + "var x:=1; (3/abs(x))/2 == (3/2)", + "var x:=1; 2/(abs(x)/3) == 6 ", + "var x:=1; (abs(x)/3)/2 == (1/6)", + "var x:=3; var y:=6; -(-x)*-(-y) == 18", + "var x:=3; var y:=6; -(-x)*-(-(-y)) == -18", + "var x:=3; var y:=6; -(-(-x))*-(-y) == -18", + "var x:=3; var y:=6; -(-(-x))*-(-(-y)) == 18", + "var x:=3; var y:=6; -(-(x+y))*-(-(y+x)) == 81", + "var x:=3; var y:=6; -(-(-(x+y)))*-(-(y+x)) == -81", + "var x:=3; var y:=6; -(-(x+y))*-(-(-(y+x))) == -81", + "var x:=3; var y:=6; -(-(-(x+y)))*-(-(-(y+x))) == 81", + "var x:= 2; var y := 3; (-abs(x)+-abs(y)) == -5 ", + "var x:= 2; var y := 3; (-abs(x)--abs(y)) == 1 ", + "var x:= 2; var y := 3; (-abs(x)*-abs(y)) == 6 ", + "var x:= 2; var y := 3; (-abs(x)/-abs(y)) == (2/3) ", + "var x:= 2; var y := 3; (-abs(x)+abs(y)) == 1 ", + "var x:= 2; var y := 3; (-abs(x)-abs(y)) == -5 ", + "var x:= 2; var y := 3; (-abs(x)*abs(y)) == -6 ", + "var x:= 2; var y := 3; (-abs(x)/abs(y)) == -(2/3) ", + "var x:= 2; var y := 3; (abs(x)+-abs(y)) == -1 ", + "var x:= 2; var y := 3; (abs(x)--abs(y)) == 5 ", + "var x:= 2; var y := 3; (abs(x)*-abs(y)) == -6 ", + "var x:= 2; var y := 3; (abs(x)/-abs(y)) == -(2/3) ", + "var x:= 2; var y := 3; (-abs(x + 0)+-abs(y - 0)) == -5 ", + "var x:= 2; var y := 3; (-abs(x + 0)--abs(y - 0)) == 1 ", + "var x:= 2; var y := 3; (-abs(x + 0)*-abs(y - 0)) == 6 ", + "var x:= 2; var y := 3; (-abs(x + 0)/-abs(y - 0)) == (2/3) ", + "var x:= 2; var y := 3; (-abs(x + 0)+abs(y - 0)) == 1 ", + "var x:= 2; var y := 3; (-abs(x + 0)-abs(y - 0)) == -5 ", + "var x:= 2; var y := 3; (-abs(x + 0)*abs(y - 0)) == -6 ", + "var x:= 2; var y := 3; (-abs(x + 0)/abs(y - 0)) == -(2/3) ", + "var x:= 2; var y := 3; (abs(x + 0)+-abs(y - 0)) == -1 ", + "var x:= 2; var y := 3; (abs(x + 0)--abs(y - 0)) == 5 ", + "var x:= 2; var y := 3; (abs(x + 0)*-abs(y - 0)) == -6 ", + "var x:= 2; var y := 3; (abs(x + 0)/-abs(y - 0)) == -(2/3) ", + "var x := 1; var y := 2; swap(x,y); (x == 2) and (y == 1)", + "var x := 1; var y := 2; x <=> y ; (x == 2) and (y == 1)", + "var v[2] := {1,2}; swap(v[0],v[1]); (v[0] == 2) and (v[1] == 1)", + "var v[2] := {1,2}; v[0] <=> v[1] ; (v[0] == 2) and (v[1] == 1)", + "var x := 1; var y := 2; ~(swap(x,y),(x == 2) and (y == 1))", + "var x := 1; var y := 2; ~(x <=> y , (x == 2) and (y == 1))", + "var v[2] := {1,2}; ~(swap(v[0],v[1]), (v[0] == 2) and (v[1] == 1))", + "var v[2] := {1,2}; ~(v[0] <=> v[1] , (v[0] == 2) and (v[1] == 1))", + "var v[2] := {1,2}; swap(v[zero],v[one]); (v[zero] == 2) and (v[one] == 1)", + "var v[2] := {1,2}; v[zero] <=> v[one] ; (v[zero] == 2) and (v[one] == 1)", + "var v[2] := {1,2}; ~(swap(v[zero],v[one]), (v[zero] == 2) and (v[one] == 1))", + "var v[2] := {1,2}; ~(v[zero] <=> v[one] , (v[zero] == 2) and (v[one] == 1))", + "var v[2] := {1,2}; swap(v[2 * zero],v[(2 * one) / (1 + 1)]); (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1)", + "var v[2] := {1,2}; v[2 * zero] <=> v[(2*one)/(1+1)] ; (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1)", + "var v[2] := {1,2}; ~(swap(v[2 * zero],v[(2 * one) / (1 + 1)]), (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1))", + "var v[2] := {1,2}; ~(v[2 * zero] <=> v[(2 * one) / (1 + 1)] , (v[2 * zero] == 2) and (v[(2 * one) / (1 + 1)] == 1))", + "var x := 1; var y := 2; var v[2] := {3,4}; swap(x,v[0]); swap(v[1],y); (x == 3) and (y == 4)", + "var x := 1; var y := 2; var v[2] := {3,4}; x <=> v[0]; v[1] <=> y; (x == 3) and (y == 4)", + "var x := 1; var y := 2; var v[2] := {3,4}; swap(x,v[zero]); swap(v[one],y); (x == 3) and (y == 4)", + "var x := 1; var y := 2; var v[2] := {3,4}; x <=> v[zero]; v[one] <=> y; (x == 3) and (y == 4)", + "var x := 1; var y := 2; var v[2] := {3,4}; swap(x,v[2 * zero]); swap(v[(2 * one) / (1 + 1)],y); (x == 3) and (y == 4)", + "var x := 1; var y := 2; var v[2] := {3,4}; x <=> v[zero / 3]; v[(2 * one)/(1 + 1)] <=> y; (x == 3) and (y == 4)", + "~{ var x := 1 } + ~{ var x := 2 } == 3", + "(~{ var x := 1 } + ~{ var x := 2 }) == (~{ var x := 2 } + ~{ var x := 1 })", + "(~{ var x := 1 } + ~{ var x := 2 } + ~{~{ var x := 1 } + ~{ var x := 2 }}) == 6", + "(~{ var x[1] := [1] } + ~{ var x[1] := [2] } + ~{~{ var x[1] := [1] } + ~{ var x[1] := [2] }}) == 6", + "(~{ var x := [1] } + ~{ var x[1] := [2] } + ~{~{ var x[1] := [1] } + ~{ var x[1] := [2] }}) == 6", + "(~{ var x[1] := [1] } + ~{ var x := [2] } + ~{~{ var x[1] := [1] } + ~{ var x[1] := [2] }}) == 6", + "(~{ var x[1] := [1] } + ~{ var x[1] := [2] } + ~{~{ var x := [1] } + ~{ var x[1] := [2] }}) == 6", + "(~{ var x[1] := [1] } + ~{ var x[1] := [2] } + ~{~{ var x[1] := [1] } + ~{ var x := [2] }}) == 6", + "(~{~{ var x[1] := [1] } + ~{ var x[1] := [2] }} + ~{ var x[1] := [1] } + ~{ var x[1] := [2] }) == 6", + "(~{~{ var x := [1] } + ~{ var x[1] := [2] }} + ~{ var x[1] := [1] } + ~{ var x[1] := [2] }) == 6", + "(~{~{ var x[1] := [1] } + ~{ var x := [2] }} + ~{ var x[1] := [1] } + ~{ var x[1] := [2] }) == 6", + "(~{~{ var x[1] := [1] } + ~{ var x[1] := [2] }} + ~{ var x := [1] } + ~{ var x[1] := [2] }) == 6", + "(~{~{ var x[1] := [1] } + ~{ var x[1] := [2] }} + ~{ var x[1] := [1] } + ~{ var x := [2] }) == 6", + "(~{~{ var x[1] := [1] }} + ~{ var x[1] := [1] } + ~{ var x[1] := [2] } + ~{{ var x[1] := [2] }}) == 6", + "(~{~{ var x := [1] }} + ~{ var x[1] := [1] } + ~{ var x[1] := [2] } + ~{{ var x[1] := [2] }}) == 6", + "(~{~{ var x[1] := [1] }} + ~{ var x := [1] } + ~{ var x[1] := [2] } + ~{{ var x[1] := [2] }}) == 6", + "(~{~{ var x[1] := [1] }} + ~{ var x[1] := [1] } + ~{ var x := [2] } + ~{{ var x[1] := [2] }}) == 6", + "(~{~{ var x[1] := [1] }} + ~{ var x[1] := [1] } + ~{ var x[1] := [2] } + ~{{ var x := [2] }}) == 6", + "(~{ var x[3] := [1] } + ~{ var x[6] := {6,5,4,3,2,1}}) == 7", + "(~{ var x[6] := {6,5,4,3,2,1} } + ~{ var x := 1 }) == 7", + "(~{ var x := 1 } + ~{ var x[6] := {6,5,4,3,2,1} }) == 7", + "var x[3] := {}; (x[0] == 0) and (x[1] == 0) and (x[2] == 0)", + "var x[3] := {1,2}; (x[0] == 1) and (x[1] == 2) and (x[2] == 0)", + "var x[3] := {1,2,3}; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", + "var x[3] := [1]; (x[0] == 1) and (x[1] == 1) and (x[2] == 1)", + "var v[3] := [1]; v += 1; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 2)", + "var v[3] := [1]; v -= 1; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 0)", + "var v[3] := [1]; v *= 2; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 2)", + "var v[3] := [3]; v /= 3; (v[0] == v[1]) and (v[0] == v[2]) and (v[0] == 1)", + "var v[3] := {1,2, 3}; v += 1; (v[0] == 2) and (v[1] == 3) and (v[2] == 4)", + "var v[3] := {1,2, 3}; v -= 1; (v[0] == 0) and (v[1] == 1) and (v[2] == 2)", + "var v[3] := {1,2, 3}; v *= 2; (v[0] == 2) and (v[1] == 4) and (v[2] == 6)", + "var v[3] := {3,9,15}; v /= 3; (v[0] == 1) and (v[1] == 3) and (v[2] == 5)", + "var v0[3] := [1]; var v1[3] := [1]; v0 += v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 2)", + "var v0[3] := [1]; var v1[3] := [1]; v0 -= v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 0)", + "var v0[3] := [1]; var v1[3] := [2]; v0 *= v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 2)", + "var v0[3] := [3]; var v1[3] := [3]; v0 /= v1; (v0[0] == v0[1]) and (v0[0] == v0[2]) and (v0[0] == 1)", + "var v0[3] := {1,2, 3}; var v1[3] := {1,1,1}; v0 += v1; (v0[0] == 2) and (v0[1] == 3) and (v0[2] == 4)", + "var v0[3] := {1,2, 3}; var v1[3] := {1,1,1}; v0 -= v1; (v0[0] == 0) and (v0[1] == 1) and (v0[2] == 2)", + "var v0[3] := {1,2, 3}; var v1[3] := {2,2,2}; v0 *= v1; (v0[0] == 2) and (v0[1] == 4) and (v0[2] == 6)", + "var v0[3] := {3,9,15}; var v1[3] := {3,3,3}; v0 /= v1; (v0[0] == 1) and (v0[1] == 3) and (v0[2] == 5)", + "var x[3] := {}; var y[4] := {1,2,3,4}; x := y; (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", + "var x[3] := {}; var y[3] := {1,2,3}; x := y; (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", + "var x[3] := {}; var y[2] := {1,2}; x := y; (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == 0)", + "var x[3] := {}; var y[1] := {1}; x := y; (x[0] == y[0]) and (x[1] == 0) and (x[2] == 0)", + "var x[3] := {}; var y[4] := {1,2,3,4}; x := (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", + "var x[3] := {}; var y[3] := {1,2,3}; x := (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", + "var x[3] := {}; var y[2] := {1,2}; x := (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == 0)", + "var x[3] := {}; var y[1] := {1}; x := (y+=1); (x[0] == y[0]) and (x[1] == 0) and (x[2] == 0)", + "var x[3] := {}; var y[4] := {1,2,3,4}; x += (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", + "var x[3] := {}; var y[3] := {1,2,3}; x += (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == y[2])", + "var x[3] := {}; var y[2] := {1,2}; x += (y+=1); (x[0] == y[0]) and (x[1] == y[1]) and (x[2] == 0)", + "var x[3] := {}; var y[1] := {1}; x += (y+=1); (x[0] == y[0]) and (x[1] == 0) and (x[2] == 0)", + "var x[3] := [9]; var y[4] := {1,2,3,4}; x <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", + "var x[3] := [9]; var y[3] := {1,2,3}; x <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", + "var x[3] := [9]; var y[2] := {1,2}; x <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 9)", + "var x[3] := [9]; var y[1] := {1}; x <=> y; (x[0] == 1) and (x[1] == 9) and (x[2] == 9)", + "var x[3] := [9]; var y[4] := {1,2,3,4}; x <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", + "var x[3] := [9]; var y[3] := {1,2,3}; x <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", + "var x[3] := [9]; var y[2] := {1,2}; x <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 9)", + "var x[3] := [9]; var y[1] := {1}; x <=> (y += 1); (x[0] == 2) and (x[1] == 9) and (x[2] == 9)", + "var x[3] := [8]; var y[4] := {1,2,3,4}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", + "var x[3] := [8]; var y[3] := {1,2,3}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 3)", + "var x[3] := [8]; var y[2] := {1,2}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 2) and (x[2] == 9)", + "var x[3] := [8]; var y[1] := {1}; (x += 1) <=> y; (x[0] == 1) and (x[1] == 9) and (x[2] == 9)", + "var x[3] := [8]; var y[4] := {1,2,3,4}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", + "var x[3] := [8]; var y[3] := {1,2,3}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 4)", + "var x[3] := [8]; var y[2] := {1,2}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 3) and (x[2] == 9)", + "var x[3] := [8]; var y[1] := {1}; (x += 1) <=> (y += 1); (x[0] == 2) and (x[1] == 9) and (x[2] == 9)", + "var x[3] := [0]; var y[4] := {1,2,3,4}; x < y", + "var x[3] := [0]; var y[3] := {1,2,3}; x < y", + "var x[3] := [0]; var y[2] := {1,2}; x < y", + "var x[3] := [0]; var y[1] := {1}; x < y", + "var x[3] := [0]; var y[4] := {1,2,3,4}; x <= y", + "var x[3] := [0]; var y[3] := {1,2,3}; x <= y", + "var x[3] := [0]; var y[2] := {1,2}; x <= y", + "var x[3] := [0]; var y[1] := {1}; x <= y", + "var x[3] := [5]; var y[4] := {1,2,3,4}; x > y", + "var x[3] := [5]; var y[3] := {1,2,3}; x > y", + "var x[3] := [5]; var y[2] := {1,2}; x > y", + "var x[3] := [5]; var y[1] := {1}; x > y", + "var x[3] := [5]; var y[4] := {1,2,3,4}; x >= y", + "var x[3] := [5]; var y[3] := {1,2,3}; x >= y", + "var x[3] := [5]; var y[2] := {1,2}; x >= y", + "var x[3] := [5]; var y[1] := {1}; x >= y", + "var x[3] := [1]; var y[4] := [1]; x == y", + "var x[3] := [1]; var y[3] := [1]; x == y", + "var x[3] := [1]; var y[2] := [1]; x == y", + "var x[3] := [1]; var y[1] := [1]; x == y", + "var x[3] := [1]; var y[4] := [2]; x != y", + "var x[3] := [1]; var y[3] := [2]; x != y", + "var x[3] := [1]; var y[2] := [2]; x != y", + "var x[3] := [1]; var y[1] := [2]; x != y", + "var x[3] := [0]; var y[4] := {5,6,7,8}; (x += 1) < y", + "var x[3] := [0]; var y[3] := {5,6,7}; (x += 1) < y", + "var x[3] := [0]; var y[2] := {5,6}; (x += 1) < y", + "var x[3] := [0]; var y[1] := {5}; (x += 1) < y", + "var x[3] := [0]; var y[4] := {1,2,3,4}; x < (y += 1)", + "var x[3] := [0]; var y[3] := {1,2,3}; x < (y += 1)", + "var x[3] := [0]; var y[2] := {1,2}; x < (y += 1)", + "var x[3] := [0]; var y[1] := {1}; x < (y += 1)", + "var x[3] := [0]; var y[4] := {5,6,7,8}; (x += 1) < (y += 1)", + "var x[3] := [0]; var y[3] := {5,6,7}; (x += 1) < (y += 1)", + "var x[3] := [0]; var y[2] := {5,6}; (x += 1) < (y += 1)", + "var x[3] := [0]; var y[1] := {5}; (x += 1) < (y += 1)", + "var x[3] := {1,2,3}; var y := 5; x < y ", + "var x[3] := {1,2,3}; var y := 3; x < y + 1 ", + "var x[3] := {1,2,3}; var y := 5; x <= y ", + "var x[3] := {1,2,3}; var y := 3; x <= y + 1", + "var x[3] := {1,1,1}; var y := 1; x == y ", + "var x[3] := {1,1,1}; var y := 2; x == y - 1", + "var x[3] := {1,2,3}; var y := 5; y > x ", + "var x[3] := {1,2,3}; var y := 3; y >= x ", + "var x[3] := {1,2,3}; var y := 5; y + 1 > x ", + "var x[3] := {1,1,1}; var y := 1; y == x ", + "var x[3] := {1,1,1}; var y := 2; y - 1 == x", + "var x[3] := {1,2,3}; var y := 5; (x += 1) < y ", + "var x[3] := {1,2,3}; var y := 3; (x -= 1) < y + 1 ", + "var x[3] := {1,2,3}; var y := 5; (x -= 1) <= y ", + "var x[3] := {2,2,2}; var y := 1; (x -= 1) == y ", + "var x[3] := {1,2,3}; var y := 5; y > (x += 1) ", + "var x[3] := {1,2,3}; var y := 5; y + 1 > (x += 1) ", + "var x[3] := {2,2,2}; var y := 1; y == (x -= 1) ", + "var x[3] := {2,2,2}; var y := 0; y + 1 == (x -= 1)", + "var x[3] := [1]; var y[4] := {1,2,3,4}; var z[3] := [1]; z := (x + y); z == (x + y)", + "var x[3] := [1]; var y[3] := {1,2,3}; var z[3] := [1]; z := (x - y); z == (x - y)", + "var x[3] := [1]; var y[2] := {1,2}; var z[3] := [1]; z := (x / y); z == (x / y)", + "var x[3] := [1]; var y[1] := {1}; var z[3] := [1]; z := (x * y); z == (x * y)", + "var x[3] := [1]; var y[4] := {1,2,3,4}; var z[3] := [1]; z := 2(x + y); z == (x + y)2", + "var x[3] := [1]; var y[3] := {1,2,3}; var z[3] := [1]; z := 2(x - y); z == (x - y)2", + "var x[3] := [1]; var y[2] := {1,2}; var z[3] := [1]; z := 2(x / y); z == (x / y)2", + "var x[3] := [1]; var y[1] := {1}; var z[3] := [1]; z := 2(x * y); z == (x * y)2", + "var x[3] := [1]; var y[4] := {1,2,3,4}; var z[3] := [1]; z := 2(x + y)/3; z == 2(x + y)/3", + "var x[3] := [1]; var y[3] := {1,2,3}; var z[3] := [1]; z := 2(x - y)/3; z == 2(x - y)/3", + "var x[3] := [1]; var y[2] := {1,2}; var z[3] := [1]; z := 2(x / y)/3; z == 2(x / y)/3", + "var x[3] := [1]; var y[1] := {1}; var z[3] := [1]; z := 2(x * y)/3; z == 2(x * y)/3", + "var x[6] := {1,2,3,4,5,6}; equal(sqrt(sum([x - avg(x)]^2) / x[]),1.7078251277)", + "var x[3] := {-1,-2,-3}; sum(abs(x) ) == 6", + "var x[3] := {0.1,0.2,0.3}; sum(trunc(x)) == 0", - "var x := 2; (~{ for (var i := 0; i < 10; i += 1) { for (var j := 0; j <= i; " - "j += 1) { var y := 3; if ((i + j + y + x) < 6) { y += x; continue; } else " - "break[i + j]; } } } + ~{ for (var i := 0; i < 10; i += 1) { for (var j := 0; " - "j <= i; j += 1) { var y := 3; if ((i + j + y + x) < 6) { y += x; continue; } " - " else break[i + j]; } } }) == 18 ", + "var x := 2; (~{ for (var i := 0; i < 10; i += 1) { for (var j := 0; j <= i; " + "j += 1) { var y := 3; if ((i + j + y + x) < 6) { y += x; continue; } else " + "break[i + j]; } } } + ~{ for (var i := 0; i < 10; i += 1) { for (var j := 0; " + "j <= i; j += 1) { var y := 3; if ((i + j + y + x) < 6) { y += x; continue; } " + " else break[i + j]; } } }) == 18 ", - "var x := 2; var v0[3] := {1,2,3}; ( ~{ for (var i := 0; i < 10; i += 1) { " - "for (var j := 0; j <= i; j += 1) { var y := 3; var v2[3] := {1,2,3}; if ( " - "(i + j + y + x + abs(v0[i % v0[]] - v2[j % v2[]])) < 6) { var v3[3] := " - "{1,2,3}; y += x / v3[j % v3[]]; continue; } else break[i + j]; } } } " - "+ ~{ for (var i := 0; i < 10; i += 1) { for (var j := 0; j <= i; j += 1) " - " { var y := 3; var v2[3] := {1,2,3}; if ((i + j + y + x + abs(v0[i % v0[]] - " - "v2[j % v2[]])) < 6) { var v3[3] := {1,2,3}; y += x / v3[j % v3[]]; " - "continue; } else break[i + j]; } } } ) == 18 " + "var x := 2; var v0[3] := {1,2,3}; ( ~{ for (var i := 0; i < 10; i += 1) { " + "for (var j := 0; j <= i; j += 1) { var y := 3; var v2[3] := {1,2,3}; if ( " + "(i + j + y + x + abs(v0[i % v0[]] - v2[j % v2[]])) < 6) { var v3[3] := " + "{1,2,3}; y += x / v3[j % v3[]]; continue; } else break[i + j]; } } } " + "+ ~{ for (var i := 0; i < 10; i += 1) { for (var j := 0; j <= i; j += 1) " + " { var y := 3; var v2[3] := {1,2,3}; if ((i + j + y + x + abs(v0[i % v0[]] - " + "v2[j % v2[]])) < 6) { var v3[3] := {1,2,3}; y += x / v3[j % v3[]]; " + "continue; } else break[i + j]; } } } ) == 18 ", + + "12 == (if (1 > 2) { var x:= 2; } else { var x[3] := {7,2,3}; sum(x); })", + "12 == (if (1 < 2) { var x[3] := {7,2,3}; sum(x); } else { var x:= 2; })", + "12 == (if (1 > 2) { var x:= 2; } else { var x[3] := {7,2,3}; sum(x); })", + "12 == (if (1 < 2) { var x[3] := {7,2,3}; sum(x); } else { var x:= 2; })" }; const std::size_t expression_list_size = sizeof(expression_list) / sizeof(std::string); @@ -3916,7 +3950,8 @@ inline bool run_test10() parser.error().c_str(), expression_list[i].c_str()); - return false; + failed = true; + continue; } } @@ -3926,6 +3961,7 @@ inline bool run_test10() { printf("run_test10() - swaps evaluation error Expression: %s\n", expression_list[i].c_str()); + failed = true; } } @@ -4024,30 +4060,30 @@ inline bool run_test12() typedef exprtk::expression expression_t; static const std::string expression_string[] = { - "equal(poly01(x,2.2,1.1),(2.2x^1+1.1))", - "equal(poly02(x,3.3,2.2,1.1),(3.3x^2+2.2x^1+1.1))", - "equal(poly03(x,4.4,3.3,2.2,1.1),(4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly04(x,5.5,4.4,3.3,2.2,1.1),(5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly05(x,6.6,5.5,4.4,3.3,2.2,1.1),(6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly06(x,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly07(x,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly08(x,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly09(x,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly10(x,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly11(x,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equal(poly12(x,4.4,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(4.4x^12+3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "EquaL(Poly01(x,2.2,1.1),(2.2x^1+1.1))", - "eQuAl(pOly02(x,3.3,2.2,1.1),(3.3x^2+2.2x^1+1.1))", - "eqUal(poLy03(x,4.4,3.3,2.2,1.1),(4.4x^3+3.3x^2+2.2x^1+1.1))", - "eQuAl(polY04(x,5.5,4.4,3.3,2.2,1.1),(5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "EquAl(pOLy05(x,6.6,5.5,4.4,3.3,2.2,1.1),(6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "EqUaL(pOly06(x,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "Equal(Poly07(x,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "eQual(PoLy08(x,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "eqUal(pOlY09(x,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equAl(POLY10(x,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "equaL(PolY11(x,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", - "EQUAL(pOLy12(x,4.4,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(4.4x^12+3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))" + "equal(poly01(x,2.2,1.1),(2.2x^1+1.1))", + "equal(poly02(x,3.3,2.2,1.1),(3.3x^2+2.2x^1+1.1))", + "equal(poly03(x,4.4,3.3,2.2,1.1),(4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly04(x,5.5,4.4,3.3,2.2,1.1),(5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly05(x,6.6,5.5,4.4,3.3,2.2,1.1),(6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly06(x,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly07(x,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly08(x,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly09(x,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly10(x,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly11(x,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equal(poly12(x,4.4,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(4.4x^12+3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "EquaL(Poly01(x,2.2,1.1),(2.2x^1+1.1))", + "eQuAl(pOly02(x,3.3,2.2,1.1),(3.3x^2+2.2x^1+1.1))", + "eqUal(poLy03(x,4.4,3.3,2.2,1.1),(4.4x^3+3.3x^2+2.2x^1+1.1))", + "eQuAl(polY04(x,5.5,4.4,3.3,2.2,1.1),(5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "EquAl(pOLy05(x,6.6,5.5,4.4,3.3,2.2,1.1),(6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "EqUaL(pOly06(x,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "Equal(Poly07(x,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "eQual(PoLy08(x,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "eqUal(pOlY09(x,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equAl(POLY10(x,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "equaL(PolY11(x,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))", + "EQUAL(pOLy12(x,4.4,3.3,2.2,1.1,9.9,8.8,7.7,6.6,5.5,4.4,3.3,2.2,1.1),(4.4x^12+3.3x^11+2.2x^10+1.1x^9+9.9x^8+8.8x^7+7.7x^6+6.6x^5+5.5x^4+4.4x^3+3.3x^2+2.2x^1+1.1))" }; static const std::size_t expression_string_size = sizeof(expression_string) / sizeof(std::string); @@ -4142,65 +4178,139 @@ struct cosine_deg : public exprtk::ifunction template inline bool run_test13() { - typedef exprtk::expression expression_t; + typedef exprtk::symbol_table symbol_table_t; + typedef exprtk::expression expression_t; + typedef exprtk::parser parser_t; + static const std::string expression_string[] = { - "equal(sin(30),0.5)", - "equal(cos(60),0.5)", - "equal(sin(60),sqrt(3)/2)", - "equal(cos(30),sqrt(3)/2)", - "equal(sin(x_deg),0.5)", - "equal(cos(y_deg),0.5)", - "equal(sin(y_deg),sqrt(3)/2)", - "equal(cos(x_deg),sqrt(3)/2)", + "equal(sin(30),0.5) ", + "equal(cos(60),0.5) ", + "equal(sin(60),sqrt(3)/2) ", + "equal(cos(30),sqrt(3)/2) ", + "equal(sin(x_deg),0.5) ", + "equal(cos(y_deg),0.5) ", + "equal(sin(y_deg),sqrt(3)/2) ", + "equal(cos(x_deg),sqrt(3)/2) ", + "equal(sin(30) + sin(30),1.0) ", + "equal(cos(60) + cos(60),1.0) ", + "equal(sin(60) + sin(60),sqrt(3)) ", + "equal(cos(30) + cos(30),sqrt(3)) ", + "equal(sin(x_deg) + sin(x_deg),1.0) ", + "equal(cos(y_deg) + cos(y_deg),1.0) ", + "equal(sin(y_deg) + sin(y_deg),sqrt(3))", + "equal(cos(x_deg) + cos(x_deg),sqrt(3))" }; + static const std::size_t expression_string_size = sizeof(expression_string) / sizeof(std::string); - T x_deg = T(30); - T y_deg = T(60); - - sine_deg sine; - cosine_deg cosine; - - exprtk::symbol_table symbol_table; - - symbol_table.add_variable("x_deg",x_deg); - symbol_table.add_variable("y_deg",y_deg); - - symbol_table.add_function("sine_deg",sine); - symbol_table.add_function("cosine_deg",cosine); - - expression_t expression; - expression.register_symbol_table(symbol_table); - - static const std::size_t rounds = 100; - - for (std::size_t i = 0; i < rounds; ++i) { - for (std::size_t j = 0; j < expression_string_size; ++j) + T x_deg = T(30); + T y_deg = T(60); + + sine_deg sine; + cosine_deg cosine; + + symbol_table_t symbol_table_0; + symbol_table_t symbol_table_1; + + symbol_table_0.add_variable("x_deg",x_deg); + symbol_table_1.add_variable("y_deg",y_deg); + + symbol_table_0.add_function( "sine_deg", sine); + symbol_table_1.add_function("cosine_deg", cosine); + + expression_t expression; + + expression.register_symbol_table(symbol_table_0); + expression.register_symbol_table(symbol_table_1); + + static const std::size_t rounds = 100; + + for (std::size_t i = 0; i < rounds; ++i) { - const std::string& expr_str = expression_string[j]; - + for (std::size_t j = 0; j < expression_string_size; ++j) { - exprtk::parser parser; + const std::string& expr_str = expression_string[j]; - parser.replace_symbol("sin","sine_deg"); - parser.replace_symbol("cos","cosine_deg"); - - if (!parser.compile(expr_str,expression)) { - printf("run_test13() - Error: %s Expression: %s\n", - parser.error().c_str(), - expr_str.c_str()); + parser_t parser; + parser.replace_symbol("sin", "sine_deg"); + parser.replace_symbol("cos", "cosine_deg"); + + if (!parser.compile(expr_str,expression)) + { + printf("run_test13() - Error: %s Expression: %s [1]\n", + parser.error().c_str(), + expr_str.c_str()); + + return false; + } + } + + if (T(1) != expression.value()) + { + printf("run_test13() - Error in evaluation! Expression: %s [1]\n",expr_str.c_str()); return false; } } + } + } - if (T(1) != expression.value()) + { + T x_deg = T(30); + T y_deg = T(60); + + sine_deg sine; + cosine_deg cosine; + + symbol_table_t symbol_table_0; + symbol_table_t symbol_table_1; + + symbol_table_0.add_variable("x_deg",x_deg); + symbol_table_1.add_variable("y_deg",y_deg); + + symbol_table_0.add_reserved_function("sin", sine); + symbol_table_1.add_reserved_function("cos",cosine); + + expression_t expression; + + expression.register_symbol_table(symbol_table_0); + expression.register_symbol_table(symbol_table_1); + + static const std::size_t rounds = 100; + + for (std::size_t i = 0; i < rounds; ++i) + { + for (std::size_t j = 0; j < expression_string_size; ++j) { - printf("run_test13() - Error in evaluation! Expression: %s\n",expr_str.c_str()); - return false; + const std::string& expr_str = expression_string[j]; + + { + typedef typename parser_t::settings_store settings_t; + + parser_t parser; + + parser.settings() + .disable_base_function(settings_t::e_bf_sin) + .disable_base_function(settings_t::e_bf_cos); + + if (!parser.compile(expr_str,expression)) + { + printf("run_test13() - Error: %s Expression: %s [2]\n", + parser.error().c_str(), + expr_str.c_str()); + + return false; + } + } + + if (T(1) != expression.value()) + { + printf("run_test13() - Error in evaluation! Expression: %s [2]\n",expr_str.c_str()); + return false; + } } } } @@ -4359,24 +4469,24 @@ inline bool run_test15() static const std::string expr_str_list[] = { - "2 - (x + y) / z//Comment 01 ", - "2 - (x + y) / z#Comment 02 ", - "2 - (x + y) / z //Comment 03 ", - "2 - (x + y) / z #Comment 04 ", - "2 - (x + y) / z//Comment 05 \n", - "2 - (x + y) / z#Comment 06 \n", - "2 - (x + y) / z //Comment 07\n", - "2 - (x + y) / z #Comment 08 \n", - "/* Comment 09*/2 - (x + y) / z", - "/* Comment 10*/2 - (x + y) / z\n", - "/* Comment 11*/2 - (x + y) / z/* Comment 12*/", - "/* Comment 13*/2 - (x + y) / z/* Comment 14*/\n", - "2 - /* Comment 15 */(x + y) / z", - "2 - /* Comment 16 */(x + y) /* Comment 17 *// z \n", - "2 - /* Comment 18 */(x + y) /* Comment 19 */ / z //Comment 20\n", - "2 - /* Comment 21 */(x + y) /* Comment 22 */ / z #Comment 23\n", - "2 - /* Comment 24 */(x + y) /* Comment 25 */ / z //Comment 26", - "2 - /* Comment 27 */(x + y) /* Comment 28 */ / z #Comment 29" + "2 - (x + y) / z//Comment 01 ", + "2 - (x + y) / z#Comment 02 ", + "2 - (x + y) / z //Comment 03 ", + "2 - (x + y) / z #Comment 04 ", + "2 - (x + y) / z//Comment 05 \n", + "2 - (x + y) / z#Comment 06 \n", + "2 - (x + y) / z //Comment 07\n", + "2 - (x + y) / z #Comment 08 \n", + "/* Comment 09*/2 - (x + y) / z", + "/* Comment 10*/2 - (x + y) / z\n", + "/* Comment 11*/2 - (x + y) / z/* Comment 12*/", + "/* Comment 13*/2 - (x + y) / z/* Comment 14*/\n", + "2 - /* Comment 15 */(x + y) / z", + "2 - /* Comment 16 */(x + y) /* Comment 17 *// z \n", + "2 - /* Comment 18 */(x + y) /* Comment 19 */ / z //Comment 20\n", + "2 - /* Comment 21 */(x + y) /* Comment 22 */ / z #Comment 23\n", + "2 - /* Comment 24 */(x + y) /* Comment 25 */ / z //Comment 26", + "2 - /* Comment 27 */(x + y) /* Comment 28 */ / z #Comment 29" }; static const std::size_t expr_str_list_size = sizeof(expr_str_list) / sizeof(std::string); @@ -4495,69 +4605,69 @@ inline bool run_test16() static const std::string expr_str_list[] = { - "test_func0 = test_func0()", - "test_func0 == test_func0()", - "equal(1.1 + test_func0,test_func0() + 1.1)", - "equal(test_func0 + 1.1,1.1 + test_func0())", - "equal((1.1 + test_func0),(test_func0() + 1.1))", - "equal((test_func0 + 1.1),(1.1 + test_func0()))", - "equal(test_func0,test_func0())", - "equal(test_func0,1.1234)", - "equal(test_func0(),1.1234)", - "equal(test_func0 + test_func0(),2 * 1.1234)", - "equal((test_func0 + test_func0()),2 * 1.1234)", - "equal((test_func0) + (test_func0()),2 * 1.1234)", - "equal(test_func1(x),(x))", - "equal(test_func2(x,y),(x + y))", - "equal(test_func3(x,y,z),(x + y + z))", - "equal(test_func4(x,y,z,w),(x + y + z + w))", - "equal(test_func5(x,y,z,w,u),(x + y + z + w + u))", - "equal(1.1 + test_func0,1.1234 + 1.1)", - "equal(1.1 + test_func0(),1.1234 + 1.1)", - "equal(1.1 + test_func1(x),(x + 1.1))", - "equal(1.1 + test_func2(x,y),(x + y + 1.1))", - "equal(1.1 + test_func3(x,y,z),(x + y + z + 1.1))", - "equal(1.1 + test_func4(x,y,z,w),(x + y + z + w + 1.1))", - "equal(1.1 + test_func5(x,y,z,w,u),(x + y + z + w + u + 1.1))", - "equal(test_func0 + 2.2,1.1234 + 2.2)", - "equal(test_func0() + 2.2,1.1234 + 2.2)", - "equal(test_func1(x) + 2.2,(x + 2.2))", - "equal(test_func2(x,y) + 2.2,(x + y + 2.2))", - "equal(test_func3(x,y,z) + 2.2,(x + y + z + 2.2))", - "equal(test_func4(x,y,z,w) + 2.2,(x + y + z + w + 2.2))", - "equal(test_func5(x,y,z,w,u) + 2.2,(x + y + z + w + u + 2.2))", - "equal({[test_func1(x)]},{[(x)]})", - "equal({[test_func2(x,y)]},{[(x + y)]})", - "equal({[test_func3(x,y,z)]},{[(x + y + z)]})", - "equal({[test_func4(x,y,z,w)]},{[(x + y + z + w)]})", - "equal({[test_func5(x,y,z,w,u)]},{[(x + y + z + w + u)]})", - "equal(test_func1(2.12),(2.12))", - "equal(test_func2(2.12,3.12),(2.12 + 3.12))", - "equal(test_func3(2.12,3.12,4.12),(2.12 + 3.12 + 4.12))", - "equal(test_func4(2.12,3.12,4.12,5.12),(2.12 + 3.12 + 4.12 + 5.12))", - "equal(test_func5(2.12,3.12,4.12,5.12,6.12),(2.12 + 3.12 + 4.12 + 5.12 + 6.12))", - "equal(1.1 + test_func1(2.12),(2.12 + 1.1))", - "equal(1.1 + test_func2(2.12,3.12),(2.12 + 3.12 + 1.1))", - "equal(1.1 + test_func3(2.12,3.12,4.12),(2.12 + 3.12 + 4.12 + 1.1))", - "equal(1.1 + test_func4(2.12,3.12,4.12,5.12),(2.12 + 3.12 + 4.12 + 5.12 + 1.1))", - "equal(1.1 + test_func5(2.12,3.12,4.12,5.12,6.12),(2.12 + 3.12 + 4.12 + 5.12 + 6.12 + 1.1))", - "equal(test_func1(2.12) + 2.2,(2.12 + 2.2))", - "equal(test_func2(2.12,3.12) + 2.2,(2.12 + 3.12 + 2.2))", - "equal(test_func3(2.12,3.12,4.12) + 2.2,(2.12 + 3.12 + 4.12 + 2.2))", - "equal(test_func4(2.12,3.12,4.12,5.12) + 2.2,(2.12 + 3.12 + 4.12 + 5.12 + 2.2))", - "equal(test_func5(2.12,3.12,4.12,5.12,6.12) + 2.2,(2.12 + 3.12 + 4.12 + 5.12 + 6.12 + 2.2))", - "equal({[test_func1(2.12)]},{[(2.12)]})", - "equal({[test_func2(2.12,3.12)]},{[(2.12 + 3.12)]})", - "equal({[test_func3(2.12,3.12,4.12)]},{[(2.12 + 3.12 + 4.12)]})", - "equal({[test_func4(2.12,3.12,4.12,5.12)]},{[(2.12 + 3.12 + 4.12 + 5.12)]})", - "equal({[test_func5(2.12,3.12,4.12,5.12,6.12)]},{[(2.12 + 3.12 + 4.12 + 5.12 + 6.12)]})", - "TeSt_FuNc0 = tEsT_fUnC0()", - "TEst_fuNC0 == tESt_fUNc0()", - "EquaL(tEsT_FuNC1(x),(x))", - "eQuAl(teSt_fUnc2(x,y),(x + y))", - "EqUaL(tEsT_fUNc3(x,y,z),(x + y + z))", - "EQUal(TEst_FunC4(x,y,z,w),(x + y + z + w))", - "eqUAL(tEsT_FuNc5(x,y,z,w,u),(x + y + z + w + u))" + "test_func0 = test_func0()", + "test_func0 == test_func0()", + "equal(1.1 + test_func0,test_func0() + 1.1)", + "equal(test_func0 + 1.1,1.1 + test_func0())", + "equal((1.1 + test_func0),(test_func0() + 1.1))", + "equal((test_func0 + 1.1),(1.1 + test_func0()))", + "equal(test_func0,test_func0())", + "equal(test_func0,1.1234)", + "equal(test_func0(),1.1234)", + "equal(test_func0 + test_func0(),2 * 1.1234)", + "equal((test_func0 + test_func0()),2 * 1.1234)", + "equal((test_func0) + (test_func0()),2 * 1.1234)", + "equal(test_func1(x),(x))", + "equal(test_func2(x,y),(x + y))", + "equal(test_func3(x,y,z),(x + y + z))", + "equal(test_func4(x,y,z,w),(x + y + z + w))", + "equal(test_func5(x,y,z,w,u),(x + y + z + w + u))", + "equal(1.1 + test_func0,1.1234 + 1.1)", + "equal(1.1 + test_func0(),1.1234 + 1.1)", + "equal(1.1 + test_func1(x),(x + 1.1))", + "equal(1.1 + test_func2(x,y),(x + y + 1.1))", + "equal(1.1 + test_func3(x,y,z),(x + y + z + 1.1))", + "equal(1.1 + test_func4(x,y,z,w),(x + y + z + w + 1.1))", + "equal(1.1 + test_func5(x,y,z,w,u),(x + y + z + w + u + 1.1))", + "equal(test_func0 + 2.2,1.1234 + 2.2)", + "equal(test_func0() + 2.2,1.1234 + 2.2)", + "equal(test_func1(x) + 2.2,(x + 2.2))", + "equal(test_func2(x,y) + 2.2,(x + y + 2.2))", + "equal(test_func3(x,y,z) + 2.2,(x + y + z + 2.2))", + "equal(test_func4(x,y,z,w) + 2.2,(x + y + z + w + 2.2))", + "equal(test_func5(x,y,z,w,u) + 2.2,(x + y + z + w + u + 2.2))", + "equal({[test_func1(x)]},{[(x)]})", + "equal({[test_func2(x,y)]},{[(x + y)]})", + "equal({[test_func3(x,y,z)]},{[(x + y + z)]})", + "equal({[test_func4(x,y,z,w)]},{[(x + y + z + w)]})", + "equal({[test_func5(x,y,z,w,u)]},{[(x + y + z + w + u)]})", + "equal(test_func1(2.12),(2.12))", + "equal(test_func2(2.12,3.12),(2.12 + 3.12))", + "equal(test_func3(2.12,3.12,4.12),(2.12 + 3.12 + 4.12))", + "equal(test_func4(2.12,3.12,4.12,5.12),(2.12 + 3.12 + 4.12 + 5.12))", + "equal(test_func5(2.12,3.12,4.12,5.12,6.12),(2.12 + 3.12 + 4.12 + 5.12 + 6.12))", + "equal(1.1 + test_func1(2.12),(2.12 + 1.1))", + "equal(1.1 + test_func2(2.12,3.12),(2.12 + 3.12 + 1.1))", + "equal(1.1 + test_func3(2.12,3.12,4.12),(2.12 + 3.12 + 4.12 + 1.1))", + "equal(1.1 + test_func4(2.12,3.12,4.12,5.12),(2.12 + 3.12 + 4.12 + 5.12 + 1.1))", + "equal(1.1 + test_func5(2.12,3.12,4.12,5.12,6.12),(2.12 + 3.12 + 4.12 + 5.12 + 6.12 + 1.1))", + "equal(test_func1(2.12) + 2.2,(2.12 + 2.2))", + "equal(test_func2(2.12,3.12) + 2.2,(2.12 + 3.12 + 2.2))", + "equal(test_func3(2.12,3.12,4.12) + 2.2,(2.12 + 3.12 + 4.12 + 2.2))", + "equal(test_func4(2.12,3.12,4.12,5.12) + 2.2,(2.12 + 3.12 + 4.12 + 5.12 + 2.2))", + "equal(test_func5(2.12,3.12,4.12,5.12,6.12) + 2.2,(2.12 + 3.12 + 4.12 + 5.12 + 6.12 + 2.2))", + "equal({[test_func1(2.12)]},{[(2.12)]})", + "equal({[test_func2(2.12,3.12)]},{[(2.12 + 3.12)]})", + "equal({[test_func3(2.12,3.12,4.12)]},{[(2.12 + 3.12 + 4.12)]})", + "equal({[test_func4(2.12,3.12,4.12,5.12)]},{[(2.12 + 3.12 + 4.12 + 5.12)]})", + "equal({[test_func5(2.12,3.12,4.12,5.12,6.12)]},{[(2.12 + 3.12 + 4.12 + 5.12 + 6.12)]})", + "TeSt_FuNc0 = tEsT_fUnC0()", + "TEst_fuNC0 == tESt_fUNc0()", + "EquaL(tEsT_FuNC1(x),(x))", + "eQuAl(teSt_fUnc2(x,y),(x + y))", + "EqUaL(tEsT_fUNc3(x,y,z),(x + y + z))", + "EQUal(TEst_FunC4(x,y,z,w),(x + y + z + w))", + "eqUAL(tEsT_FuNc5(x,y,z,w,u),(x + y + z + w + u))" }; static const std::size_t expr_str_list_size = sizeof(expr_str_list) / sizeof(std::string); @@ -4629,53 +4739,53 @@ inline bool run_test17() static const std::string expr_str_list[] = { - "equal(mand(one,one),1.0)", - "equal(mand(one,zero),0.0)", - "equal(mand(zero,one),0.0)", - "equal(mand(zero,zero),0.0)", - "equal(mand(one,one),1.0)", - "equal(mand(one,one,one),1.0)", - "equal(mand(one,one,one,one),1.0)", - "equal(mand(one,one,one,one,one),1.0)", - "equal(mand(one,one,zero),0.0)", - "equal(mand(one,one,one,zero),0.0)", - "equal(mand(one,one,one,one,zero),0.0)", - "equal(mand(one,one,one,one,one,zero),0.0)", - "equal(mor(one,one),1.0)", - "equal(mor(one,zero),1.0)", - "equal(mor(zero,one),1.0)", - "equal(mor(zero,zero),0.0)", - "equal(mor(one,one),1.0)", - "equal(mor(one,one,zero),1.0)", - "equal(mor(one,zero,one),1.0)", - "equal(mor(one,zero,one,zero),1.0)", - "equal(mor(zero,one),1.0)", - "equal(mor(zero,zero,one),1.0)", - "equal(mor(zero,zero,zero,zero,one),1.0)", - "equal(mor(zero,zero,zero,zero,zero,one),1.0)", - "equal(mor(zero,zero,zero,zero,zero,zero,zero,zero),0.0)", - "equal((one nand one),not(mand(one,one)))", - "equal((one nand zero),not(mand(one,zero)))", - "equal((zero nand one),not(mand(zero,one)))", - "equal((zero nand zero),not(mand(zero,zero)))", - "equal((one nor one),not(mor(one,one)))", - "equal((one nor zero),not(mor(one,zero)))", - "equal((zero nor one),not(mor(zero,one)))", - "equal((zero nor zero),not(mor(zero,zero)))", - "equal(sum(x,y,z,w,u,v,t),(x+y+z+w+u+v+t))", - "equal(sum(x+t,y+v,z+u,w+w,u+z,v+y,t+x),2*(x+y+z+w+u+v+t))", - "equal(mul(x,y,z,w,u,v,t),(x*y*z*w*u*v*t))", - "equal(mul(x*t,y*v,z*u,w*w,u*z,v*y,t*x),(x*y*z*w*u*v*t)^2)", - "equal(sum(x,1.0,y,2.0,z,3.0,w,4.0,u,5.0,v,6.0,t),(x+y+z+w+u+v+t+21.0))", - "equal(sum(x+1.0,y+2.0,z+3.0,w+4.0,u+5.0,v+6.0,t),(x+y+z+w+u+v+t+21.0))", - "equal(mul(x,1.0,y,2.0,z,3.0,w,4.0,u,5.0,v,6.0,t),(x*y*z*w*u*v*t*720.0))", - "equal(mul(x*1.0,y*2.0,z*3.0,w*4.0,u*5.0,v*6.0,t),(x*y*z*w*u*v*t*720.0))", - "equal(min(x,y,z,w,u,v,t,zero),zero)", - "equal(min(x+y,z+w,u+v,t,zero),zero)", - "equal(max(one,x,y,z,w,u,v,t),t)", - "equal(max(x+y,z+w,u+v,t,one),u+v)", - "equal(avg(x,y,z,w,u,v,t),(x+y+z+w+u+v+t)/7.0)", - "equal(avg(x+t,y+v,z+u,w+w,u+z,v+y,t+x),2/7*(x+y+z+w+u+v+t))" + "equal(mand(one,one),1.0)", + "equal(mand(one,zero),0.0)", + "equal(mand(zero,one),0.0)", + "equal(mand(zero,zero),0.0)", + "equal(mand(one,one),1.0)", + "equal(mand(one,one,one),1.0)", + "equal(mand(one,one,one,one),1.0)", + "equal(mand(one,one,one,one,one),1.0)", + "equal(mand(one,one,zero),0.0)", + "equal(mand(one,one,one,zero),0.0)", + "equal(mand(one,one,one,one,zero),0.0)", + "equal(mand(one,one,one,one,one,zero),0.0)", + "equal(mor(one,one),1.0)", + "equal(mor(one,zero),1.0)", + "equal(mor(zero,one),1.0)", + "equal(mor(zero,zero),0.0)", + "equal(mor(one,one),1.0)", + "equal(mor(one,one,zero),1.0)", + "equal(mor(one,zero,one),1.0)", + "equal(mor(one,zero,one,zero),1.0)", + "equal(mor(zero,one),1.0)", + "equal(mor(zero,zero,one),1.0)", + "equal(mor(zero,zero,zero,zero,one),1.0)", + "equal(mor(zero,zero,zero,zero,zero,one),1.0)", + "equal(mor(zero,zero,zero,zero,zero,zero,zero,zero),0.0)", + "equal((one nand one),not(mand(one,one)))", + "equal((one nand zero),not(mand(one,zero)))", + "equal((zero nand one),not(mand(zero,one)))", + "equal((zero nand zero),not(mand(zero,zero)))", + "equal((one nor one),not(mor(one,one)))", + "equal((one nor zero),not(mor(one,zero)))", + "equal((zero nor one),not(mor(zero,one)))", + "equal((zero nor zero),not(mor(zero,zero)))", + "equal(sum(x,y,z,w,u,v,t),(x+y+z+w+u+v+t))", + "equal(sum(x+t,y+v,z+u,w+w,u+z,v+y,t+x),2*(x+y+z+w+u+v+t))", + "equal(mul(x,y,z,w,u,v,t),(x*y*z*w*u*v*t))", + "equal(mul(x*t,y*v,z*u,w*w,u*z,v*y,t*x),(x*y*z*w*u*v*t)^2)", + "equal(sum(x,1.0,y,2.0,z,3.0,w,4.0,u,5.0,v,6.0,t),(x+y+z+w+u+v+t+21.0))", + "equal(sum(x+1.0,y+2.0,z+3.0,w+4.0,u+5.0,v+6.0,t),(x+y+z+w+u+v+t+21.0))", + "equal(mul(x,1.0,y,2.0,z,3.0,w,4.0,u,5.0,v,6.0,t),(x*y*z*w*u*v*t*720.0))", + "equal(mul(x*1.0,y*2.0,z*3.0,w*4.0,u*5.0,v*6.0,t),(x*y*z*w*u*v*t*720.0))", + "equal(min(x,y,z,w,u,v,t,zero),zero)", + "equal(min(x+y,z+w,u+v,t,zero),zero)", + "equal(max(one,x,y,z,w,u,v,t),t)", + "equal(max(x+y,z+w,u+v,t,one),u+v)", + "equal(avg(x,y,z,w,u,v,t),(x+y+z+w+u+v+t)/7.0)", + "equal(avg(x+t,y+v,z+u,w+w,u+z,v+y,t+x),2/7*(x+y+z+w+u+v+t))" }; static const std::size_t expr_str_list_size = sizeof(expr_str_list) / sizeof(std::string); @@ -4933,21 +5043,21 @@ inline bool run_test18() static const std::string expr_str_list[] = { - "equal(va_func,(0))", - "equal(va_func(),(0))", - "equal(va_func(1,2,3,4,5,6,7,8,9),(1+2+3+4+5+6+7+8+9))", - "equal(va_func(1,x,3,y,5,z,7,w,9),(1+x+3+y+5+z+7+w+9))", - "equal(va_func(x,2,y,4,z,6,w,8,u),(x+2+y+4+z+6+w+8+u))", - "equal(va_func(x,y,z,w,u,v,t,1,2,3),(x+y+z+w+u+v+t+1+2+3))", - "equal(va_func(x,y,z,w,u,v,t),(x+y+z+w+u+v+t))", - "equal(va_func(x+t,y+v,z+u,w+w,u+z,v+y,t+x),2*(x+y+z+w+u+v+t))", - "equal(1+va_func(1,x,3,y,5,z,7,w,9),(1+x+3+y+5+z+7+w+9)+1)", - "equal(va_func(va_func(x,y,z,w,u,v,t),va_func(x,y,z,w,u,v,t)),2*(x+y+z+w+u+v+t))", - "equal(va_func(va_func(x),va_func(y),va_func(z)),va_func(x,y,z))", - "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(x)))))))),x)", - "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(123.456)))))))),123.456)", - "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(x+1)))))))),x+1)", - "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(x+y)))))))),x+y)" + "equal(va_func,(0))", + "equal(va_func(),(0))", + "equal(va_func(1,2,3,4,5,6,7,8,9),(1+2+3+4+5+6+7+8+9))", + "equal(va_func(1,x,3,y,5,z,7,w,9),(1+x+3+y+5+z+7+w+9))", + "equal(va_func(x,2,y,4,z,6,w,8,u),(x+2+y+4+z+6+w+8+u))", + "equal(va_func(x,y,z,w,u,v,t,1,2,3),(x+y+z+w+u+v+t+1+2+3))", + "equal(va_func(x,y,z,w,u,v,t),(x+y+z+w+u+v+t))", + "equal(va_func(x+t,y+v,z+u,w+w,u+z,v+y,t+x),2*(x+y+z+w+u+v+t))", + "equal(1+va_func(1,x,3,y,5,z,7,w,9),(1+x+3+y+5+z+7+w+9)+1)", + "equal(va_func(va_func(x,y,z,w,u,v,t),va_func(x,y,z,w,u,v,t)),2*(x+y+z+w+u+v+t))", + "equal(va_func(va_func(x),va_func(y),va_func(z)),va_func(x,y,z))", + "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(x)))))))),x)", + "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(123.456)))))))),123.456)", + "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(x+1)))))))),x+1)", + "equal(va_func(va_func(va_func(va_func(va_func(va_func(va_func(va_func(x+y)))))))),x+y)" }; static const std::size_t expr_str_list_size = sizeof(expr_str_list) / sizeof(std::string); @@ -6397,11 +6507,18 @@ inline bool run_test20() for (std::size_t i = 0; i < 100; ++i) { - exprtk::symbol_table symbol_table; - symbol_table.add_constants(); + exprtk::symbol_table symbol_table0; + exprtk::symbol_table symbol_table1; + exprtk::symbol_table symbol_table2; + exprtk::symbol_table symbol_table3; + + symbol_table0.add_constants(); expression_t expression; - expression.register_symbol_table(symbol_table); + expression.register_symbol_table(symbol_table0); + expression.register_symbol_table(symbol_table1); + expression.register_symbol_table(symbol_table2); + expression.register_symbol_table(symbol_table3); exprtk::parser parser; diff --git a/readme.txt b/readme.txt index 697c332..d256ff3 100644 --- a/readme.txt +++ b/readme.txt @@ -113,14 +113,14 @@ include path (e.g: /usr/include/). ExprTk has been built error and warning free using the following set of C++ compilers: - (*) GNU Compiler Collection (3.3+) - (*) Intel C++ Compiler (8.x+) - (*) Clang/LLVM (1.1+) - (*) PGI C++ (10.x+) - (*) Microsoft Visual Studio C++ Compiler (8.1+) - (*) Comeau C++ Compiler (4.3+) - (*) IBM XL C/C++ (9.x+) - (*) C++ Builder (XE4+) + (*) GNU Compiler Collection (3.3+) + (*) Intel C++ Compiler (8.x+) + (*) Clang/LLVM (1.1+) + (*) PGI C++ (10.x+) + (*) Microsoft Visual Studio C++ Compiler (8.1+) + (*) Comeau C++ Compiler (4.3+) + (*) IBM XL C/C++ (9.x+) + (*) C++ Builder (XE4+) @@ -442,7 +442,7 @@ of C++ compilers: | | eg: | | | 1. 'abc'[] == 3 | | | 2. var max_str_length := max(s0[],s1[],s2[],s3[]) | -| | 3. ('abc' + 'xyz')[] == 3 | +| | 3. ('abc' + 'xyz')[] == 6 | | | 4. (('abc' + 'xyz')[1:4])[] == 4 | +----------+---------------------------------------------------------+ @@ -604,12 +604,12 @@ expressions. The types are as follows: (1) Scalar Type The scalar type is a singular numeric value. The underlying type is that used to specialize the ExprTk components (float, double, long -double MPFR et al). +double, MPFR et al). (2) Vector Type The vector type is a fixed size sequence of scalar values. A vector -can be indexed resulting in a scalar value. Operations between a +can be indexed resulting in a scalar value. Operations between a vector and scalar will result in a vector with a size equal to that of the original vector, whereas operations between vectors will result in a vector of size equal to that of the smaller of the two. @@ -628,9 +628,9 @@ There are three primary components, that are specialized upon a given numeric type, which make up the core of ExprTk. The components are as follows: - 1. Symbol Table exprtk::symbol_table - 2. Expression exprtk::expression - 3. Parser exprtk::parser + (1) Symbol Table exprtk::symbol_table + (2) Expression exprtk::expression + (3) Parser exprtk::parser (1) Symbol Table @@ -735,13 +735,13 @@ Expression: z := (x + y^-2.345) * sin(pi / min(w - 7.3,v)) (3) Parser -A structure which takes as input a string representation of an -expression and attempts to compile said input with the result -being an instance of Expression. If an error is encountered -during the compilation process, the parser will stop compiling -and return an error status code, with a more detailed -description of the error(s) and its location within the input -provided by the 'get_error' interface. +A structure which takes as input a string representation of an +expression and attempts to compile said input with the result being an +instance of Expression. If an error is encountered during the +compilation process, the parser will stop compiling and return an +error status code, with a more detailed description of the error(s) +and its location within the input provided by the 'get_error' +interface. @@ -751,11 +751,11 @@ options to be used during the compilation process of expressions. An example instantiation of exprtk::parser where only the joiner, commutative and strength reduction options are enabled is as follows: - typedef exprtk::parser parser_t; + typedef exprtk::parser::settings_t settings_t; - std::size_t compile_options = parser_t::e_joiner + - parser_t::e_commutative_check + - parser_t::e_strength_reduction; + std::size_t compile_options = settings_t::e_joiner + + settings_t::e_commutative_check + + settings_t::e_strength_reduction; parser_t parser(compile_options); @@ -763,6 +763,15 @@ commutative and strength reduction options are enabled is as follows: Currently seven types of compile time options are supported, and enabled by default. The options and their explanations are as follows: + (1) Replacer + (2) Joiner + (3) Numeric Check + (4) Bracket Check + (5) Sequence Check + (6) Commutative Check + (7) Strength Reduction Check + + (1) Replacer (e_replacer) Enable replacement of specific tokens with other tokens. For example the token "true" of type symbol will be replaced with the numeric @@ -1084,6 +1093,7 @@ not a vector but rather a single value. var x[3] := { 1, 2, 3 }; + sum(x) == 6 sum(1 + 2x) == 15 avg(3x + 1) == 7 min(1 / x) == (1 / 3) @@ -1095,7 +1105,7 @@ not a vector but rather a single value. ExprTk provides a means whereby custom functions can be defined and utilized within expressions. The concept requires the user to provide a reference to the function coupled with an associated name -that will be invoked within expressions. Function can take in numerous +that will be invoked within expressions. Functions may take numerous inputs but will always return a single value of the underlying numeric type. @@ -1103,7 +1113,7 @@ During expression compilation when required the reference to the function will be obtained from the associated symbol_table and be embedded into the expression. -There are two types of function interface: +There are five types of function interface: (1) ifunction (2) ivararg_function @@ -1323,7 +1333,7 @@ situations such as concatenation and equality operations. String <-- function(i_0, i_1, i_2....., i_N) -The following example defines an generic function named 'toupper' with +The following example defines a generic function named 'toupper' with the string return type function operator being explicitly overridden: template @@ -1376,10 +1386,10 @@ is done: symbol_table_t::e_ft_strfunc); -Note: There are two further refinements to the type checking facility -are the possibilities of a variable number of common types which can -be accomplished by using a wildcard '*' and a special 'any type' which -is done using the '?' character. It should be noted that the wildcard +Note: Two further refinements to the type checking facility are the +possibilities of a variable number of common types which can be +accomplished by using a wildcard '*' and a special 'any type' which is +done using the '?' character. It should be noted that the wildcard operator is associated with the previous type in the sequence and implies one or more of that type. @@ -1507,7 +1517,7 @@ symbol table. .expression("1 + cos(x * y) / z;")); -(4) Using Functions In Expressions +(6) Using Functions In Expressions For the above denoted custom and composited functions to be used in an expression, an instance of each function needs to be registered with a symbol_table that has been associated with the expression instance. @@ -1558,7 +1568,7 @@ The following demonstrates how all the pieces are put together: expression.value(); -(5) Function Side-Effects +(7) Function Side-Effects All function calls are assumed to have side-effects by default. This assumption implicitly disables constant folding optimisations when all parameters being passed to the function are deduced as being constants @@ -1580,7 +1590,7 @@ to the constructor to denote the lack of side-effects. }; -(6) Zero Parameter Functions +(8) Zero Parameter Functions When either an ifunction or ivararg_function derived type is defined with zero number of parameters, there are two calling conventions within expressions that are allowed. For a function named 'foo' with @@ -1675,12 +1685,12 @@ are the set of dependent symbols that 'may' have their values modified within an expression. The following are example expressions and their associated assignments: - Assignments Expression - 1. x x := y + z - 2. x, y x += y += z - 3. x, y, z x := y += sin(z := w + 2) - 4. z, w if (x > y, z := x + 2, w := 'A String') - 5. None x + y + z + Assignments Expression + (1) x x := y + z + (2) x, y x += y += z + (3) x, y, z x := y += sin(z := w + 2) + (4) z, w if (x > y, z := x + 2, w := 'A String') + (5) None x + y + z Note: In expression 4, both variables 'z' and 'w' are denoted as being @@ -1835,7 +1845,7 @@ via the 'unknown symbol resolver' mechanism. [18 - EXPRTK NOTES] The following is a list of facts and suggestions one may want to take -into account when using Exprtk: +into account when using ExprTk: (00) Precision and performance of expression evaluations are the dominant principles of the ExprTk library. @@ -1935,38 +1945,38 @@ into account when using Exprtk: into account. Specifically the 'compile' method of the parser and the 'add_xxx' set of methods of the symbol_table as they denote either the success or failure state of the invoked call. - Cointinued processing from a failed state without having first + Continued processing from a failed state without having first rectified the underlying issue will in turn result in further failures and undefined behaviours. (25) The following are examples of compliant floating point value representations: - (a) 12345 (e) -123.456 - (b) +123.456e+12 (f) 123.456E-12 - (c) +012.045e+07 (g) .1234 - (d) 123.456f (h) -321.654E+3L + (1) 12345 (5) -123.456 + (2) +123.456e+12 (6) 123.456E-12 + (3) +012.045e+07 (7) .1234 + (4) 123.456f (8) -321.654E+3L (26) Expressions may contain any of the following comment styles: - 1. // .... \n - 2. # .... \n - 3. /* .... */ + (1) // .... \n + (2) # .... \n + (3) /* .... */ (27) The 'null' value type is a special non-zero type that incorporates specific semantics when undergoing operations with the standard numeric type. The following is a list of type and boolean results associated with the use of 'null': - 1. null +,-,*,/,% x --> x - 2. x +,-,*,/,% null --> x - 3. null +,-,*,/,% null --> null - 4. null == null --> true - 5. null == x --> true - 6. x == null --> true - 7. x != null --> false - 8. null != null --> false - 9. null != x --> false + (1) null +,-,*,/,% x --> x + (2) x +,-,*,/,% null --> x + (3) null +,-,*,/,% null --> null + (4) null == null --> true + (5) null == x --> true + (6) x == null --> true + (7) x != null --> false + (8) null != null --> false + (9) null != x --> false (28) The following is a list of reserved words and symbols used by ExprTk. Attempting to add a variable or custom function to a @@ -1979,9 +1989,9 @@ into account when using Exprtk: expm1, false, floor, for, frac, grad2deg, hypot, iclamp, if, ilike, in, inrange, in, like, log, log10, log1p, log2, logn, mand, max, min, mod, mor, mul, nand, ncdf, nor, not, - not_equal, not, null, or, pow, rad2deg, repeat, root, - roundn, round, sec, sgn, shl, shr, sinc, sinh, sin, sqrt, - sum, swap, switch, tanh, tan, true, trunc, until, var, + not_equal, not, null, or, pow, rad2deg, repeat, return, + root, roundn, round, sec, sgn, shl, shr, sinc, sinh, sin, + sqrt, sum, swap, switch, tanh, tan, true, trunc, until, var, while, xnor, xor, xor (29) Every valid ExprTk statement is a "value returning" expression.