Luna/tests/test.h

29 lines
1.8 KiB
C
Raw Permalink Normal View History

2023-04-23 19:52:28 +00:00
#pragma once
#include <luna/DebugLog.h>
#include <luna/Result.h>
Result<void> test_main();
#define test_prelude bool rc
#define test_success return true
#define run_test(name) \
rc = TRY(name()); \
if (!rc) \
{ \
dbgln("test failed: %s", #name); \
check(false); \
} \
else \
dbgln("test passed: %s", #name);
#define validate(cond) \
if (!(cond)) \
{ \
dbgln("unexpected result: %s", #cond); \
return false; \
}
typedef Result<bool> TestResult;