29 lines
1.8 KiB
C
29 lines
1.8 KiB
C
|
#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;
|