8 #ifndef _TurtleBrains_UnitTest_h_
9 #define _TurtleBrains_UnitTest_h_
11 #include "../tb_configuration.h"
12 #include "../tb_defines.h"
13 #include "../tb_string.h"
14 #include "../tb_noncopyable.h"
22 #define tbFailTestIf(test, failMessage, ...) { TurtleBrains::Core::UnitTest::FailTestIf((test) ? true : false, __FILE__, __LINE__, failMessage, ##__VA_ARGS__); }
27 #define tbFailTestIfNot(test, failMessage, ...) { TurtleBrains::Core::UnitTest::FailTestIf((test) ? false : true, __FILE__, __LINE__, failMessage, ##__VA_ARGS__); }
36 extern const float kEpsilon;
38 void RunAllTests(
void);
40 void FailTestIf(
bool testResult,
const char*
const fromFile,
int onLineNumber,
const char*
const failMessage, ...);
42 void Log(
const char*
const failMessage, ...);
43 void Log(
const char*
const fromFile,
int onLineNumber,
const char*
const failMessage, ...);
44 void Log(
const char*
const fromFile,
int onLineNumber,
const char*
const failMessage, va_list argumentList);
52 const std::string& GetTestName(
void)
const {
return mTestName; }
53 const std::string& GetMessageBuffer(
void)
const {
return mMessageBuffer; }
58 template <
typename Type>
bool ExpectedValue(
const Type& value,
const Type& expectedValue,
const tbCore::tbString formattedMessage, ...)
60 if (value != expectedValue)
62 va_list argumentsList;
63 va_start(argumentsList, formattedMessage);
64 FailedExpectation(formattedMessage, argumentsList);
65 va_end(argumentsList);
71 bool ExpectedValue(
float value,
float expectedValue,
const tbCore::tbString formattedMessage, ...);
72 bool ExpectedValueWithin(
float value,
float expectedValue,
float epsilon,
const tbCore::tbString formattedMessage, ...);
73 bool ExpectedValue(
double value,
double expectedValue,
const tbCore::tbString formattedMessage, ...);
74 bool ExpectedValueWithin(
double value,
double expectedValue,
double epsilon,
const tbCore::tbString formattedMessage, ...);
76 virtual bool OnRunTest(
void) = 0;
79 void FailedExpectation(
const tbCore::tbString formattedMessage, va_list argumentList);
83 bool mAllExpectationPassed;
Definition: tb_noncopyable.h:22
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
Definition: tb_unit_test.h:46
void Log(const char *formattedMessage,...)
Contains core functionality for each component of the API.
Definition: tb_debug_logger.h:91
std::string tbString
Definition: tb_string.h:335