OpcUaCanOpen
CANopen OPC-UA server
exprtk_test.cpp File Reference
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include "exprtk.hpp"

Go to the source code of this file.

Classes

struct  test_xy< T >
 
struct  test_xyzw< T >
 
struct  test_ab< T >
 
struct  myfunc< T >
 
struct  sine_deg< T >
 
struct  cosine_deg< T >
 
struct  base_func< T >
 
struct  test_func5< T >
 
struct  test_func4< T >
 
struct  test_func3< T >
 
struct  test_func2< T >
 
struct  test_func1< T >
 
struct  test_func0< T >
 
struct  va_func< T >
 
struct  gen_func< T >
 
struct  gen_func2< T >
 
struct  inc_func< T >
 
struct  rem_space_and_uppercase< T >
 
struct  vararg_func< T >
 
struct  vecrebase_func< T >
 
struct  overload_func< T >
 
struct  overload_func< T >::test_result_t
 
struct  my_usr< T >
 
struct  my_usr_ext< T >
 
struct  type_name< T >
 
struct  type_name< float >
 
struct  type_name< double >
 
struct  type_name< long double >
 

Macros

#define define_free_functions(N, Type)
 
#define pb(v, N)   v.push_back(T(N)); \
 
#define pb(v, N)   v.push_back(T(N)); \
 
#define pb(v, N)   v.push_back(T(N)); \
 
#define pb(v, N)   v.push_back(T(N)); \
 
#define perform_test(Type, Number)
 

Typedefs

typedef double numeric_type
 
typedef std::pair< std::string, numeric_typetest_t
 

Functions

template<typename T >
bool not_equal_impl (const T &t1, const T &t2, const T &epsilon=0.0000000001)
 
template<typename T >
bool not_equal (const T &t0, const T &t1, const T &epsilon=T(0.0000000001))
 
bool not_equal (const float &t0, const float &t1, const float &epsilon=0.000001f)
 
template<typename T >
bool test_expression (const std::string &expression_string, const T &expected_result)
 
template<typename T >
bool run_test00 ()
 
template<typename T >
bool run_test01 ()
 
template<typename T >
bool run_test02 ()
 
template<typename T >
bool run_test03 ()
 
template<typename T >
clamp (const T &l, const T &v, const T &u)
 
template<typename T >
bool run_test04 ()
 
template<typename T >
bool run_test05 ()
 
template<typename T >
bool run_test06 ()
 
template<typename T >
bool run_test07 ()
 
template<typename T >
bool run_test08 ()
 
 define_free_functions (foo, numeric_type) template< typename T > inline bool run_test09()
 
template<typename T >
bool run_test10 ()
 
template<typename T >
bool run_test11 ()
 
template<typename T >
bool run_test12 ()
 
template<typename T >
bool run_test13 ()
 
template<typename Allocator , template< typename, typename > class Sequence>
std::size_t load_expressions (const std::string &file_name, Sequence< std::string, Allocator > &sequence)
 
template<typename T >
bool run_test14 ()
 
template<typename T >
bool run_test15 ()
 
template<typename T >
bool run_test16 ()
 
template<typename T >
bool run_test17 ()
 
template<typename T >
bool run_test18 ()
 
template<typename T >
bool run_test19 ()
 
template<typename T >
bool run_test20 ()
 
template<typename T >
std::string results_to_string (const exprtk::results_context< T > &results)
 
template<typename T >
bool result_equal (const exprtk::results_context< T > &results, const T &value)
 
template<typename T >
bool run_test21 ()
 
int main ()
 

Variables

static const test_t global_test_list []
 
static const std::size_t global_test_list_size = sizeof(global_test_list) / sizeof(test_t)
 

Macro Definition Documentation

◆ define_free_functions

#define define_free_functions (   N,
  Type 
)
Value:
Type N##1(Type v0) { return v0; } \
Type N##2(Type v0, Type v1) { return v0 + v1; } \
Type N##3(Type v0, Type v1, Type v2) { return v0 + v1 + v2; } \
Type N##4(Type v0, Type v1, Type v2, Type v3) { return v0 + v1 + v2 + v3; } \
Type N##5(Type v0, Type v1, Type v2, Type v3, Type v4) { return v0 + v1 + v2 + v3 + v4; } \
Type N##6(Type v0, Type v1, Type v2, Type v3, Type v4, Type v5) { return v0 + v1 + v2 + v3 + v4 + v5; } \

Definition at line 3452 of file exprtk_test.cpp.

◆ pb [1/4]

#define pb (   v,
 
)    v.push_back(T(N)); \

◆ pb [2/4]

#define pb (   v,
 
)    v.push_back(T(N)); \

◆ pb [3/4]

#define pb (   v,
 
)    v.push_back(T(N)); \

◆ pb [4/4]

#define pb (   v,
 
)    v.push_back(T(N)); \

◆ perform_test

