tts v2.3.0
The Tiny Test System
 
Loading...
Searching...
No Matches

◆ TTS_WHEN

#define TTS_WHEN (   STORY)
Value:
TTS_DISABLE_WARNING_PUSH \
TTS_DISABLE_WARNING_SHADOW \
std::cout << "[^] - For: " << ::tts::detail::current_test << "\n"; \
std::cout << "When : " << STORY << std::endl; \
for(int tts_section = 0, tts_count = 1; tts_section < tts_count; tts_count -= 0==tts_section++) \
for( tts::detail::only_once tts_only_once_setup{}; tts_only_once_setup; ) \
TTS_DISABLE_WARNING_POP \

Start a block of scoped environment.

Code in a scoped environment can contain:

  • Normal expressions
  • scoped tests introduced by TTS_AND_THEN

Example

#define TTS_MAIN
#include <tts/tts.hpp>
TTS_CASE( "Check test with sub-test" )
{
TTS_WHEN("We start some sub-test")
{
int i = 99;
TTS_AND_THEN("We increment a variable")
{
TTS_EQUAL(i,99);
i++;
TTS_EQUAL(i,100);
}
TTS_AND_THEN("We decrement a variable")
{
// At the start of this sub-test, i is equal to 99 again
TTS_EQUAL(i,99);
i--;
TTS_EQUAL(i,98);
}
}
};
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition: case.hpp:147
#define TTS_EQUAL(LHS, RHS,...)
Performs equality comparison between two expressions.
Definition: relation.hpp:90
#define TTS_WHEN(STORY)
Start a block of scoped environment.
Definition: when.hpp:80
#define TTS_AND_THEN(...)
Add a scoped tests to current scoped environment.
Definition: when.hpp:144