UnitTestFramework File Reference

#include <osg/Export>
#include <osg/Referenced>
#include <osg/ref_ptr>
#include <osg/Timer>
#include <osg/Notify>
#include <string>
#include <vector>
#include <list>
#include <fstream>

Include dependency graph for UnitTestFramework:

This graph shows which files directly or indirectly include this file:


Namespaces

namespace  osgUtx

Classes

class  osgUtx::Test
 Test, an abstract base class, is the Composite pattern's component class for our graph of test cases, and defines the basic interface for all Test components. More...
class  osgUtx::TestContext
 TestContext wraps up information which is passed to tests as they are run, and may contain test-specific information or 'global' test objects, such as an output stream for verbose output during the running of tests. More...
class  osgUtx::TestVisitor
 Visits while maintaining the current hierarchical context. More...
class  osgUtx::TestCase
 TestCase, supplies the interface for a Composite pattern's leaf class, though it is not a leaf in itself. More...
class  osgUtx::TestX
 Base class catchable for the exceptions which may be thrown to indicate problems during the run of a TestCase. More...
class  osgUtx::TestFailureX
 A TestFailureX indicates a failure in the tested component. More...
class  osgUtx::TestErrorX
 A TestErrorX indicates an error while testing a component, which prevents the test from being run. More...
class  osgUtx::TestCase_< FixtureT >
 TestCase_ is a class template for a leaf TestCase, which allows TestFixture classes to be easily collected into the tree of tests, and have their public test methods called. More...
class  osgUtx::TestSuite
 A TestSuite is the composite component of the Composite pattern, and allows aggregation of Tests into hierarchies. More...
class  osgUtx::TestGraph
 TestGraph is a singleton providing central access to the tree of tests; primarily, it provides access to the root suite. More...
class  osgUtx::TestQualifier
 Maintains a string that when accessed in the "visit" member, returns the current qualified TestSuite path. More...
class  osgUtx::QualifiedTestPrinter
 QualifiedTestPrinter prints to standard output a list of fully qualified tests. More...
class  osgUtx::TestRecord
 A TestRecord records the output of a given test case, i.e. More...
class  osgUtx::TestReport
 A TestReport represents the complete set of results (TestRecords) for a given test run. More...
class  osgUtx::TestRunner
 A TestRunner is a visitor which will run specified tests as it traverses the test graph. More...
struct  osgUtx::TestSuiteAutoRegistrationAgent
 A helper struct to perform automatic registration at program startup; not for direct use, it should be used via the following macros. More...

Defines

#define OSG_UNITTESTFRAMEWORK   1
#define OSGUTX_BEGIN_TESTSUITE(tsuite)
 Starts a TestSuite singleton function.
#define OSGUTX_ADD_TESTCASE(tfixture, tmethod)
 Adds a test case to a suite object being created in a TestSuite singleton function.
#define OSGUTX_END_TESTSUITE
 Ends a TestSuite singleton function.
#define OSGUTX_TESTSUITE(tsuite)   tsuite##_TestSuite()
 Define a TestSuite accessor.
#define OSGUTX_ADD_TESTSUITE(childSuite)   s_suite->add( childSuite##_TestSuite() );
 Adds a suite to a suite - allows composition of test suites.
#define OSGUTX_AUTOREGISTER_TESTSUITE(tsuite)   static osgUtx::TestSuiteAutoRegistrationAgent tsuite##_autoRegistrationObj__( tsuite##_TestSuite() );
 Autoregister a testsuite with the root suite at startup.
#define OSGUTX_AUTOREGISTER_TESTSUITE_AT(tsuite, path)   static osgUtx::TestSuiteAutoRegistrationAgent tsuite##_autoRegistrationObj__( tsuite##_TestSuite(), #path );
 Auto register a testsuite with at designated point in the suite graph at startup.
#define OSGUTX_TEST_F(expr)
 OSGUTX_TEST_F is a convenience macro, analogous to assert(), which will throw an osgUtx::TestFailureX if expr evaluates to false; this should be used to test for failure in a given test, as opposed to an actual error in the test owing to some other reason than the tested code being faulty.
