Luna/tests/test.h
apio a99a0e5a54
All checks were successful
continuous-integration/drone/push Build is passing
tests: Start testing libluna
Hooray!!
2023-04-23 21:52:28 +02:00

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;