Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save olegsinavski/882cfcd596929dc98cc716057b64f3ef to your computer and use it in GitHub Desktop.
Save olegsinavski/882cfcd596929dc98cc716057b64f3ef to your computer and use it in GitHub Desktop.
Ctest assert
#define REQUIRE( ... ) \
do { \
if( !( __VA_ARGS__ ) ) { \
std::stringstream ss; \
ss << "Unit test assert [ " \
<< ( #__VA_ARGS__ ) \
<< " ] failed in line [ " \
<< __LINE__ \
<< " ] file [ " \
<< __FILE__ << " ]" \
<< std::endl; \
throw std::runtime_error(ss.str()); \
} \
} while( false )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment