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

Function run_test10

exprtk_test.cpp:3906–5237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3904
3905template <typename T>
3906bool run_test10()
3907{
3908 typedef exprtk::expression<T> expression_t;
3909
3910 T x = T(1.1);
3911 T y = T(2.2);
3912 T xx = T(3.3);
3913 T yy = T(4.4);
3914
3915 std::string i_s = "A String";
3916 std::string j_s = "Another String";
3917 std::string ii_s = "A String";
3918 std::string jj_s = "Another String";
3919
3920 struct test
3921 {
3922 static inline bool variable(exprtk::symbol_table<T>& symbol_table, const std::string& variable_name, const T& value)
3923 {
3924 exprtk::details::variable_node<T>* var = symbol_table.get_variable(variable_name);
3925
3926 if (var)
3927 return (!not_equal(var->ref(),value));
3928 else
3929 return false;
3930 }
3931
3932 static inline bool string(exprtk::symbol_table<T>& symbol_table, const std::string& string_name, const std::string& str)
3933 {
3934 exprtk::details::stringvar_node<T>* str_node = symbol_table.get_stringvar(string_name);
3935
3936 if (str_node)
3937 return (str_node->ref() == str);
3938 else
3939 return false;
3940 }
3941 };
3942
3943 {
3944 static const std::size_t rounds = 10;
3945
3946 exprtk::symbol_table<T> symbol_table;
3947
3948 for (std::size_t r = 0; r < rounds; ++r)
3949 {
3950 symbol_table.add_variable("x" , x );
3951 symbol_table.add_variable("y" , y );
3952 symbol_table.add_variable("xx", xx);
3953 symbol_table.add_variable("yy", yy);
3954
3955 if (!symbol_table.symbol_exists("x"))
3956 {
3957 printf("run_test10() - Symbol 'x' does not exist!\n");
3958 return false;
3959 }
3960 else if (!symbol_table.symbol_exists("y"))
3961 {
3962 printf("run_test10() - Symbol 'y' does not exist!\n");
3963 return false;

Callers

nothing calls this directly

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected