This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "tools/assert_that.hpp"
#define assert_that(cond) do {\
if (!(cond)) {\
std::cerr << __FILE__ << ':' << __LINE__ << ": " << __func__ << ": Assertion `" << #cond << "' failed." << '\n';\
std::exit(EXIT_FAILURE);\
}\
} while (false)
It asserts that cond
holds.
If cond
is false
, it outputs the debug information to std::cerr
and terminates the program with exit status EXIT_FAILURE
.
The macro is always enabled regardless of NDEBUG
unlike assert
.
cond
#ifndef TOOLS_ASSERT_THAT_HPP
#define TOOLS_ASSERT_THAT_HPP
#include <iostream>
#include <cstdlib>
#define assert_that_impl(cond, file, line, func) do {\
if (!cond) {\
::std::cerr << file << ':' << line << ": " << func << ": Assertion `" << #cond << "' failed." << '\n';\
::std::exit(EXIT_FAILURE);\
}\
} while (false)
#define assert_that(...) assert_that_impl((__VA_ARGS__), __FILE__, __LINE__, __func__)
#endif
#line 1 "tools/assert_that.hpp"
#include <iostream>
#include <cstdlib>
#define assert_that_impl(cond, file, line, func) do {\
if (!cond) {\
::std::cerr << file << ':' << line << ": " << func << ": Assertion `" << #cond << "' failed." << '\n';\
::std::exit(EXIT_FAILURE);\
}\
} while (false)
#define assert_that(...) assert_that_impl((__VA_ARGS__), __FILE__, __LINE__, __func__)