TTS v3.0.0
The Tiny Test System
 
Loading...
Searching...
No Matches
Basic Tests Macros

Macros for performing direct true/false checks over predicate-like expressions. More...

Informations Reporting

#define TTS_PASS(...)
 Force a passing test and display a message.
 
#define TTS_FAIL(...)
 Force a failing test and display a message.
 
#define TTS_FATAL(...)
 Force a failing test, display a message and halt the test suite.
 

Predicate Checks

#define TTS_EXPECT(EXPR, ...)
 Check if a given expression evaluates to true.
 
#define TTS_EXPECT_NOT(EXPR, ...)
 Check if a given expression evaluates to false.
 
#define TTS_CONSTEXPR_EXPECT(EXPR, ...)
 Check if a given expression evaluates to true at compile-time.
 
#define TTS_CONSTEXPR_EXPECT_NOT(EXPR, ...)
 Check if a given expression evaluates to false at compile-time.
 

Macro Definition Documentation

◆ TTS_CONSTEXPR_EXPECT

#define TTS_CONSTEXPR_EXPECT (   EXPR,
  ... 
)

#include <tts/test/basic.hpp>

Check if a given expression evaluates to true at compile-time.

Parameters
EXPRExpression to evaluate and compare to true.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that expectation can be met")
{
constexpr int a = 42, b = 69;
};
#define TTS_CONSTEXPR_EXPECT(EXPR,...)
Check if a given expression evaluates to true at compile-time.
Definition basic.hpp:115
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition case.hpp:139

◆ TTS_CONSTEXPR_EXPECT_NOT

#define TTS_CONSTEXPR_EXPECT_NOT (   EXPR,
  ... 
)

#include <tts/test/basic.hpp>

Check if a given expression evaluates to false at compile-time.

Parameters
EXPRExpression to evaluate and compare to false.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that counter-expectation can be met")
{
constexpr int a = 42, b = 69;
};
#define TTS_CONSTEXPR_EXPECT_NOT(EXPR,...)
Check if a given expression evaluates to false at compile-time.
Definition basic.hpp:151

◆ TTS_EXPECT

#define TTS_EXPECT (   EXPR,
  ... 
)

#include <tts/test/basic.hpp>

Check if a given expression evaluates to true.

Parameters
EXPRExpression to evaluate and compare to true.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that expectation can be met")
{
int a = 42, b = 69;
TTS_EXPECT(a < b);
TTS_EXPECT(b > a);
TTS_EXPECT(a != b);
// This test would cause the program to stop and not run the remaining tests
// TTS_EXPECT(a == b, REQUIRED);
TTS_EXPECT(a <= b);
TTS_EXPECT(b >= a);
};
#define TTS_EXPECT(EXPR,...)
Check if a given expression evaluates to true.
Definition basic.hpp:43

◆ TTS_EXPECT_NOT

#define TTS_EXPECT_NOT (   EXPR,
  ... 
)

#include <tts/test/basic.hpp>

Check if a given expression evaluates to false.

Parameters
EXPRExpression to evaluate and compare to false.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that expectation can't be met")
{
int a = 42, b = 69;
TTS_EXPECT_NOT(a == b);
// This test would cause the program to stop and not run the remaining tests
// TTS_EXPECT_NOT(a != b, REQUIRED);
TTS_EXPECT_NOT(a >= b);
};
#define TTS_EXPECT_NOT(EXPR,...)
Check if a given expression evaluates to false.
Definition basic.hpp:79

◆ TTS_FAIL

#define TTS_FAIL (   ...)

#include <tts/engine/info.hpp>

Force a failing test and display a message.

Parameters
...A format string and potential arguments to display as additional informations

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that forced failure fails")
{
TTS_FAIL("Forced failure!!");
TTS_PASS("This will pass though");
};
#define TTS_PASS(...)
Force a passing test and display a message.
Definition info.hpp:44
#define TTS_FAIL(...)
Force a failing test and display a message.
Definition info.hpp:68

◆ TTS_FATAL

#define TTS_FATAL (   ...)

#include <tts/engine/info.hpp>

Force a failing test, display a message and halt the test suite.

Parameters
...A format string and potential arguments to display as additional informations

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that forced major failure fails")
{
TTS_PASS("This will pass");
TTS_FATAL("Forced major failure!!");
TTS_PASS("This won't pass");
};
#define TTS_FATAL(...)
Force a failing test, display a message and halt the test suite.
Definition info.hpp:93

◆ TTS_PASS

#define TTS_PASS (   ...)

#include <tts/engine/info.hpp>

Force a passing test and display a message.

Parameters
...A format string and potential arguments to display as additional informations

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check that forced pass passes") { TTS_PASS("Forced success!!"); };