20 :
message(std::move(in_message))
21 ,
file(
fs::GetFilenameFromPath(in_file))
31#define TEST(fxn, ...) runTest(#fxn, [&] () { fxn(__VA_ARGS__); });
36 throw TestFailedException(#x, __FILE__, __LINE__); \
41#define UTEST(x, fmt, ...) \
43 char utest_buf[1024]; \
44 snprintf(utest_buf, sizeof(utest_buf), fmt, __VA_ARGS__); \
45 throw TestFailedException(utest_buf, __FILE__, __LINE__); \
49#define UASSERTCMP(T, CMP, actual, expected) { \
53 std::ostringstream message; \
54 message << #actual " " #CMP " " #expected; \
55 message << std::endl << " actual : " << a; \
56 message << std::endl << " expected: " << e; \
57 throw TestFailedException(message.str(), __FILE__, __LINE__); \
61#define UASSERTEQ(T, actual, expected) UASSERTCMP(T, ==, actual, expected)
64#define EXCEPTION_CHECK(EType, code) { \
65 bool exception_thrown = false; \
68 } catch (EType &e) { \
69 exception_thrown = true; \
71 UASSERT(exception_thrown); \
88 void runTest(
const char *name, std::function<
void()> &&test);
98 static std::vector<TestBase *> m_modules_to_test;
99 return m_modules_to_test;
117bool run_tests(
const std::string &module_name);
u32 num_tests_run
Definition test.h:86
std::string m_test_dir
Definition test.h:91
std::string getTestTempDirectory()
Definition test.cpp:333
bool testModule(IGameDef *gamedef)
Definition test.cpp:313
virtual const char * getName()=0
std::string getTestTempFile()
Definition test.cpp:343
virtual void runTests(IGameDef *gamedef)=0
u32 num_tests_failed
Definition test.h:85
void runTest(const char *name, std::function< void()> &&test)
Definition test.cpp:351
const std::string message
Definition test.h:25
TestFailedException(std::string in_message, const char *in_file, int in_line)
Definition test.h:19
const std::string file
Definition test.h:26
const int line
Definition test.h:27
static std::vector< TestBase * > & getTestModules()
Definition test.h:96
static void registerTestModule(TestBase *module)
Definition test.h:102
u16 content_t
Definition mapnode.h:22
Definition filesys.cpp:53
content_t t_CONTENT_TORCH
Definition test.cpp:24
content_t t_CONTENT_STONE
Definition test.cpp:22
content_t t_CONTENT_BRICK
Definition test.cpp:27
content_t t_CONTENT_WATER
Definition test.cpp:25
content_t t_CONTENT_LAVA
Definition test.cpp:26
bool run_tests()
Definition test.cpp:210
content_t t_CONTENT_GRASS
Definition test.cpp:23