Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# 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>`

## Namespaces
namespace | osgUtx
## 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.