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

Function run_test13

exprtk_test.cpp:5440–5580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5438
5439template <typename T>
5440bool run_test13()
5441{
5442 typedef exprtk::symbol_table<T> symbol_table_t;
5443 typedef exprtk::expression<T> expression_t;
5444 typedef exprtk::parser<T> parser_t;
5445
5446 static const std::string expression_string[] =
5447 {
5448 "equal(sin(30),0.5) ",
5449 "equal(cos(60),0.5) ",
5450 "equal(sin(60),sqrt(3)/2) ",
5451 "equal(cos(30),sqrt(3)/2) ",
5452 "equal(sin(x_deg),0.5) ",
5453 "equal(cos(y_deg),0.5) ",
5454 "equal(sin(y_deg),sqrt(3)/2) ",
5455 "equal(cos(x_deg),sqrt(3)/2) ",
5456 "equal(sin(30) + sin(30),1.0) ",
5457 "equal(cos(60) + cos(60),1.0) ",
5458 "equal(sin(60) + sin(60),sqrt(3)) ",
5459 "equal(cos(30) + cos(30),sqrt(3)) ",
5460 "equal(sin(x_deg) + sin(x_deg),1.0) ",
5461 "equal(cos(y_deg) + cos(y_deg),1.0) ",
5462 "equal(sin(y_deg) + sin(y_deg),sqrt(3))",
5463 "equal(cos(x_deg) + cos(x_deg),sqrt(3))"
5464 };
5465
5466 static const std::size_t expression_string_size = sizeof(expression_string) / sizeof(std::string);
5467
5468 {
5469 T x_deg = T(30);
5470 T y_deg = T(60);
5471
5472 sine_deg <T> sine;
5473 cosine_deg<T> cosine;
5474
5475 symbol_table_t symbol_table_0;
5476 symbol_table_t symbol_table_1;
5477
5478 symbol_table_0.add_variable("x_deg",x_deg);
5479 symbol_table_1.add_variable("y_deg",y_deg);
5480
5481 symbol_table_0.add_function( "sine_deg", sine);
5482 symbol_table_1.add_function("cosine_deg", cosine);
5483
5484 expression_t expression;
5485
5486 expression.register_symbol_table(symbol_table_0);
5487 expression.register_symbol_table(symbol_table_1);
5488
5489 static const std::size_t rounds = 100;
5490
5491 for (std::size_t i = 0; i < rounds; ++i)
5492 {
5493 for (std::size_t j = 0; j < expression_string_size; ++j)
5494 {
5495 const std::string& expr_str = expression_string[j];
5496
5497 {

Callers

nothing calls this directly

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected