A test case that can be split into multiple sections. More...
#include <Testing.h>
Public Types | |
enum class | Execute { Default , OnlyExplicit } |
Public Member Functions | |
TestCase (TestReport &report, StringView testName) | |
Adds this TestCase to a TestReport with a name. | |
bool | recordExpectation (StringView expression, bool status, StringView detailedError=StringView()) |
Records an expectation for a given expression. | |
bool | recordExpectation (StringView expression, Result status) |
Records an expectation for a given expression. | |
bool | test_section (StringView sectionName, Execute execution=Execute::Default) |
Starts a new test section. | |
Public Attributes | |
TestReport & | report |
The TestReport object passed in the constructor. | |
Friends | |
struct | TestReport |
A test case that can be split into multiple sections.
To create a test case derive from SC::TestCase and run tests in the constructor
Example:
|
strong |
SC::TestCase::TestCase | ( | TestReport & | report, |
StringView | testName ) |
Adds this TestCase to a TestReport with a name.
report | The current TestReport |
testName | Name of this TestCase |
bool SC::TestCase::recordExpectation | ( | StringView | expression, |
bool | status, | ||
StringView | detailedError = StringView() ) |
Records an expectation for a given expression.
expression | Expression converted to string |
status | The boolean expectation of a test |
detailedError | A detailed error message |
status
bool SC::TestCase::recordExpectation | ( | StringView | expression, |
Result | status ) |
|
nodiscard |
Starts a new test section.
sectionName | The name of the section |
execution | Execution criteria |
true
if the test is enabled, false
otherwise TestReport& SC::TestCase::report |
The TestReport object passed in the constructor.