DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
OFTestManager Class Reference

The test manager singleton manages the list of available test cases and executes them. More...

## Public Member Functions
OFTestTest & | currentTest ()
void | addTest (OFTestTest *test)
| Register a test with this test manager.
int | runTests (const OFList< OFTestTest * > &tests, const char *module)
| Run a list of test cases.
int | run (int argc, char *argv[], const char *module)
| Handle the given arguments and run the requested test case.

## Static Public Member Functions
static OFTestManager & | instance ()

## Private Member Functions
| OFTestManager ()
| Private constructor, this is a singleton!
| OFTestManager (const OFTestManager &obj)
| Private undefined copy constructor.
OFTestManager & | operator= (const OFTestManager &obj)
| Private undefined assignment operator.
OFBool | buildTestsToRun (OFCommandLine &cmd, OFList< OFTestTest * > &tests) const
| Build a list of tests which should be executed from the command line.
OFBool | testMatches (const OFTestTest *test, const OFString &str) const
| Test if the test name matches the given name.

## Private Attributes
OFList< OFTestTest * > | tests_
| List of tests. Statically allocated, so don't have to be freed.
OFTestTest * | curTest_
| Currently running test.
OFBool | exhaustive_
| Should slow tests be run, too?

## Detailed Description

The test manager singleton manages the list of available test cases and executes them.

## Member Function Documentation

## ◆ addTest()

void OFTestManager::addTest | ( | OFTestTest * | test | ) |
| inline

Register a test with this test manager.

Parameters

  test | the test to register

References tests_.

## ◆ buildTestsToRun()

OFBool OFTestManager::buildTestsToRun | ( | OFCommandLine & | cmd,
|  | OFList< OFTestTest * > & | tests ) const
| inline private

Build a list of tests which should be executed from the command line.

Parameters

  cmd | command line arguments which should be parsed
  tests | will be set to the list of tests to run

Returns
  OFFalse if the command line could not be handled.

References OFList< T >::begin(), OFTestTest::EF_Slow, OFList< T >::end(), OFList< T >::erase(), exhaustive_, OFCommandLine::getParam(), OFCommandLine::getParamCount(), OFList< T >::push_back(), testMatches(), and tests_.

Referenced by run().

## ◆ currentTest()

OFTestTest & OFTestManager::currentTest | ( |  | ) |
| inline

Returns
  the currently running test case

References curTest_.

## ◆ instance()

static OFTestManager & OFTestManager::instance | ( |  | ) |
| inline static

Returns
  the only instance of the test manager

References OFTestManager().

## ◆ run()

int OFTestManager::run | ( | int | argc,
|  | char * | argv[],
|  | const char * | module )
| inline

Handle the given arguments and run the requested test case.

This function should be used for implementing main().

Parameters

  argc | number of arguments
  argv | list of arguments
  module | name of the module that we are testing for

Returns
  0 in case of success, else an error value.

References OFCommandLine::addGroup(), OFCommandLine::addOption(), OFLog::addOptions(), OFCommandLine::addParam(), OFCommandLine::AF_Exclusive, OFCommandLine::AF_Internal, OFList< T >::begin(), buildTestsToRun(), OFConsoleApplication::checkValue(), OFLog::configureFromCommandLine(), OFList< T >::empty(), OFList< T >::end(), exhaustive_, OFLogger::FATAL_LOG_LEVEL, OFCommandLine::findOption(), OFCommandLine::getValueAndCheckMin(), OFFIS_DCMTK_RELEASEDATE, OFFIS_DCMTK_VERSION, OFConsoleApplication::parseCommandLine(), OFCmdParam::PM_MultiOptional, runTests(), OFCommandLine::setParamColumn(), and OFList< T >::size().

## ◆ runTests()

int OFTestManager::runTests | ( | const OFList< OFTestTest * > & | tests,
|  | const char * | module )
| inline

Run a list of test cases.

The results will be printed on the console.

Parameters

  tests | tests to execute

References OFList< T >::begin(), curTest_, OFList< T >::empty(), OFList< T >::end(), and OFList< T >::size().

Referenced by run().

## ◆ testMatches()

OFBool OFTestManager::testMatches | ( | const OFTestTest * | test,
|  | const OFString & | str ) const
| inline private

Test if the test name matches the given name.

This function supports '?' and '' for wildcards. However, '' can only be used at the end of string.

Parameters

  test | test to check against
  str | the string describing the tests

Returns
  OFTrue if we found a match, else OFFalse

References OFString::c_str(), and OFTestTest::getTestName().

Referenced by buildTestsToRun().

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

- ofstd/include/dcmtk/ofstd/oftest.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2