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

◆ TTS_THROW

#define TTS_THROW (   EXPR,
  EXCEPTION,
  ... 
)    TTS_THROW_ ## __VA_ARGS__ ( EXPR, EXCEPTION )

Checks if a given expression throws an exception of a given type.

Parameters
EXPRExpression to evaluate.
EXCEPTIONExpected exception type to be thrown.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN
#include <tts/tts.hpp>
struct some_exception_type {};
void foo() { throw some_exception_type(); }
TTS_CASE( "Check that we can capture thrown exceptions" )
{
TTS_THROW( foo(), some_exception_type );
};
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition: case.hpp:147
#define TTS_THROW(EXPR, EXCEPTION,...)
Checks if a given expression throws an exception of a given type.
Definition: exceptions.hpp:62