User Manual, Developers Guide and API Documentation

TestFixture.hpp File Reference

#include <WNS/Assure.hpp>
#include <WNS/Conversion.hpp>
#include <WNS/events/scheduler/Interface.hpp>
#include <WNS/rng/RNGen.hpp>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cmath>

Include dependency graph for TestFixture.hpp:

Go to the source code of this file.

Namespaces

namespace  wns
namespace  wns::testsuite

Classes

class  wns::TestFixture
 Derive from this class instead of CppUnit::TestFixture. More...

Defines

#define WNS_ASSERT_ASSURE_EXCEPTION(expression)
#define WNS_ASSERT_ASSURE_NOT_NULL_EXCEPTION(expression)
#define WNS_ASSERT_MAX_REL_ERROR(expected, actual, maxRelativeError)   wns::assertMaxRelError((expected), (actual), (maxRelativeError), __FILE__, ::wns::to<std::string>(__LINE__))
 Advanced version of CPPUNIT_ASSERT_DOUBLES_EQUAL.

Functions

template<typename T>
void wns::assertMaxRelError (const T &expected, const T &actual, double maxRelativeError, const std::string sourceFile, const std::string sourceLine)
 Asserts that the relative error between "expected" and "actual" is not greater than "maxRelativeError" (used for unit tests).
std::string wns::testsuite::Default ()
 CppUnit default registry.
std::string wns::testsuite::Disabled ()
 Registry for disabled tests.
std::string wns::failureMessage (const std::string &sourceFile, const std::string &sourceLine, const std::string &expected, const std::string &actual)
 Construct a failure message containing file, line, expected and actual value.
std::string wns::testsuite::Performance ()
 Registry for performance tests.
std::string wns::testsuite::Spike ()
 Registry for spikes.


Define Documentation

#define WNS_ASSERT_ASSURE_EXCEPTION ( expression   ) 

Definition at line 233 of file TestFixture.hpp.

#define WNS_ASSERT_ASSURE_NOT_NULL_EXCEPTION ( expression   ) 

Definition at line 234 of file TestFixture.hpp.

#define WNS_ASSERT_MAX_REL_ERROR ( expected,
actual,
maxRelativeError   )     wns::assertMaxRelError((expected), (actual), (maxRelativeError), __FILE__, ::wns::to<std::string>(__LINE__))

Author:
Marc Schinnenburg <marc@schinnenburg.com>
CPPUNIT_ASSERT_DOUBLES_EQUAL lets you test if

\[ |expected-actual|<error \]

But normally you want to test for a realtive error:

\[ \left|\frac{expected-actual}{expected}\right|<maxRelativeError \]

This is performed if this macro is used.

Definition at line 205 of file TestFixture.hpp.


Generated on Sat May 26 03:32:19 2012 for openWNS by  doxygen 1.5.5