Skip to content

Commit

Permalink
Add windows assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
mortinger91 committed Oct 24, 2023
1 parent 6c62794 commit 83a69e8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ProjectFolder/tests/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <string>
#include <vector>

#ifdef _WIN32
#include <Windows.h>
#endif
namespace test
{
void assertVectorContentIsEqual(std::vector<char> x, std::vector<char> y)
Expand Down Expand Up @@ -34,10 +37,17 @@ namespace test
}
} // namespace test

#ifdef _WIN32
#define assertTrue(expr) if (!(expr)) { \
std::cerr << "Assertion failed: " << #expr << " in " << __FILE__ << " line " << __LINE__ << std::endl; \
ExitProcess(1); \
}
#else
#define assertTrue(expr) if (!(expr)) { \
std::cerr << "Assertion failed: " << #expr << " in " << __FILE__ << " line " << __LINE__ << std::endl; \
std::abort(); \
}
#endif

#define ASSERT_THROW(condition) \
{ \
Expand Down

0 comments on commit 83a69e8

Please sign in to comment.