RobotTestingFramework  2.0.1
Robot Testing Framework
Macros
TestAssert.h File Reference
#include <robottestingframework/Asserter.h>
+ Include dependency graph for TestAssert.h:

Go to the source code of this file.

Macros

#define ROBOTTESTINGFRAMEWORK_COMPILER_MESSAGE(x)
 
#define ROBOTTESTINGFRAMEWORK_COMPILER_WARNING(x)
 
#define ROBOTTESTINGFRAMEWORK_COMPILER_ERROR(x)
 
#define ROBOTTESTINGFRAMEWORK_ASSERT_FAIL(message)
 Assertion with throwing failure exception. More...
 
#define ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_TRUE(condition, message)
 Conditional assertion with throwing failure exception. More...
 
#define ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_FALSE(condition, message)
 Conditional assertion with throwing failure exception. More...
 
#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR(message)
 Assertion with throwing error exception. More...
 
#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_TRUE(condition, message)
 Conditional assertion with throwing error exception. More...
 
#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(condition, message)
 Conditional assertion with throwing error exception. More...
 
#define ROBOTTESTINGFRAMEWORK_TEST_REPORT(message)
 Reporting a message to the TestResult. More...
 
#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(condition, message)
 Conditional failure report. More...
 
#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_TRUE(condition, message)
 Conditional failure report. More...
 
#define ROBOTTESTINGFRAMEWORK_TEST_CHECK(condition, message)
 ROBOTTESTINGFRAMEWORK_TEST_CHECK combines ROBOTTESTINGFRAMEWORK_TEST_REPORT and ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF. More...
 

Macro Definition Documentation

◆ ROBOTTESTINGFRAMEWORK_ASSERT_ERROR

#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR (   message)
Value:
message, \
static ROBOTTESTINGFRAMEWORK_NORETURN void error(TestMessage msg)
error Throw an error exception with the given message.
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Assertion with throwing error exception.

Parameters
messageMessage to be reported as the detail of TestMessage
Examples:
simple.cpp, and simple_runner.cpp.

Definition at line 90 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE

