NeKernel dev
Loading...
Searching...
No Matches
TestCase.h File Reference

Go to the source code of this file.

Macros

#define KT_RUN_TEST(OBJECT)
 Kernel Test Framework main header.
#define KT_MUST_PASS(MSG, LEFT_COND, RIGHT_COND)
#define KT_DECL_TEST(NAME, FN)

Functions

 KT_DECL_TEST (AlwaysBreak, []() -> bool { KT_MUST_PASS("AlwaysBreak", YES, NO);return NO;})
 KT_DECL_TEST (AlwaysPass, []() -> bool { KT_MUST_PASS("AlwaysPass", YES, YES);return YES;})

Macro Definition Documentation

◆ KT_DECL_TEST

#define KT_DECL_TEST ( NAME,
FN )
Value:
class KTTestCase##NAME final { \
public: \
KTTestCase##NAME() = default; \
~KTTestCase##NAME() = default; \
LIBSYS_COPY_DELETE(KTTestCase##NAME); \
Void Run(); \
const Char* ToString(); \
}; \
inline Void KTTestCase##NAME::Run() { \
auto ret = FN() == YES; \
if (!ret) { \
PrintOut(nullptr, "[KERNEL-TEST] TEST FAILED!"); \
MUST_PASS(ret); \
} \
} \
inline const Char* KTTestCase##NAME::ToString() { \
return #FN; \
}
#define YES
char Char
Definition Config.h:51

◆ KT_MUST_PASS

#define KT_MUST_PASS ( MSG,
LEFT_COND,
RIGHT_COND )
Value:
if (LEFT_COND != RIGHT_COND) { \
MUST_PASS(NO); \
}
#define NO

◆ KT_RUN_TEST

#define KT_RUN_TEST ( OBJECT)
Value:
{ \
KTTestCase##OBJECT{}.Run(); \
}

Kernel Test Framework main header.

================================================================================

@file TestCase.h

Function Documentation

◆ KT_DECL_TEST() [1/2]

KT_DECL_TEST ( AlwaysBreak ,
[] () -> bool { KT_MUST_PASS("AlwaysBreak", YES, NO);return NO;}  )

◆ KT_DECL_TEST() [2/2]

KT_DECL_TEST ( AlwaysPass ,
[] () -> bool { KT_MUST_PASS("AlwaysPass", YES, YES);return YES;}  )