10#ifndef STKTEST_CONTEX_H_
11#define STKTEST_CONTEX_H_
68 #if defined(_WIN32) || defined(WIN32)
72 printf(
"STKTEST-START\n");
80 printf(
"STKTEST-RESULT: %d\n", (
int)result);
107#define STK_TEST_CHECK_EQUAL(expected, actual)\
108 if ((expected) != (actual)) {\
109 printf("STK_TEST_CHECK_EQUAL failed!\n file: %s\n line: %d\n expected: %d\n actual: %d\n", __FILE__, __LINE__, (int)expected, (int)actual);\
110 __stk_debug_break();\
117#define STK_TEST_DECL_ASSERT\
118 extern void STK_ASSERT_HANDLER(const char *message, const char *file, int32_t line)\
120 printf("_STK_ASSERT failed!\n file: %s\n line: %d\n message: %s\n", file, (int)line, message);\
121 __stk_debug_break();\
Namespace of STK package.
Namespace of the test inventory.
TestContext g_TestContext
Global instance of the TestContext.
Common context for a test suite.
bool IsExpectingPanic() const
Check if test case is expecting kernel panic.
void ExpectPanic(bool expect)
Start expecting kernel panic for the test case.
bool m_rethrow_assert
rethrow assert's exception
static void ShowTestSuitePrologue()
Show text string as prologue before tests start.
static TestContext m_instance
global instance of the TestContext
void ExpectAssert(bool expect)
Start expecting assertion for the test case.
void RethrowAssertException(bool rethrow)
Re-throw assert's exception for the test case.
bool IsRethrowingAssertException() const
Check if exception must be thrown if assertion is hit.
static void ForceExitTestSuite(int32_t result)
Exit test suite process forcibly.
@ DEFAULT_FAILURE_EXIT_CODE
default exit code for exit() to denote failure of the test
@ SUCCESS_EXIT_CODE
exit code for exit() to denote the success of the test
static void ShowTestSuiteEpilogue(int32_t result)
Show text string as epilogue after tests end.
bool IsExpectingAssert() const
Check if test case is expecting assertion.
bool m_expect_assert
assert expectation flag
bool m_expect_panic
panic expectation flag