2020-02-03 12:05:46 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#include <cstring>
|
|
|
|
#include "../extern/catch.hpp"
|
2020-03-22 09:11:53 +00:00
|
|
|
#include "../src/Library/Exceptions/CreatureException.hpp"
|
2020-02-03 12:05:46 +00:00
|
|
|
|
|
|
|
TEST_CASE("When throwing exception, what() is readable", "[Utilities]") {
|
2020-02-22 14:07:16 +00:00
|
|
|
bool hasCaught = false;
|
2020-02-03 12:05:46 +00:00
|
|
|
try {
|
|
|
|
throw CreatureException("foobar");
|
2020-02-22 14:07:16 +00:00
|
|
|
} catch (const std::exception& e) {
|
|
|
|
hasCaught = true;
|
2020-02-03 12:05:46 +00:00
|
|
|
INFO(e.what());
|
|
|
|
REQUIRE(strcmp(e.what(), "foobar") == 0);
|
|
|
|
}
|
2020-02-22 14:07:16 +00:00
|
|
|
REQUIRE(hasCaught);
|
2020-02-03 12:05:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|