diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt index 2d6ed53..590eadd 100644 --- a/GUI/CMakeLists.txt +++ b/GUI/CMakeLists.txt @@ -11,7 +11,6 @@ set(gui_SRCS misc.cpp exception.cpp extenwindow.cpp - tests.cpp host/host.cpp host/textthread.cpp host/util.cpp diff --git a/GUI/misc.cpp b/GUI/misc.cpp index 02c48ff..f276a6a 100644 --- a/GUI/misc.cpp +++ b/GUI/misc.cpp @@ -1,5 +1,6 @@ #include "misc.h" #include "const.h" +#include "defs.h" #include "host/util.h" #include #include @@ -238,3 +239,12 @@ QString GenerateCode(HookParam hp, DWORD processId) if (hp.type & DIRECT_READ) return GenerateRCode(hp); else return GenerateHCode(hp, processId); } + +TEST( + assert(ParseCode("/HQN936#-c*C:C*1C@4AA:gdi.dll:GetTextOutA")), + assert(ParseCode("/HB4@0")), + assert(ParseCode("/RS*10@44")), + assert(!ParseCode("HQ@4")), + assert(!ParseCode("/RW@44")), + assert(!ParseCode("/HWG@33")) +); diff --git a/GUI/tests.cpp b/GUI/tests.cpp deleted file mode 100644 index 0ae4dc0..0000000 --- a/GUI/tests.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "misc.h" - -static int TESTS = [] -{ - assert(ParseCode("/HQN936#-c*C:C*1C@4AA:gdi.dll:GetTextOutA")); - assert(ParseCode("/HB4@0")); - assert(ParseCode("/RS*10@44")); - assert(!ParseCode("HQ@4")); - assert(!ParseCode("/RW@44")); - assert(!ParseCode("/HWG@33")); - - return 0; -}(); \ No newline at end of file diff --git a/include/common.h b/include/common.h index 70b4d39..f648c4a 100644 --- a/include/common.h +++ b/include/common.h @@ -14,3 +14,4 @@ #include #include #include +#include diff --git a/include/defs.h b/include/defs.h index b756678..152fbea 100644 --- a/include/defs.h +++ b/include/defs.h @@ -35,4 +35,10 @@ inline void FORMAT_MESSAGE(const char* format, Ts ...args) MessageBoxA(NULL, buffer, "Textractor Message", MB_OK); } +#ifdef _DEBUG +#define TEST(...) static auto _ = std::invoke([]{ { __VA_ARGS__; } return 0; }) +#else +#define TEST(...) +#endif + // EOF