scsl/Test.h

44 lines
1.1 KiB
C
Raw Normal View History

///
/// \file Test.h
/// \author K. Isom <kyle@imap.cc>
/// \date 2023-10-09
/// \brief Test.h implements basic testing tools.
///
2023-10-15 01:38:01 +00:00
#ifndef SCSL_TEST_H
#define SCSL_TEST_H
2023-10-10 02:59:21 +00:00
#include <string>
2023-10-10 02:59:21 +00:00
2023-10-15 01:38:01 +00:00
namespace scsl {
2023-10-10 02:59:21 +00:00
2023-10-11 01:57:43 +00:00
/// TestAssert is a variant on the assert macro. This variant is intended to be
/// a drop-in replacement for the cassert macro: even in release mode, the tests
/// should still run.
///
/// If NDEBUG is set, TestAssert will throw an exception if condition is false.
/// Otherwise, it calls assert after printing the message.
///
/// \param condition If true, TestAssert throws an exception.
void TestAssert(bool condition);
/// TestAssert is a variant on the assert macro.
///
/// If NDEBUG is set, TestAssert will throw an exception if condition is false.
/// Otherwise, it calls assert after printing the message.
///
2023-10-16 00:09:31 +00:00
/// In addition to NDEBUG, SCSL_NOEXCEPT will suppress assertions.
///
/// \throws AssertionFailed
///
/// \param condition The condition to assert.
/// \param message The message that should be displayed if condition is false.
2023-10-11 01:57:43 +00:00
void TestAssert(bool condition, std::string message);
2023-10-10 02:59:21 +00:00
2023-10-15 01:38:01 +00:00
} // namespace scsl
2023-10-10 02:59:21 +00:00
2023-10-15 01:38:01 +00:00
#endif //SCSL_TEST_H