mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-19 22:38:52 +00:00
32 lines
2.0 KiB
Plaintext
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)
|