mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
easier testing
This commit is contained in:
parent
a5057d8671
commit
6c0f4be45b
@ -11,7 +11,6 @@ set(gui_SRCS
|
|||||||
misc.cpp
|
misc.cpp
|
||||||
exception.cpp
|
exception.cpp
|
||||||
extenwindow.cpp
|
extenwindow.cpp
|
||||||
tests.cpp
|
|
||||||
host/host.cpp
|
host/host.cpp
|
||||||
host/textthread.cpp
|
host/textthread.cpp
|
||||||
host/util.cpp
|
host/util.cpp
|
||||||
|
10
GUI/misc.cpp
10
GUI/misc.cpp
@ -1,5 +1,6 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
#include "defs.h"
|
||||||
#include "host/util.h"
|
#include "host/util.h"
|
||||||
#include <Psapi.h>
|
#include <Psapi.h>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
@ -238,3 +239,12 @@ QString GenerateCode(HookParam hp, DWORD processId)
|
|||||||
if (hp.type & DIRECT_READ) return GenerateRCode(hp);
|
if (hp.type & DIRECT_READ) return GenerateRCode(hp);
|
||||||
else return GenerateHCode(hp, processId);
|
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 <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cassert>
|
||||||
|
@ -35,4 +35,10 @@ inline void FORMAT_MESSAGE(const char* format, Ts ...args)
|
|||||||
MessageBoxA(NULL, buffer, "Textractor Message", MB_OK);
|
MessageBoxA(NULL, buffer, "Textractor Message", MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define TEST(...) static auto _ = std::invoke([]{ { __VA_ARGS__; } return 0; })
|
||||||
|
#else
|
||||||
|
#define TEST(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user