8 #ifndef _INC_cUnitTest_H
9 #define _INC_cUnitTest_H
10 #ifndef NO_PRAGMA_ONCE
61 static const cStrConst k_asTextLines[k_TEXTLINES_QTY + 1];
101 template <
class T = cUnitTest>
131 THREADID_t m_nMainThreadPrev;
185 bool IsTestInteractive() const noexcept;
186 bool TestInteractivePrompt(const
char* pszMsg) noexcept;
191 void RunInitialize();
200 #define UNITTEST_TRUE(x) ASSERT(x)
201 #define UNITTEST_TRUE2(x,d) ASSERT(x)
205 #define UNITTEST_REGISTER_NAME(n) g_UnitTest_##n
206 #define UNITTEST_REGISTER(n,l) ::Gray::cUnitTestRegisterT< UNITTEST_N(n) > UNITTEST_REGISTER_NAME(n)( #n, l );
209 #define UNITTEST_EXT_NAME(n) g_pUnitTest_##n
210 #define UNITTEST_EXT_DEF(n) cUnitTestRegister* UNITTEST_EXT_NAME(n) = &UNITTEST_REGISTER_NAME(n);
214 using namespace Gray;
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
Definition: cAppState.h:82
THREADID_t m_nMainThreadId
The thread we started with. main().
Definition: cAppState.h:104
APPSTATE_TYPE_ get_AppState() const noexcept
Definition: cAppState.h:142
void put_AppState(APPSTATE_TYPE_ eAppState) noexcept
Definition: cAppState.h:148
void InitAppState() noexcept
Definition: cAppState.cpp:273
THREADID_t get_MainThreadId() const noexcept
Definition: cAppState.h:156
Definition: cLogAppender.h:168
Definition: cSingleton.h:30
Definition: cSingleton.h:127
Definition: StrConst.h:39
Definition: cUnitTest.h:123
cUnitTestAppState()
Definition: cUnitTest.h:134
~cUnitTestAppState() noexcept
Definition: cUnitTest.h:143
Definition: cUnitTest.h:103
cUnitTestRegisterT(const LOGCHAR_t *pszTestName, UNITTEST_LEVEL_TYPE nTestLevel=UNITTEST_LEVEL_Core)
Definition: cUnitTest.h:109
virtual cUnitTest * CreateUnitTest() override
must implement this.
Definition: cUnitTest.h:114
Definition: cUnitTest.h:85
const LOGCHAR_t * m_pszTestName
Display Name for the unit test.
Definition: cUnitTest.h:91
virtual cUnitTest * CreateUnitTest()=0
must implement this.
const UNITTEST_LEVEL_TYPE m_nTestLevel
at what level does this test run?
Definition: cUnitTest.h:92
Definition: cUnitTest.h:67
virtual void RunUnitTest()=0
Run the test.
Definition: cUnitTest.h:151
cStringF m_sTestInpDir
root for source of test input files. might change based on cOSModImpl?
Definition: cUnitTest.h:166
AssertCallback_t * m_pAssertOrig
Definition: cUnitTest.h:161
int m_iFailures
Count total unit test failures.
Definition: cUnitTest.h:172
static AssertCallback_t UnitTest_AssertCallback
redirect assert here for test failure. requires _DEBUG or _DEBUG_FAST.
Definition: cUnitTest.h:160
cArrayPtr< cUnitTestRegister > m_aUnitTests
list of all registered unit tests. Register as they get instantiate by C runtime static loader.
Definition: cUnitTest.h:159
cArrayString< LOGCHAR_t > m_aTestNames
Definition: cUnitTest.h:164
UNITTEST_LEVEL_TYPE m_nTestLevel
restore the original assert.
Definition: cUnitTest.h:163
cLogProcessor * m_pLog
cLogMgr::I() for output of tests. Why not just use DEBUG_MSG ??
Definition: cUnitTest.h:169
cStringF m_sTestOutDir
global config for input files.
Definition: cUnitTest.h:167
bool m_bRunning
We are actively running in the Gray test framework. Not in M$ framework.
Definition: cUnitTest.h:171
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
virtual void RunUnitTest() override
Definition: cFileTextReader.Tests.cpp:14
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
APPSTATE_TYPE_
Definition: cAppState.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
public cUnitTest
Definition: cAppConsole.Tests.cpp:11
char LOGCHAR_t
always just use UTF8 for logs, don't bother with UNICODE.
Definition: cLogLevel.h:17
UNITTEST_LEVEL_TYPE
Definition: cUnitTest.h:32
@ UNITTEST_LEVEL_Slow
5=slow tests
Definition: cUnitTest.h:40
@ UNITTEST_LEVEL_All
6=interactive tests, need special external rigs, db, etc
Definition: cUnitTest.h:41
@ UNITTEST_LEVEL_None
Definition: cUnitTest.h:35
@ UNITTEST_LEVEL_Common
4 = Common or application level tests.
Definition: cUnitTest.h:39
@ UNITTEST_LEVEL_Crit
1=critical tests. usually stuff i want to debug now.
Definition: cUnitTest.h:36
@ UNITTEST_LEVEL_Core
2=only the most basic tests.
Definition: cUnitTest.h:37
@ UNITTEST_LEVEL_Off
These test don't work yet. or is broken.
Definition: cUnitTest.h:42
@ UNITTEST_LEVEL_Lib
3
Definition: cUnitTest.h:38
Definition: cUnitTest.h:48
static const FILECHAR_t * k_TestFiles
Definition: cUnitTest.h:55
static const cStrConst k_sTextBlob
a single allocated k_TEXTBLOB_LEN+1
Definition: cUnitTest.h:59
static int sm_nCreatedUnitTests
Count the cUnitTest objects I have created. NOT just m_aUnitTests.
Definition: cUnitTest.h:54