Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cUnitTestMs.h
Go to the documentation of this file.
1 //
2 // cUnitTestMs.h
3 //
4 
5 #pragma once
6 #include "../GrayCore/include/cUnitTest.h"
7 #include "../GrayCore/include/cLogMgr.h"
8 
9  // use _LIB && _WINDLL && _MFC_VER to identify the type of LIB build. or it may just be who is including us.
10 #ifndef GRAYCORE_TEST_LINK
11 #if defined(_MFC_VER) || defined(GRAY_STATICLIB) // GRAY_STATICLIB or _MFC_VER can be defined to make Gray* all static lib
12 #define GRAYCORE_TEST_LINK
13 #else
14 #define GRAYCORE_TEST_LINK __DECL_IMPORT // default is to include from a DLL/SO (GRAY_DLL)
15 #endif
16 #endif
17 
18 #ifdef USE_UNITTESTS_MS // register with M$ unit test framework as well. define in global namespace.
19 #include <CppUnitTest.h>
20 using namespace Microsoft::VisualStudio::CppUnitTestFramework;
21 #endif
22 
23 namespace Gray
24 {
25 
26 #ifdef USE_UNITTESTS_MS // _WIN32 should register with M$ unit test framework as well. define in global namespace.
27 
28 #define UNITTEST2_CLASS(n) TEST_CLASS( UNITTEST_N(n)) , public cUnitTest
29 #define UNITTEST2_METHOD(x) public: virtual ~UNITTEST_N(x)() noexcept(false) {} TEST_METHOD(RunTest) { this->RunUnitTest(); } virtual void RunUnitTest() override
30 #define UNITTEST2_REGISTER(n,x) // make a static instance of the class to register itself. for non-M$ test
31 #define UNITTEST2_TRUE(x) Assert::IsTrue(x)
32 
33 #else
34 
35 #define UNITTEST2_CLASS(n) class UNITTEST_N(n) : public cUnitTest
36 #define UNITTEST2_METHOD(x) public: virtual void UnitTest() override // call the public virtual as a test. TEST_METHOD(x)
37 #define UNITTEST2_REGISTER(n,x) // make a static instance of the class to register itself. for non-M$ test
38 #define UNITTEST2_TRUE(x) // (x)
39 
40 #endif
41 
42 }
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14