Slight tweaks for CreatureException, add tests to see if what() works.

This commit is contained in:
2020-02-03 13:05:46 +01:00
parent c3b573c7da
commit 07700008f7
2 changed files with 18 additions and 2 deletions

15
tests/ExceptionTests.cpp Normal file
View File

@@ -0,0 +1,15 @@
#ifdef TESTS_BUILD
#include <cstring>
#include "../extern/catch.hpp"
#include "../src/Core/Exceptions/CreatureException.hpp"
TEST_CASE("When throwing exception, what() is readable", "[Utilities]") {
try {
throw CreatureException("foobar");
} catch (const CreatureException& e) {
INFO(e.what());
REQUIRE(strcmp(e.what(), "foobar") == 0);
}
}
#endif