#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE (   condition,
  message 
)
Value:
::robottestingframework::TestMessage(std::string("asserts error on (") + std::string(#condition) + ") with exception", \
message, \
static ROBOTTESTINGFRAMEWORK_NORETURN void error(TestMessage msg)
error Throw an error exception with the given message.
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Conditional assertion with throwing error exception.

Parameters
messageMessage to be reported as the detail of TestMessage
conditionIf this condition evaluates to false then the test failed.

Definition at line 115 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_TRUE

#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_TRUE (   condition,
  message 
)
Value:
::robottestingframework::TestMessage(std::string("asserts error on (") + std::string(#condition) + ") with exception", \
message, \
static ROBOTTESTINGFRAMEWORK_NORETURN void error(TestMessage msg)
error Throw an error exception with the given message.
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Conditional assertion with throwing error exception.

Parameters
messageMessage to be reported as the detail of TestMessage
conditionIf this condition evaluates to true then the test failed.

Definition at line 102 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_ASSERT_FAIL

#define ROBOTTESTINGFRAMEWORK_ASSERT_FAIL (   message)
Value:
message, \
static ROBOTTESTINGFRAMEWORK_NORETURN void fail(TestMessage msg)
fail Throw a failure exception with the given message.
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Assertion with throwing failure exception.

Parameters
messageMessage to be reported as the detail of TestMessage

Definition at line 54 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_FALSE

#define ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_FALSE (   condition,
  message 
)
Value:
::robottestingframework::TestMessage(std::string("asserts failure on (") + std::string(#condition) + ") with exception", \
message, \
static ROBOTTESTINGFRAMEWORK_NORETURN void fail(TestMessage msg)
fail Throw a failure exception with the given message.
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Conditional assertion with throwing failure exception.

Parameters
messageMessage to be reported as the detail of TestMessage
conditionIf this condition evaluates to false then the test failed.

Definition at line 79 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_TRUE

#define ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_TRUE (   condition,
  message 
)
Value:
::robottestingframework::TestMessage(std::string("asserts failure on (") + std::string(#condition) + ") with exception", \
message, \
static ROBOTTESTINGFRAMEWORK_NORETURN void fail(TestMessage msg)
fail Throw a failure exception with the given message.
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Conditional assertion with throwing failure exception.

Parameters
messageMessage to be reported as the detail of TestMessage
conditionIf this condition evaluates to true then the test failed.

Definition at line 66 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_COMPILER_ERROR

#define ROBOTTESTINGFRAMEWORK_COMPILER_ERROR (   x)

Definition at line 43 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_COMPILER_MESSAGE

#define ROBOTTESTINGFRAMEWORK_COMPILER_MESSAGE (   x)

Definition at line 41 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_COMPILER_WARNING

#define ROBOTTESTINGFRAMEWORK_COMPILER_WARNING (   x)

Definition at line 42 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_TEST_CHECK

#define ROBOTTESTINGFRAMEWORK_TEST_CHECK (   condition,
  message 
)
Value:
message, \
dynamic_cast<::robottestingframework::TestCase*>(this)))
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
static void testCheck(bool condition, TestMessage msg, TestCase *testcase)
Checks the given boolean condition and if it is not hold (it is not true) a failure message will be a...
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

ROBOTTESTINGFRAMEWORK_TEST_CHECK combines ROBOTTESTINGFRAMEWORK_TEST_REPORT and ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF.

It does not throw any exception. It always reports the message (comment) and marks the current check as [PASSED] or [FAILED] respectively if the conditoin evalutes to true or false.

Parameters
messageMessage to be reported as the comment for the current check
conditionIf this condition evaluates to false then the test failed.
Note
ROBOTTESTINGFRAMEWORK_TEST_CHECK throws error exception if it is not called within a TestCase class.
Examples:
simple.cpp.

Definition at line 188 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE

#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE (   condition,
  message 
)
Value:
::robottestingframework::TestMessage(std::string("checking (") + std::string(#condition) + ")", \
message, \
dynamic_cast<::robottestingframework::TestCase*>(this)))
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
static void testFail(bool condition, TestMessage msg, TestCase *testcase)
Checks the given boolean condition and if it is not hold (it is not true) a failure message will be a...
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Conditional failure report.

ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE does not throw any exception. It reports a failure message to the TestResult indiecating that the check on the corresponding condition evaluates to false.

Parameters
messageMessage to be reported as the detail of TestMessage
conditionIf this condition evaluates to false then the test failed.
Note
ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE throws error exception if it is not called within a TestCase class.
Examples:
simple.cpp, simple_collector.cpp, simple_fixture.cpp, simple_runner.cpp, simple_suite.cpp, and simple_web.cpp.

Definition at line 149 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_TRUE

#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_TRUE (   condition,
  message 
)
Value:
::robottestingframework::TestMessage(std::string("checking (") + std::string(#condition) + ")", \
message, \
dynamic_cast<::robottestingframework::TestCase*>(this)))
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
static void testFail(bool condition, TestMessage msg, TestCase *testcase)
Checks the given boolean condition and if it is not hold (it is not true) a failure message will be a...
A formated message with details.
Definition: TestMessage.h:32
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Conditional failure report.

ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_TRUE does not throw any exception. It reports a failure message to the TestResult indiecating that the check on the corresponding condition evaluates to true.

Parameters
messageMessage to be reported as the detail of TestMessage
conditionIf this condition evaluates to true then the test failed.
Note
ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_TRUE throws error exception if it is not called within a TestCase class.

Definition at line 168 of file TestAssert.h.

◆ ROBOTTESTINGFRAMEWORK_TEST_REPORT

#define ROBOTTESTINGFRAMEWORK_TEST_REPORT (   message)
Value:
message, \
dynamic_cast<::robottestingframework::TestCase*>(this)))
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
A formated message with details.
Definition: TestMessage.h:32
static void report(TestMessage msg, TestSuite *testsuite)
report report a message to the result collector of the given TestSuite
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149

Reporting a message to the TestResult.

ROBOTTESTINGFRAMEWORK_TEST_REPORT does not throw any exception. It can be used to report any arbitrary message to the TestResult.

Parameters
messageMessage to be reported as the detail of TestMessage
Note
ROBOTTESTINGFRAMEWORK_TEST_REPORT throws error exception if it is not called within a TestCase class.
Examples:
simple.cpp, simple_collector.cpp, simple_fixture.cpp, simple_runner.cpp, simple_suite.cpp, and simple_web.cpp.

Definition at line 131 of file TestAssert.h.