unittest namespace

UnitTest declarations and definitions.

Namespaces

namespace ctr
UnitTest control facilitating user input to internal data transfer.

Classes

class TUTSuite
Template Unit Test unit test suite.
template<class Proxy>
class TUTTest
Generic Charm++ chare class for unit tests utilizing the Template Unit Test library.

Functions

void operator|(PUP::er& p, tut::test_runner_singleton& runner)
template<typename T>
void veceq(const std::string& msg, const std::vector<T>& a, const std::vector<T>& b, tk::real prec = std::numeric_limits<T>::epsilon())
Ensure equality of all element of a vector of Ts (e.g., floating point numbers) up to some precision.
template<typename T, std::size_t N>
void veceq(const std::string& msg, const std::array<T, N>& a, const std::array<T, N>& b, tk::real prec = std::numeric_limits<T>::epsilon())
Ensure equality of all element of a array of Ts (e.g., floating point numbers) up to some precision.

Variables

tut::test_runner_singleton g_runner
Template Unit Test test runner.
CProxy_TUTSuite g_suiteProxy
std::string g_executable
int g_maxTestsInGroup
Max number of tests in every group.

Function documentation

void unittest::operator|(PUP::er& p, tut::test_runner_singleton& runner)

Pack/Unpack test runner. This Pack/Unpack method (re-)creates the test runner singleton on all processing elements. Therefore we circumvent Charm's usual pack/unpack for this type, and thus sizing does not make sense: sizing is a no-op. We could initialize the stack in UnitTestDriver's constructor and let this function re-create the runner only when unpacking, but that leads to repeating the same code twice: once in UnitTestDriver's constructor, once here. Another option is to use this pack/unpack routine to both initially create (when packing) and to re-create (when unpacking) the runner, which eliminates the need for pre-creating the object in UnitTestDriver's constructor and therefore eliminates the repeated code. This explains the guard for sizing: the code below is called for packing only (in serial) and packing and unpacking (in parallel).

template<typename T>
void unittest::veceq(const std::string& msg, const std::vector<T>& a, const std::vector<T>& b, tk::real prec = std::numeric_limits<T>::epsilon())

Ensure equality of all element of a vector of Ts (e.g., floating point numbers) up to some precision.

Parameters
msg in Message to output if the vectors are not equal
in First vector to compare
in Second vector to compare
prec in Optional precision

template<typename T, std::size_t N>
void unittest::veceq(const std::string& msg, const std::array<T, N>& a, const std::array<T, N>& b, tk::real prec = std::numeric_limits<T>::epsilon())

Ensure equality of all element of a array of Ts (e.g., floating point numbers) up to some precision.

Parameters
msg in Message to output if the arrays are not equal
in First array to compare
in Second array to compare
prec in Optional precision

Variable documentation

tut::test_runner_singleton unittest::g_runner

Template Unit Test test runner.

Global-scope data. Initialized by the main chare and distibuted to all PEs by the Charm++ runtime system. Though semantically not const, all these global data should be considered read-only. See also http://charm.cs.illinois.edu/manuals/html/charm++/manual.html. The data below is global-scope because they must be available to all PEs which could be on different machines.

CProxy_TUTSuite unittest::g_suiteProxy

Test suite Charm++ proxy facilitating call-back to unit test suite by individual unit tests spawning Charm++ chares

std::string unittest::g_executable

UnitTest executable name. So that FileParser's unit tests can access a file for opening.

int unittest::g_maxTestsInGroup

Max number of tests in every group.