Peano
|
Represents one test case. More...
#include <TestCase.h>
Public Member Functions | |
TestCase (const std::string &testCaseName) | |
Constructor. | |
virtual | ~TestCase () |
Destructor. | |
int | getNumberOfErrors () const |
std::string | getTestCaseName () const |
virtual void | run ()=0 |
This routine is triggered by the TestCaseCollection. | |
Protected Member Functions | |
TestCase ()=delete | |
Protected Attributes | |
const std::string | _testCaseName |
Name of the test case. | |
int | _errors |
Error counter. | |
bool | _error |
Indicate within macro if one specific validation failed. | |
Represents one test case.
Every test case should be a subclass of this class implementing run(). Furthermore subtypes should use the assertion macros included to check any assumption. All the test cases are managed by the TestCaseCollection.
If you implement your own tests, inherit from this class, implement run() and add the test to a test case collection of your choice.
Whenever you write a test case implementation, we recommend to add the code block
at the very beginning of your implementation and
at the end of the implementation file.
If your unit test is part of a library, then simply registering the test is not enough, as the linker will remove the test again - assuming it is not invoked. I therefore decided not to rely on any automatic test case suites or so, but instead let the individual libraries build up their unit test suites manually. See the respective headers called UnitTests.
Definition at line 57 of file TestCase.h.
|
protecteddelete |
tarch::tests::TestCase::TestCase | ( | const std::string & | testCaseName | ) |
Constructor.
testCaseName | Name of the test case. Should be a fully qualified name. |
Definition at line 3 of file TestCase.cpp.
|
virtual |
Destructor.
Definition at line 9 of file TestCase.cpp.
int tarch::tests::TestCase::getNumberOfErrors | ( | ) | const |
Definition at line 11 of file TestCase.cpp.
Referenced by main(), tarch::tests::TestCaseCollection::run(), and tarch::tests::TreeTestCaseCollection::run().
std::string tarch::tests::TestCase::getTestCaseName | ( | ) | const |
Definition at line 15 of file TestCase.cpp.
Referenced by tarch::tests::TreeTestCaseCollection::addTestCase().
|
pure virtual |
This routine is triggered by the TestCaseCollection.
Implemented in exahype2::fd::tests::CCZ4KernelTest, exahype2::fd::tests::SommerfeldBCTest, exahype2::fv::tests::InterpolationRestrictionTest, tarch::la::tests::LUDecompositionTest, tarch::la::tests::MatrixTest, tarch::la::tests::MatrixVectorTest, tarch::la::tests::ScalarTest, tarch::la::tests::VectorTest, tarch::plotter::griddata::unstructured::vtk::tests::VTKBinaryFileTestCase, tarch::tests::TestCaseCollection, tarch::tests::TreeTestCaseCollection, toolbox::multiprecision::tests::CompressedFloatingPointNumbersTest, exahype2::dg::rusanov::tests::RiemannTest, exahype2::dg::tests::CellIntegralTest, exahype2::dg::tests::DGUtilsTest, exahype2::dg::tests::RiemannTest, exahype2::fv::rusanov::tests::ApplySplit1DRiemannToPatchTest, exahype2::fv::rusanov::tests::CopyPatchTest, peano4::grid::tests::GridControlEventTest, peano4::grid::tests::GridTraversalEventGeneratorTest, peano4::grid::tests::SpacetreeTest, peano4::parallel::tests::NodeTest, peano4::parallel::tests::PingPongTest, peano4::utils::tests::ParallelDForTest, tarch::la::tests::DynamicMatrixTest, tarch::la::tests::GramSchmidtTest, tarch::mpi::tests::StringTest, toolbox::blockstructured::tests::IandRInMatricesTest, toolbox::blockstructured::tests::IandRSecondOrderTest, toolbox::blockstructured::tests::IandRThirdOrderTest, toolbox::blockstructured::tests::IandRVolumetricTest, toolbox::blockstructured::tests::InterpolationTest, toolbox::finiteelements::tests::StencilFactoryTest, toolbox::particles::assignmentchecks::tests::TestHelpers, toolbox::particles::tests::MultiscaleTransitionsTest, and toolbox::particles::tests::TestHelpers.
Referenced by main(), tarch::tests::TestCaseCollection::run(), and tarch::tests::TreeTestCaseCollection::run().
|
protected |
Indicate within macro if one specific validation failed.
Definition at line 73 of file TestCase.h.
|
protected |
Error counter.
This counter is increased on errors iff you use the validate macros within your test cases.
Definition at line 68 of file TestCase.h.
|
protected |
Name of the test case.
Definition at line 62 of file TestCase.h.