MCPcopy Create free account
hub / github.com/ArashPartow/exprtk / run_test15

Function run_test15

exprtk_test.cpp:5760–5855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5758
5759template <typename T>
5760bool run_test15()
5761{
5762 typedef exprtk::expression<T> expression_t;
5763
5764 T x = T(1.1);
5765 T y = T(2.2);
5766 T z = T(3.3);
5767
5768 exprtk::symbol_table<T> symbol_table;
5769 symbol_table.add_constants();
5770 symbol_table.add_variable("x",x);
5771 symbol_table.add_variable("y",y);
5772 symbol_table.add_variable("z",z);
5773
5774 static const std::string expr_str_list[] =
5775 {
5776 "2 - (x + y) / z//Comment 01 ",
5777 "2 - (x + y) / z#Comment 02 ",
5778 "2 - (x + y) / z //Comment 03 ",
5779 "2 - (x + y) / z #Comment 04 ",
5780 "2 - (x + y) / z//Comment 05 \n",
5781 "2 - (x + y) / z#Comment 06 \n",
5782 "2 - (x + y) / z //Comment 07\n",
5783 "2 - (x + y) / z #Comment 08 \n",
5784 "/* Comment 09*/2 - (x + y) / z",
5785 "/* Comment 10*/2 - (x + y) / z\n",
5786 "/* Comment 11*/2 - (x + y) / z/* Comment 12*/",
5787 "/* Comment 13*/2 - (x + y) / z/* Comment 14*/\n",
5788 "2 - /* Comment 15 */(x + y) / z",
5789 "2 - /* Comment 16 */(x + y) /* Comment 17 *// z \n",
5790 "2 - /* Comment 18 */(x + y) /* Comment 19 */ / z //Comment 20\n",
5791 "2 - /* Comment 21 */(x + y) /* Comment 22 */ / z #Comment 23\n",
5792 "2 - /* Comment 24 */(x + y) /* Comment 25 */ / z //Comment 26",
5793 "2 - /* Comment 27 */(x + y) /* Comment 28 */ / z #Comment 29"
5794 };
5795 static const std::size_t expr_str_list_size = sizeof(expr_str_list) / sizeof(std::string);
5796
5797 std::deque<expression_t> expression_list;
5798
5799 for (std::size_t i = 0; i < expr_str_list_size; ++i)
5800 {
5801 expression_t expression;
5802 expression.register_symbol_table(symbol_table);
5803
5804 exprtk::parser<T> parser;
5805
5806 if (!parser.compile(expr_str_list[i],expression))
5807 {
5808 printf("run_test15() - Error: %s Expression: %s\n",
5809 parser.error().c_str(),
5810 expr_str_list[i].c_str());
5811
5812 return false;
5813 }
5814 else
5815 expression_list.push_back(expression);
5816 }
5817

Callers

nothing calls this directly

Calls 2

not_equalFunction · 0.85
valueMethod · 0.45

Tested by

no test coverage detected