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:
(::robottestingframework::Asserter::error(::robottestingframework::TestMessage("asserts error with exception", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE())))
ROBOTTESTINGFRAMEWORK_SOURCELINE
#define ROBOTTESTINGFRAMEWORK_SOURCELINE()
Definition: TestMessage.h:148
ROBOTTESTINGFRAMEWORK_SOURCEFILE
#define ROBOTTESTINGFRAMEWORK_SOURCEFILE()
Definition: TestMessage.h:149
robottestingframework::Asserter::error
static ROBOTTESTINGFRAMEWORK_NORETURN void error(TestMessage msg)
error Throw an error exception with the given message.
robottestingframework::TestMessage
A formated message with details.
Definition: TestMessage.h:33

Assertion with throwing error exception.

Parameters

  message | Message 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::Asserter::error(condition, \
::robottestingframework::TestMessage(std::string("asserts error on (") + std::string(#condition) + ") with exception", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE())))

Conditional assertion with throwing error exception.

Parameters

  message | Message to be reported as the detail of TestMessage
  condition | If 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::Asserter::error(!condition, \
::robottestingframework::TestMessage(std::string("asserts error on (") + std::string(#condition) + ") with exception", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE())))

Conditional assertion with throwing error exception.

Parameters

  message | Message to be reported as the detail of TestMessage
  condition | If 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:
(::robottestingframework::Asserter::fail(::robottestingframework::TestMessage("asserts failure with exception", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE())))
robottestingframework::Asserter::fail
static ROBOTTESTINGFRAMEWORK_NORETURN void fail(TestMessage msg)
fail Throw a failure exception with the given message.

Assertion with throwing failure exception.

Parameters

  message | Message 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::Asserter::fail(condition, \
::robottestingframework::TestMessage(std::string("asserts failure on (") + std::string(#condition) + ") with exception", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE())))

Conditional assertion with throwing failure exception.

Parameters

  message | Message to be reported as the detail of TestMessage
  condition | If 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::Asserter::fail(!condition, \
::robottestingframework::TestMessage(std::string("asserts failure on (") + std::string(#condition) + ") with exception", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE())))

Conditional assertion with throwing failure exception.

Parameters

  message | Message to be reported as the detail of TestMessage
  condition | If 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:
(::robottestingframework::Asserter::testCheck(condition, \
::robottestingframework::TestMessage("checks", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE()), \
dynamic_cast<::robottestingframework::TestCase*>(this)))
robottestingframework::Asserter::testCheck
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...
robottestingframework::TestCase
The base class to implememnt a test case.
Definition: TestCase.h:42

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

  message | Message to be reported as the comment for the current check
  condition | If 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::Asserter::testFail(condition, \
::robottestingframework::TestMessage(std::string("checking (") + std::string(#condition) + ")", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE()), \
dynamic_cast<::robottestingframework::TestCase*>(this)))
robottestingframework::Asserter::testFail
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...

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

  message | Message to be reported as the detail of TestMessage
  condition | If 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::Asserter::testFail(!condition, \
::robottestingframework::TestMessage(std::string("checking (") + std::string(#condition) + ")", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE()), \
dynamic_cast<::robottestingframework::TestCase*>(this)))

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

  message | Message to be reported as the detail of TestMessage
  condition | If 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:
(::robottestingframework::Asserter::report(::robottestingframework::TestMessage("reports", \
message, \
ROBOTTESTINGFRAMEWORK_SOURCEFILE(), \
ROBOTTESTINGFRAMEWORK_SOURCELINE()), \
dynamic_cast<::robottestingframework::TestCase*>(this)))
robottestingframework::Asserter::report
static void report(TestMessage msg, TestSuite *testsuite)
report report a message to the result collector of the given TestSuite

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

  message | Message 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.