Project-specific testing object. More...
#include <RocstarTest.H>
Public Member Functions | |
TestingObject () | |
Default constructor. More... | |
virtual void | Epilogue () |
Tears down the testing fixtures if needed. More... | |
virtual void | Prologue () |
Sets up the data fixtures for the tests. More... | |
double | F1 (double x) |
Simple test function fixture returns . More... | |
double | F2 (double x) |
Simple test function fixture returns . More... | |
virtual void | Test__ExampleFunction (ResultsType &result) |
Test for Rocstar::ExampleFunction. More... | |
virtual void | Test__TrapezoidQuadrature (ResultsType &result) |
Test for Rocstar::TrapezoidQuadrature. More... | |
virtual void | Test__MidPointQuadrature (ResultsType &result) |
Test for Rocstar::MidPointQuadrature. More... | |
virtual void | Process (ResultsType &result) |
Runs all tests implemented by the Rocstar::TestingObject. More... | |
virtual void | RunTest (const std::string &name, ResultsType &result) |
Runs a test specified by name. More... | |
virtual void | ProcessTests (std::list< std::string > &test_names, ResultsType &result) |
Runs a list of tests specified by name. More... | |
Protected Attributes | |
std::string | ExampleTestFixture |
A sample string test fixture. More... | |
std::vector< int > | N |
A set of values for testing quadrature methods. More... | |
Private Types | |
typedef IRAD::Util::TestingObject < ResultsType > | TestingObjectBaseType |
Project-specific testing object.
The project-specific testing object encapsulates all tests for the project. This is the interface to all testing available for the given project. It implements the interface given by IRAD::Util::TestingObject.
Every project should define a "TestingObject" which implements (or interfaces) all of the tests for the project. If necessary (e.g. for parallel tests through batch systems), this is the object responsible for spawning off children processes to conduct parallel tests and for gathering the results of those tests.
Definition at line 71 of file RocstarTest.H.
|
private |
Definition at line 73 of file RocstarTest.H.
|
inline |
Default constructor.
Definition at line 91 of file RocstarTest.H.
|
inlinevirtual |
Tears down the testing fixtures if needed.
Definition at line 96 of file RocstarTest.H.
Referenced by TestingObject< ResultsType >::Process(), TestingObject< ResultsType >::ProcessTests(), and TestingObject< ResultsType >::RunTest().
|
inline |
Simple test function fixture returns .
F1 is a 1st order function in x that has unity integral over [0,1].
Definition at line 114 of file RocstarTest.H.
|
inline |
Simple test function fixture returns .
F2 is quadratic function in x and integrates to unity over [0,1].
Definition at line 120 of file RocstarTest.H.
|
inlinevirtual |
Runs all tests implemented by the Rocstar::TestingObject.
result | Rocstar::TestResults object to store test results. |
Definition at line 255 of file RocstarTest.H.
References TestingObject< ResultsType >::Epilogue(), TestingObject< ResultsType >::Prologue(), TestingObject< ResultsType >::Test__ExampleFunction(), TestingObject< ResultsType >::Test__MidPointQuadrature(), and TestingObject< ResultsType >::Test__TrapezoidQuadrature().
Referenced by Rocstar::Test().
|
inlinevirtual |
Runs a list of tests specified by name.
test_names | list of string test names |
result | Rocstar::TestResults object to store test results. |
Definition at line 287 of file RocstarTest.H.
References TestingObject< ResultsType >::Epilogue(), TestingObject< ResultsType >::Prologue(), and TestingObject< ResultsType >::RunTest().
|
inlinevirtual |
Sets up the data fixtures for the tests.
This function gives the object a chance to allocate and set up any "fixtures" before the tests are run.
Definition at line 105 of file RocstarTest.H.
References TestingObject< ResultsType >::ExampleTestFixture, i, and TestingObject< ResultsType >::N.
Referenced by TestingObject< ResultsType >::Process(), TestingObject< ResultsType >::ProcessTests(), and TestingObject< ResultsType >::RunTest().
|
inlinevirtual |
Runs a test specified by name.
name | String name of the test to run. |
result | Rocstar::TestResults object to store test results. |
Definition at line 269 of file RocstarTest.H.
References TestingObject< ResultsType >::Epilogue(), TestingObject< ResultsType >::Prologue(), TestingObject< ResultsType >::Test__ExampleFunction(), TestingObject< ResultsType >::Test__MidPointQuadrature(), and TestingObject< ResultsType >::Test__TrapezoidQuadrature().
Referenced by TestingObject< ResultsType >::ProcessTests(), and Rocstar::Test().
|
inlinevirtual |
Test for Rocstar::ExampleFunction.
result | Rocstar::TestResults object to store test results. |
This function implements a simple test of the function Rocstar::ExampleFunction - which is designed to simply return a copy of the input string.
Definition at line 130 of file RocstarTest.H.
References GridConversion::ExampleFunction(), and TestingObject< ResultsType >::ExampleTestFixture.
Referenced by TestingObject< ResultsType >::Process(), and TestingObject< ResultsType >::RunTest().
|
inlinevirtual |
Test for Rocstar::MidPointQuadrature.
result | Rocstar::TestResults object to store test results. |
This function implements a simple test of the function Rocstar::MidPointQuadrature - which is designed to integrate a function, f, over an interval .
The test first makes sure that the method integrates a linear function exactly, and then that the error term has the proper dependence on the spacings.
Definition at line 207 of file RocstarTest.H.
References NTS::abs(), Rocstar::TestFixture::F1(), Rocstar::TestFixture::F2(), i, cimg_library::log(), GridConversion::MidPointQuadrature(), n, and TestingObject< ResultsType >::N.
Referenced by TestingObject< ResultsType >::Process(), and TestingObject< ResultsType >::RunTest().
|
inlinevirtual |
Test for Rocstar::TrapezoidQuadrature.
result | Rocstar::TestResults object to store test results. |
This function implements a simple test of the function Rocstar::TrapezoidQuadrature - which is designed to integrate a function, f, over an n-way partitioned interval .
The test first makes sure that the method integrates a linear function exactly, and then that the error term has the proper dependence on the spacings.
Definition at line 155 of file RocstarTest.H.
References NTS::abs(), Rocstar::TestFixture::F1(), Rocstar::TestFixture::F2(), i, cimg_library::log(), n, TestingObject< ResultsType >::N, and GridConversion::TrapezoidQuadrature().
Referenced by TestingObject< ResultsType >::Process(), and TestingObject< ResultsType >::RunTest().
|
protected |
A sample string test fixture.
Definition at line 82 of file RocstarTest.H.
Referenced by TestingObject< ResultsType >::Prologue(), and TestingObject< ResultsType >::Test__ExampleFunction().
|
protected |
A set of values for testing quadrature methods.
Definition at line 86 of file RocstarTest.H.
Referenced by TestingObject< ResultsType >::Prologue(), TestingObject< ResultsType >::Test__MidPointQuadrature(), and TestingObject< ResultsType >::Test__TrapezoidQuadrature().