#define perform_test (   Type,
  Number 
)
Value:
{ \
exprtk::timer timer; \
timer.start(); \
if (!run_test##Number<Type>()) \
{ \
printf("run_test"#Number" (%s) *** FAILED! ***\n", \
type_name<Type>::value().c_str()); \
result = EXIT_FAILURE; \
} \
else \
{ \
timer.stop(); \
printf("run_test"#Number" (%s) - Result: SUCCESS Time: %8.4fsec\n", \
timer.time()); \
} \
} \

Typedef Documentation

◆ numeric_type

typedef double numeric_type

Definition at line 36 of file exprtk_test.cpp.

◆ test_t

typedef std::pair<std::string,numeric_type> test_t

Definition at line 39 of file exprtk_test.cpp.

Function Documentation

◆ clamp()

template<typename T >
T clamp ( const T &  l,
const T &  v,
const T &  u 
)
inline

Definition at line 2969 of file exprtk_test.cpp.

◆ define_free_functions()

define_free_functions ( foo  ,
numeric_type   
)

Definition at line 3460 of file exprtk_test.cpp.

◆ load_expressions()

template<typename Allocator , template< typename, typename > class Sequence>
std::size_t load_expressions ( const std::string &  file_name,
Sequence< std::string, Allocator > &  sequence 
)
inline

Definition at line 5015 of file exprtk_test.cpp.

◆ main()

int main ( )

Definition at line 8843 of file exprtk_test.cpp.

◆ not_equal() [1/2]

template<typename T >
bool not_equal ( const T &  t0,
const T &  t1,
const T &  epsilon = T(0.0000000001) 
)
inline

Definition at line 1098 of file exprtk_test.cpp.

◆ not_equal() [2/2]

bool not_equal ( const float &  t0,
const float &  t1,
const float &  epsilon = 0.000001f 
)
inline

Definition at line 1104 of file exprtk_test.cpp.

◆ not_equal_impl()

template<typename T >
bool not_equal_impl ( const T &  t1,
const T &  t2,
const T &  epsilon = 0.0000000001 
)
inline

Definition at line 1086 of file exprtk_test.cpp.

◆ result_equal()

template<typename T >
bool result_equal ( const exprtk::results_context< T > &  results,
const T &  value 
)
inline

Definition at line 8613 of file exprtk_test.cpp.

◆ results_to_string()

template<typename T >
std::string results_to_string ( const exprtk::results_context< T > &  results)
inline

Definition at line 8583 of file exprtk_test.cpp.

◆ run_test00()

template<typename T >
bool run_test00 ( )
inline

Definition at line 1181 of file exprtk_test.cpp.

◆ run_test01()

template<typename T >
bool run_test01 ( )
inline

Definition at line 1241 of file exprtk_test.cpp.

◆ run_test02()

template<typename T >
bool run_test02 ( )
inline

Definition at line 1945 of file exprtk_test.cpp.

◆ run_test03()

template<typename T >
bool run_test03 ( )
inline

Definition at line 2676 of file exprtk_test.cpp.

◆ run_test04()

template<typename T >
bool run_test04 ( )
inline

Definition at line 2975 of file exprtk_test.cpp.

◆ run_test05()

template<typename T >
bool run_test05 ( )
inline

Definition at line 3032 of file exprtk_test.cpp.

◆ run_test06()

template<typename T >
bool run_test06 ( )
inline

Definition at line 3104 of file exprtk_test.cpp.

◆ run_test07()

template<typename T >
bool run_test07 ( )
inline

Definition at line 3153 of file exprtk_test.cpp.

◆ run_test08()

template<typename T >
bool run_test08 ( )
inline

Definition at line 3252 of file exprtk_test.cpp.

◆ run_test10()

template<typename T >
bool run_test10 ( )
inline

Definition at line 3608 of file exprtk_test.cpp.

◆ run_test11()

template<typename T >
bool run_test11 ( )
inline

Definition at line 4668 of file exprtk_test.cpp.

◆ run_test12()

template<typename T >
bool run_test12 ( )
inline

Definition at line 4746 of file exprtk_test.cpp.

◆ run_test13()

template<typename T >
bool run_test13 ( )
inline

Definition at line 4871 of file exprtk_test.cpp.

◆ run_test14()

template<typename T >
bool run_test14 ( )
inline

Definition at line 5042 of file exprtk_test.cpp.

◆ run_test15()

template<typename T >
bool run_test15 ( )
inline

Definition at line 5148 of file exprtk_test.cpp.

◆ run_test16()

template<typename T >
bool run_test16 ( )
inline

Definition at line 5268 of file exprtk_test.cpp.

◆ run_test17()

template<typename T >
bool run_test17 ( )
inline

Definition at line 5406 of file exprtk_test.cpp.

◆ run_test18()

template<typename T >
bool run_test18 ( )
inline

Definition at line 5862 of file exprtk_test.cpp.

◆ run_test19()

template<typename T >
bool run_test19 ( )
inline

Definition at line 7296 of file exprtk_test.cpp.

◆ run_test20()

template<typename T >
bool run_test20 ( )
inline

Definition at line 8372 of file exprtk_test.cpp.

◆ run_test21()

template<typename T >
bool run_test21 ( )
inline

Definition at line 8628 of file exprtk_test.cpp.

◆ test_expression()

template<typename T >
bool test_expression ( const std::string &  expression_string,
const T &  expected_result 
)
inline

Definition at line 1110 of file exprtk_test.cpp.

Variable Documentation

◆ global_test_list

const test_t global_test_list[]
static

Definition at line 41 of file exprtk_test.cpp.

◆ global_test_list_size

const std::size_t global_test_list_size = sizeof(global_test_list) / sizeof(test_t)
static

Definition at line 1083 of file exprtk_test.cpp.