forked from Public-Mirror/Textractor
easier testing
This commit is contained in:
parent
a5057d8671
commit
6c0f4be45b
@ -11,7 +11,6 @@ set(gui_SRCS
|
||||
misc.cpp
|
||||
exception.cpp
|
||||
extenwindow.cpp
|
||||
tests.cpp
|
||||
host/host.cpp
|
||||
host/textthread.cpp
|
||||
host/util.cpp
|
||||
|
10
GUI/misc.cpp
10
GUI/misc.cpp
@ -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"))
|
||||
);
|
||||
|
@ -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;
|
||||
}();
|
@ -14,3 +14,4 @@
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user