A test case that can be split into multiple sections.
More...
#include <Testing.h>
|
| template<typename Test > |
| static SC_TESTING_NO_INLINE bool | recordLiteralExpectation (Test &test, const char *expression, size_t length, bool status) |
| | Shares literal-message construction while preserving the test's expectation overloads.
|
| |
| template<typename Test > |
| static SC_TESTING_NO_INLINE bool | recordLiteralExpectation (Test &test, const char *expression, size_t length, Result status) |
| | Forwards a Result expectation with the same literal text and error identity.
|
| |
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:
namespace SC
{
struct ConsoleTest;
}
{
{
using namespace SC;
char optionalConversionBuffer[512];
Console console(optionalConversionBuffer);
{
console.print(str.
view());
console.print({});
}
{
console.printError("Test Error\n");
console.printErrorLine("Test Error Line");
console.flushStdErr();
}
}
};
namespace SC
{
void runConsoleTest(
SC::TestReport& report) { ConsoleTest test(report); }
}
◆ Execute
| Enumerator |
|---|
| Default | Test is executed if all tests are enabled or if this specific one matches –test-section.
|
| OnlyExplicit | Test is executed only if explicitly requested with –test-section.
|
◆ TestCase()
| SC::TestCase::TestCase |
( |
TestReport & | report, |
|
|
StringSpan | testName ) |
◆ recordExpectation() [1/2]
| bool SC::TestCase::recordExpectation |
( |
StringSpan | expression, |
|
|
bool | status, |
|
|
StringSpan | detailedError = StringSpan() ) |
Records an expectation for a given expression.
- Parameters
-
| expression | Expression converted to string |
| status | The boolean expectation of a test |
| detailedError | A detailed error message |
- Returns
status
◆ recordExpectation() [2/2]
| bool SC::TestCase::recordExpectation |
( |
StringSpan | expression, |
|
|
Result | status ) |
Records an expectation for a given expression.
- Parameters
-
| expression | Expression converted to string |
| status | A Result object, output from a test |
- Returns
false if status Result is not valid
◆ recordLiteralExpectation() [1/2]
template<typename Test >
| static SC_TESTING_NO_INLINE bool SC::TestCase::recordLiteralExpectation |
( |
Test & | test, |
|
|
const char * | expression, |
|
|
size_t | length, |
|
|
bool | status ) |
|
inlinestatic |
Shares literal-message construction while preserving the test's expectation overloads.
Keeping this boundary prevents repeated instrumentation of StringSpan temporaries at every assertion.
◆ recordLiteralExpectation() [2/2]
template<typename Test >
| static SC_TESTING_NO_INLINE bool SC::TestCase::recordLiteralExpectation |
( |
Test & | test, |
|
|
const char * | expression, |
|
|
size_t | length, |
|
|
Result | status ) |
|
inlinestatic |
Forwards a Result expectation with the same literal text and error identity.
◆ test_section()
Starts a new test section.
- Parameters
-
| sectionName | The name of the section |
| execution | Execution criteria |
- Returns
true if the test is enabled, false otherwise
◆ report
The documentation for this struct was generated from the following file: