easier testing

This commit is contained in:
Akash Mozumdar 2018-12-26 23:56:42 -05:00
parent a5057d8671
commit 6c0f4be45b
5 changed files with 17 additions and 14 deletions

View File

@ -11,7 +11,6 @@ set(gui_SRCS
misc.cpp
exception.cpp
extenwindow.cpp
tests.cpp
host/host.cpp
host/textthread.cpp
host/util.cpp

View File

@ -1,5 +1,6 @@
#include "misc.h"
#include "const.h"
#include "defs.h"
#include "host/util.h"
#include <Psapi.h>
#include <QTextStream>
@ -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"))
);

View File

@ -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;
}();

View File

@ -14,3 +14,4 @@
#include <thread>
#include <mutex>
#include <cstdint>
#include <cassert>

View File

@ -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