#define OSGUTX_TEST_E(expr)
 OSGUTX_TEST_E is a convenience macro, analogous to assert(), which will throw an osgUtx::TestErrorX if expr evaluates to false; this should be used to test for an error in a given test, as opposed to a failure in the tested code.

Define Documentation

#define OSG_UNITTESTFRAMEWORK   1
 

#define OSGUTX_ADD_TESTCASE tfixture,
tmethod   ) 
 

Value:

s_suite->add( new osgUtx::TestCase_<tfixture>(  \
                                #tmethod, &tfixture::tmethod ) );
Adds a test case to a suite object being created in a TestSuite singleton function.

See also:
OSGUTX_BEGIN_TESTSUITE, OSGUTX_END_TESTSUITE

#define OSGUTX_ADD_TESTSUITE childSuite   )     s_suite->add( childSuite##_TestSuite() );
 

Adds a suite to a suite - allows composition of test suites.

See also:
OSGUTX_BEGIN_TESTSUITE, OSGUTX_END_TESTSUITE

#define OSGUTX_AUTOREGISTER_TESTSUITE tsuite   )     static osgUtx::TestSuiteAutoRegistrationAgent tsuite##_autoRegistrationObj__( tsuite##_TestSuite() );
 

Autoregister a testsuite with the root suite at startup.

#define OSGUTX_AUTOREGISTER_TESTSUITE_AT tsuite,
path   )     static osgUtx::TestSuiteAutoRegistrationAgent tsuite##_autoRegistrationObj__( tsuite##_TestSuite(), #path );
 

Auto register a testsuite with at designated point in the suite graph at startup.

#define OSGUTX_BEGIN_TESTSUITE tsuite   ) 
 

Value:

osgUtx::TestSuite* tsuite##_TestSuite() \
    { \
        static osg::ref_ptr<osgUtx::TestSuite> s_suite = 0; \
        if ( s_suite == 0 ) { \
            s_suite = new osgUtx::TestSuite( #tsuite );
Starts a TestSuite singleton function.

See also:
OSGUTX_ADD_TESTCASE, OSGUTX_END_TESTSUITE

#define OSGUTX_END_TESTSUITE
 

Value:

} \
        return s_suite.get(); \
    }
Ends a TestSuite singleton function.

See also:
OSGUTX_BEGIN_TESTSUITE, OSGUTX_ADD_TESTCASE

#define OSGUTX_TEST_E expr   ) 
 

Value:

if( !(expr) ){ \
        std::stringstream ss; \
        ss<< #expr <<" error: "<<__FILE__<<", line "<<__LINE__<<std::ends; \
        throw osgUtx::TestErrorX(ss.str()); \
    }
OSGUTX_TEST_E is a convenience macro, analogous to assert(), which will throw an osgUtx::TestErrorX if expr evaluates to false; this should be used to test for an error in a given test, as opposed to a failure in the tested code.

The exception will indicate the file and line number of the failed expression, along with expression itself.

#define OSGUTX_TEST_F expr   ) 
 

Value:

if( !(expr) ){ \
        std::stringstream ss; \
        ss<< #expr <<" failure: "<<__FILE__<<", line "<<__LINE__<<std::ends; \
        throw osgUtx::TestFailureX(ss.str()); \
    }
OSGUTX_TEST_F is a convenience macro, analogous to assert(), which will throw an osgUtx::TestFailureX if expr evaluates to false; this should be used to test for failure in a given test, as opposed to an actual error in the test owing to some other reason than the tested code being faulty.

The exception will indicate the file and line number of the failed expression, along with expression itself.

#define OSGUTX_TESTSUITE tsuite   )     tsuite##_TestSuite()
 

Define a TestSuite accessor.


Generated at Wed Mar 8 21:44:12 2006 for the OpenSceneGraph by doxygen 1.4.6.