scsl/Test.cc

33 lines
441 B
C++
Raw Normal View History

2023-10-10 02:59:21 +00:00
//
// Created by kyle on 2023-10-09.
//
2023-10-10 13:02:21 +00:00
#include "Exceptions.h"
2023-10-10 02:59:21 +00:00
#include "Test.h"
#include <iostream>
#include <cassert>
namespace klib {
void
TestAssert(bool condition, std::string message = "Assertion failed.")
{
#if defined(NDEBUG) || defined(KLIB_NO_ASSERT)
2023-10-10 02:59:21 +00:00
if (!condition) {
throw AssertionFailed(message);
}
#else
if (!condition) {
std::cerr << message << std::endl;
}
assert(condition);
#endif
}
} // namespace klib