Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
test::TestCase Class Reference

Base class for tests. More...

#include <testcase.hh>

Inherited by test::ArPackppTest, test::ArPackTest, test::AsympEdgesTest, test::BEMSpaceTest, test::BesselTest, test::BiCgStabTest, test::BilinearFormTest, test::BoundariesTest, test::BoundaryTest, test::CellConditionTest, test::CgTest, test::Cloneing, test::CompositionTestBase, test::ConstrainedEVP, test::ConvertMeshQuads, test::DeadLock1, test::DeadLock2, test::DeadLock3, test::DGEdgeInfoTest, test::DGElementPair2dTest, test::DGNorm2dTest, test::DGSpace2dP1Test, test::DGTriangleP1Test, test::DirichletTest, test::DirPowItTest, test::DomainDecomp, test::DomainDecompTest, test::DP_AP_test, test::DriverTest, test::Eddy2DRingTest, test::Eddy2DRingTest, test::EdgeMeshTest, test::EdgeTest, test::ElementFormulaTest, test::ElementFormulaTest, test::ElementFunctionTest, test::ExceptionTest, test::Formula2DTest, test::FormulaTest, test::FunctionEvaluation, test::H1extensionTest, test::homEV, test::hpFullTest2D, test::IndexRangeTest, test::InfiniteMesh2dTest, test::IntegralTest, test::KarniadakisTest, test::LaguerreTest, test::LapackTest, test::LaplaceTest, test::LinearFormTest, test::LinearFormTest, test::MappingTest, test::MatfileTest, test::MatlabBinaryGraphicsTest, test::MatlabMatfileTest, test::MeshImp2DTest, test::MixedNonContTest, test::NineCellsLaTest, test::PardisoTest, test::PHC4_Test, test::PointTest, test::ProjectionTest, test::Quad2dTest, test::QuadratureTest, test::RCPTest, test::SpaceH1onInfMeshTest, test::SpaceH1Test, test::SpaceTest2D, test::SpaceTest3D, test::SparseMatrixTest, test::SuperLUTest, test::TestBlending, test::TestDualSpace1D, test::TestEdgeMaps2D, test::TestIntegrals1D, test::TestJacobian2D, test::TestLinearForm1D, test::TestMatrices1D, test::TestMatrices2D, test::ToTest, test::TraceTest, test::UmfpackTest, and test::VectorTest.

Collaboration diagram for test::TestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void _succeed ()
 Explicitly succeds a test.
long getNumFailed () const
 Returns number of failed tests.
long getNumPassed () const
 Returns number of passed tests.
const ostream * getStream () const
 Returns output stream.
long report () const
 Prints a report on the number of passed and failed tests to the output stream.
virtual void reset ()
 Resets the counters for the failed and passed tests.
virtual void run ()=0
 Runs the tests. Must be overwritten by the specialization.
void setStream (ostream *osptr)
 Sets the output stream.
 TestCase (ostream *osptr=0)
 Constructor.
virtual ~TestCase ()

Protected Member Functions

void do_fail (const string &lbl, const char *fname, long lineno)
 Internal function to report a failed test (besides increasing the failed counter)
bool do_numtest (double num, double orig, const string &lbl, const string &lbl2, const char *fname, long lineno, const double tol=1e-10)
 Internal function to do a numerical test.
bool do_numtest (std::complex< double > num, std::complex< double > orig, const string &lbl, const string &lbl2, const char *fname, long lineno, const double tol=1e-10)
bool do_test (bool cond, const string &lbl, const char *fname, long lineno)
 Internal function to do a test.

Private Member Functions

TestCaseoperator= (const TestCase &)
 Disallowed.
 TestCase (const TestCase &)
 Disallowed.

Private Attributes

long m_nFail
long m_nPass
ostream * m_osptr

Detailed Description

Base class for tests.

Writing a test case is done by deriving from this class.

Author:
Chuck Allison, 2000. Doxygen comments by Philipp Frauenfelder, 2003.
See also:
Chuck Allison, The Simplest Automated Unit Test Framework That Could Possibly Work, C/C++ Users Journal, September 2000.
Test:
test::ToTest

Definition at line 89 of file testcase.hh.


Constructor & Destructor Documentation

test::TestCase::TestCase ( ostream *  osptr = 0) [inline]

Constructor.

Parameters:
osptrPointer to the output stream. Defaults to stdout.

Definition at line 144 of file testcase.hh.

virtual test::TestCase::~TestCase ( ) [inline, virtual]

Definition at line 95 of file testcase.hh.

test::TestCase::TestCase ( const TestCase ) [private]

Disallowed.


