Helios++
Helios software for LiDAR simulations
HeliosTests::ExprTreeTest Class Reference

Expression tree test. More...

#include <ExprTreeTest.h>

Inheritance diagram for HeliosTests::ExprTreeTest:
Collaboration diagram for HeliosTests::ExprTreeTest:

Public Member Functions

 ExprTreeTest ()
 Expression tree test constructor.
 
bool run () override
 
bool testUnivarExprTree ()
 Test univariate expression tree. More...
 
template<typename InputType , typename OutputType >
bool validate (std::shared_ptr< IExprTreeNode< InputType, OutputType >> f, std::vector< InputType > const &t, std::vector< OutputType > const &y)
 Validate \(f(t) \approx y\). More...
 
template<typename InputType , typename OutputType >
bool validate (std::shared_ptr< IExprTreeNode< InputType, OutputType >> f, std::shared_ptr< IExprTreeNode< InputType, OutputType >> g, std::vector< InputType > const &t)
 Validate \(f(t) = g(t)\). More...
 
template<typename NumericType >
bool validatePowIPow (std::shared_ptr< UnivarExprTreeNode< NumericType >> f, size_t const expectedPowCount, size_t const expectedIPowCount)
 Validate given tree as UnivarExprTreeNode contains exactly as many POW and IPOW nodes as specified. More...
 
template<typename NumericType >
bool validatePowIPow (std::shared_ptr< IExprTreeNode< NumericType, NumericType >> f, size_t const expectedPowCount, size_t const expectedIPowCount)
 Wrapper for validatePowIPow method providing automatic pointer casting. More...
 
- Public Member Functions inherited from HeliosTests::BaseTest
 BaseTest (std::string const &name)
 Base test constructor. More...
 
std::string getName ()
 Obtain the test name. More...
 
void operator() (std::ostream &out=std::cout, bool color=true)
 Another way to call test function. More...
 
bool test (std::ostream &out=std::cout, bool color=true)
 Perform the test and output its final status. More...
 

Public Attributes

double eps = 0.00001
 Decimal precision for validation purposes.
 

Additional Inherited Members

- Protected Attributes inherited from HeliosTests::BaseTest
std::string const name
 The name for the test.
 

Detailed Description

Expression tree test.

Author
Alberto M. Esmoris Pena
Version
1.0

Member Function Documentation

◆ run()

bool HeliosTests::ExprTreeTest::run ( )
overridevirtual
See also
BaseTest::run

Implements HeliosTests::BaseTest.

◆ testUnivarExprTree()

bool HeliosTests::ExprTreeTest::testUnivarExprTree ( )

Test univariate expression tree.

Returns
True if passed, false otherwise

◆ validate() [1/2]

template<typename InputType , typename OutputType >
bool HeliosTests::ExprTreeTest::validate ( std::shared_ptr< IExprTreeNode< InputType, OutputType >>  f,
std::shared_ptr< IExprTreeNode< InputType, OutputType >>  g,
std::vector< InputType > const &  t 
)
inline

Validate \(f(t) = g(t)\).

Returns
True if the test is passed, false otherwise

◆ validate() [2/2]

template<typename InputType , typename OutputType >
bool HeliosTests::ExprTreeTest::validate ( std::shared_ptr< IExprTreeNode< InputType, OutputType >>  f,
std::vector< InputType > const &  t,
std::vector< OutputType > const &  y 
)
inline

Validate \(f(t) \approx y\).

Returns
True if the test is passed, false otherwise

◆ validatePowIPow() [1/2]

template<typename NumericType >
bool HeliosTests::ExprTreeTest::validatePowIPow ( std::shared_ptr< IExprTreeNode< NumericType, NumericType >>  f,
size_t const  expectedPowCount,
size_t const  expectedIPowCount 
)
inline

Wrapper for validatePowIPow method providing automatic pointer casting.

See also
ExprTreeTest::validatePowIPow

◆ validatePowIPow() [2/2]

template<typename NumericType >
bool HeliosTests::ExprTreeTest::validatePowIPow ( std::shared_ptr< UnivarExprTreeNode< NumericType >>  f,
size_t const  expectedPowCount,
size_t const  expectedIPowCount 
)
inline

Validate given tree as UnivarExprTreeNode contains exactly as many POW and IPOW nodes as specified.

Returns
True if the test is passed, false otherwise

The documentation for this class was generated from the following file: