![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cUnitTest.h>
Public Member Functions | |
| cUnitTests () | |
| HRESULT | InitTestOutDir () |
| bool | RegisterUnitTest (cUnitTestRegister *pTest) |
| void | SetTestLevel (UNITTEST_LEVEL_TYPE nTestLevel) |
| bool | TestActive (const cUnitTestRegister *pUnitTest, bool remove) |
| cUnitTestRegister * | FindUnitTest (const char *pszName) const |
| bool | IsTestInteractive () const noexcept |
| bool | TestInteractivePrompt (const char *pszMsg) noexcept |
| const FILECHAR_t * | get_TestInpDir () const |
| const FILECHAR_t * | get_TestOutDir () const |
| void | RunInitialize () |
| void | RunCleanup () |
| HRESULT | RunUnitTests (UNITTEST_LEVEL_TYPE nTestLevel=UNITTEST_LEVEL_Common, const LOGCHAR_t *pszTestNameMatch=nullptr) |
| Run all tests <= this UNITTEST_LEVEL_TYPE. More... | |
| const void * | get_HeapPtr () const noexcept override |
| Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More... | |
Public Member Functions inherited from Gray::CObject | |
| virtual | ~CObject () |
| virtual bool | isValidCheck () const noexcept |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | AssertValid () const |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | Serialize (cArchive &a) |
Public Member Functions inherited from Gray::cHeapObject | |
| cHeapObject () | |
| virtual | ~cHeapObject () |
| bool | IsValidInsideN (INT_PTR index) const |
| bool | IsValidInsidePtr (void const *pTest) const |
| virtual size_t | GetHeapStatsThis (OUT ITERATE_t &iAllocCount) const |
| virtual bool | isValidCheck () const noexcept |
Public Attributes | |
| cArrayPtr< cUnitTestRegister > | m_aUnitTests |
| list of all registered unit tests. Register as they get instantiate by C runtime static loader. More... | |
| AssertCallback_t * | m_pAssertOrig |
| UNITTEST_LEVEL_TYPE | m_nTestLevel |
| restore the original assert. More... | |
| cArrayString< LOGCHAR_t > | m_aTestNames |
| cStringF | m_sTestInpDir |
| root for source of test input files. might change based on cOSModImpl? More... | |
| cStringF | m_sTestOutDir |
| global config for input files. More... | |
| cLogProcessor * | m_pLog |
| cLogMgr::I() for output of tests. Why not just use DEBUG_MSG ?? More... | |
| bool | m_bRunning |
| We are actively running in the Gray test framework. Not in M$ framework. More... | |
| int | m_iFailures |
| Count total unit test failures. More... | |
Static Public Attributes | |
| static AssertCallback_t | UnitTest_AssertCallback |
| redirect assert here for test failure. requires _DEBUG or _DEBUG_FAST. More... | |
Static Public Attributes inherited from Gray::cSingletonRegister | |
| static cThreadLockFast | sm_LockSingle |
| common lock for all cSingleton. More... | |
Static Public Attributes inherited from Gray::cUnitTestCur | |
| static int | sm_nCreatedUnitTests = 0 |
| Count the cUnitTest objects I have created. NOT just m_aUnitTests. More... | |
| static const FILECHAR_t * | k_TestFiles = _FN("TestFiles") |
| static const StrLen_t | k_TEXTBLOB_LEN = 566 |
| StrT::Len(k_sTextBlob) = 0x236. More... | |
| static const cStrConst | k_sTextBlob |
| a single allocated k_TEXTBLOB_LEN+1 More... | |
| static const StrLen_t | k_TEXTLINES_QTY = 18 |
| STRMAX= _countof(k_asTextLines)-1. More... | |
| static const cStrConst | k_asTextLines [k_TEXTLINES_QTY+1] |
| nullptr terminated array of lines of text. More... | |
Friends | |
| class | cUnitTestRegister |
Additional Inherited Members | |
Static Public Member Functions inherited from Gray::cSingleton< cUnitTests > | |
| static cUnitTests *__stdcall | get_Single () |
| static TYPE2 *__stdcall | get_SingleT () |
| static cUnitTests &__stdcall | I () |
Static Public Member Functions inherited from Gray::cSingletonStatic< TYPE > | |
| static bool | isSingleCreated () noexcept |
| static TYPE * | get_SingleU () noexcept |
| static TYPE * | get_Single () |
| template<class TYPE2 > | |
| static TYPE2 *__stdcall | get_SingleCast () |
| static TYPE & | I () noexcept |
Static Public Member Functions inherited from Gray::cSingletonRegister | |
| static void __stdcall | ReleaseModule (HMODULE hMod) |
Static Public Member Functions inherited from Gray::cUnitTestCur | |
| static bool __stdcall | TestTypes () |
Protected Member Functions inherited from Gray::cSingleton< cUnitTests > | |
| cSingleton (cUnitTests *pObject, const TYPEINFO_t &rAddrCode=typeid(cUnitTests)) noexcept | |
| virtual | ~cSingleton () |
Protected Member Functions inherited from Gray::cSingletonStatic< TYPE > | |
| cSingletonStatic (TYPE *pObject) noexcept | |
| virtual | ~cSingletonStatic () noexcept |
Protected Member Functions inherited from Gray::cSingletonRegister | |
| cSingletonRegister (const TYPEINFO_t &rAddrCode) noexcept | |
| virtual | ~cSingletonRegister () |
| void | RegisterSingleton () |
Protected Attributes inherited from Gray::cSingletonRegister | |
| HMODULE | m_hModuleLoaded |
| What modules loaded this ? So singletons can be destroyed if DLL/SO unloads. More... | |
Static Protected Attributes inherited from Gray::cSingletonStatic< TYPE > | |
| static TYPE * | sm_pThe = nullptr |
| pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr. More... | |
Singleton class to hold the list of all unit tests registered. MUST use cSingleton and not cSingletonStatic to prevent C runtime load order problems.
| Gray::cUnitTests::cUnitTests | ( | ) |
| cUnitTestRegister * Gray::cUnitTests::FindUnitTest | ( | const char * | pszName | ) | const |
Find a single test by name.
|
inlineoverridevirtualnoexcept |
Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr().
Reimplemented from Gray::cHeapObject.
| const FILECHAR_t * Gray::cUnitTests::get_TestInpDir | ( | ) | const |
Get source of input files for tests. e.g. "C:\Dennis\Source\Gray\" or "C:\Dennis\Source\bin\x64v142"
| const FILECHAR_t * Gray::cUnitTests::get_TestOutDir | ( | ) | const |
Get a temporary directory for use by UnitTests
| HRESULT Gray::cUnitTests::InitTestOutDir | ( | ) |
|
noexcept |
is a user expected to interact with or verify the output of the tests ?
| bool Gray::cUnitTests::RegisterUnitTest | ( | cUnitTestRegister * | pTest | ) |
| void Gray::cUnitTests::RunCleanup | ( | ) |
| void Gray::cUnitTests::RunInitialize | ( | ) |
| HRESULT Gray::cUnitTests::RunUnitTests | ( | UNITTEST_LEVEL_TYPE | nTestLevel = UNITTEST_LEVEL_Common, |
| const LOGCHAR_t * | pszTestNameMatch = nullptr |
||
| ) |
Run all tests <= this UNITTEST_LEVEL_TYPE.
Execute all the registered unit tests at the selected nTestLevel.
| void Gray::cUnitTests::SetTestLevel | ( | UNITTEST_LEVEL_TYPE | nTestLevel | ) |
| bool Gray::cUnitTests::TestActive | ( | const cUnitTestRegister * | pUnitTest, |
| bool | remove | ||
| ) |
|
noexcept |
prompt the user to manually check some output from the test. require user to press key or button.
|
friend |
| cArrayString<LOGCHAR_t> Gray::cUnitTests::m_aTestNames |
| cArrayPtr<cUnitTestRegister> Gray::cUnitTests::m_aUnitTests |
list of all registered unit tests. Register as they get instantiate by C runtime static loader.
| bool Gray::cUnitTests::m_bRunning |
We are actively running in the Gray test framework. Not in M$ framework.
| int Gray::cUnitTests::m_iFailures |
Count total unit test failures.
| UNITTEST_LEVEL_TYPE Gray::cUnitTests::m_nTestLevel |
restore the original assert.
The current global test level for UnitTests(). throttle tests at run time.
| AssertCallback_t* Gray::cUnitTests::m_pAssertOrig |
| cLogProcessor* Gray::cUnitTests::m_pLog |
cLogMgr::I() for output of tests. Why not just use DEBUG_MSG ??
| cStringF Gray::cUnitTests::m_sTestInpDir |
root for source of test input files. might change based on cOSModImpl?
| cStringF Gray::cUnitTests::m_sTestOutDir |
global config for input files.
|
static |
redirect assert here for test failure. requires _DEBUG or _DEBUG_FAST.
Assert was called during a unit test. This is a failure! Assume assert will log this. AssertCallback_t sm_pAssertCallback = cDebugAssert::Assert_Fail was called in UnitTest. GRAYCALL