Member Function Documentation

void test::TestCase::_succeed ( ) [inline]

Explicitly succeds a test.

Definition at line 109 of file testcase.hh.

void test::TestCase::do_fail ( const string &  lbl,
const char *  fname,
long  lineno 
) [protected]

Internal function to report a failed test (besides increasing the failed counter)

bool test::TestCase::do_numtest ( double  num,
double  orig,
const string &  lbl,
const string &  lbl2,
const char *  fname,
long  lineno,
const double  tol = 1e-10 
) [protected]

Internal function to do a numerical test.

bool test::TestCase::do_numtest ( std::complex< double >  num,
std::complex< double >  orig,
const string &  lbl,
const string &  lbl2,
const char *  fname,
long  lineno,
const double  tol = 1e-10 
) [protected]
bool test::TestCase::do_test ( bool  cond,
const string &  lbl,
const char *  fname,
long  lineno 
) [protected]

Internal function to do a test.

long test::TestCase::getNumFailed ( ) const [inline]

Returns number of failed tests.

Definition at line 102 of file testcase.hh.

long test::TestCase::getNumPassed ( ) const [inline]

Returns number of passed tests.

Definition at line 100 of file testcase.hh.

const ostream* test::TestCase::getStream ( ) const [inline]

Returns output stream.

Definition at line 104 of file testcase.hh.

TestCase& test::TestCase::operator= ( const TestCase ) [private]

Disallowed.

long test::TestCase::report ( ) const

Prints a report on the number of passed and failed tests to the output stream.

Returns:
Number of failed tests.
virtual void test::TestCase::reset ( ) [inline, virtual]

Resets the counters for the failed and passed tests.

Definition at line 116 of file testcase.hh.

virtual void test::TestCase::run ( ) [pure virtual]

Runs the tests. Must be overwritten by the specialization.

Implemented in test::DGNorm2dTest, test::MatlabBinaryGraphicsTest, test::Eddy2DRingTest, test::AsympEdgesTest, test::NineCellsLaTest, test::BoundaryTest, test::DP_AP_test, test::homEV, test::LaplaceTest, test::PHC4_Test, test::ExceptionTest, test::PointTest, test::MappingTest, test::ToTest, test::BEMSpaceTest, test::ArPackppTest, test::ArPackTest, test::ConstrainedEVP, test::DirPowItTest, test::BesselTest, test::ElementFormulaTest, test::FormulaTest, test::VectorTest, test::DeadLock1, test::ConvertMeshQuads, test::MeshImp2DTest, test::TestBlending, test::TestEdgeMaps2D, test::EdgeMeshTest, test::InfiniteMesh2dTest, test::TestJacobian2D, test::Quad2dTest, test::TestMatrices1D, test::TestDualSpace1D, test::TestIntegrals1D, test::TestLinearForm1D, test::CellConditionTest, test::Cloneing, test::DirichletTest, test::EdgeTest, test::Formula2DTest, test::FunctionEvaluation, test::H1extensionTest, test::hpFullTest2D, test::IntegralTest, test::LinearFormTest, test::TestMatrices2D, test::ProjectionTest, test::SpaceH1Test, test::SpaceTest2D, test::SpaceH1onInfMeshTest, test::MixedNonContTest, test::TraceTest, test::BilinearFormTest, test::BoundariesTest, test::LinearFormTest, test::DeadLock2, test::DeadLock3, test::SpaceTest3D, test::QuadratureTest, test::KarniadakisTest, test::LaguerreTest, test::DGEdgeInfoTest, test::DGElementPair2dTest, test::DGTriangleP1Test, test::DGSpace2dP1Test, test::MatlabMatfileTest, test::MatfileTest, test::Eddy2DRingTest, test::BiCgStabTest, test::CgTest, test::CompositionsTest, test::MoreCompositionsTest, test::DeepCompositionsTest, test::DomainDecomp, test::LapackTest, test::PardisoTest, test::SparseMatrixTest, test::SuperLUTest, test::UmfpackTest, test::DomainDecompTest, test::ElementFormulaTest, test::ElementFunctionTest, test::IndexRangeTest, test::DriverTest, and test::RCPTest.

void test::TestCase::setStream ( ostream *  osptr) [inline]

Sets the output stream.

Definition at line 106 of file testcase.hh.


Member Data Documentation

long test::TestCase::m_nFail [private]

Definition at line 136 of file testcase.hh.

long test::TestCase::m_nPass [private]

Definition at line 135 of file testcase.hh.

ostream* test::TestCase::m_osptr [private]

Definition at line 134 of file testcase.hh.


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

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)