Files
nvbench/testing/test_asserts.cuh
Allison Vacanti 7b14ceb3fe Add detail::state_generator.
This helper utility computes the cartesian product of the runtime
axes.
2020-12-27 10:29:24 -05:00

32 lines
2.0 KiB
Plaintext

#pragma once
#include <fmt/format.h>
#define ASSERT(cond) \
do \
{ \
if (cond) \
{} \
else \
{ \
fmt::print("{}:{}: Assertion failed ({}).\n", __FILE__, __LINE__, #cond); \
exit(EXIT_FAILURE); \
} \
} while (false)
#define ASSERT_MSG(cond, fmtstr, ...) \
do \
{ \
if (cond) \
{} \
else \
{ \
fmt::print("{}:{}: Test assertion failed ({}) {}\n", \
__FILE__, \
__LINE__, \
#cond, \
fmt::format(fmtstr, __VA_ARGS__)); \
exit(EXIT_FAILURE); \
} \
} while (false)