1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #pragma once
- #include "openmpt/all/BuildSettings.hpp"
- #ifdef ENABLE_TESTS
- #ifdef MODPLUG_TRACKER
- #include "mpt/test/test.hpp"
- OPENMPT_NAMESPACE_BEGIN
- namespace Test {
- #if MPT_COMPILER_MSVC
- #define MyDebugBreak() __debugbreak()
- #else
- #define MyDebugBreak() DebugBreak()
- #endif
- class mpt_test_reporter
- : public mpt::test::silent_reporter
- {
- public:
- mpt_test_reporter() = default;
- ~mpt_test_reporter() override = default;
- public:
- inline void immediate_breakpoint() override {
- MyDebugBreak();
- }
- };
- #define VERIFY_EQUAL(x,y) \
- do { \
- if(!((x) == (y))) { \
- MyDebugBreak(); \
- } \
- } while(0) \
- #define VERIFY_EQUAL_NONCONT VERIFY_EQUAL
- #define VERIFY_EQUAL_QUIET_NONCONT VERIFY_EQUAL
- #define VERIFY_EQUAL_EPS(x,y,eps) \
- do { \
- if(std::abs((x) - (y)) > (eps)) { \
- MyDebugBreak(); \
- } \
- } while(0) \
- #define DO_TEST(func) \
- do { \
- if(IsDebuggerPresent()) { \
- func(); \
- } \
- } while(0) \
- }
- OPENMPT_NAMESPACE_END
- #endif
- #endif
|