Skip to content

Commit 4e095f8

Browse files
committed
Introduced Unit Tests
1 parent b5464bb commit 4e095f8

File tree

6 files changed

+2584
-1
lines changed

6 files changed

+2584
-1
lines changed

examples/Test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
## Test
2-
Test plugin project used in automatic builds for verification of generated PluginSDK binaries.
2+
Test plugin project is used in automatic builds for verification of generated PluginSDK binaries.

examples/UnitTests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Unit Tests
2+
Plugin hosting and running Unit Tests.

examples/UnitTests/source/Main.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <plugin.h>
2+
#include "utest.h"
3+
#include "Test_CVector.h"
4+
5+
using namespace plugin;
6+
7+
UTEST_STATE();
8+
9+
struct Main
10+
{
11+
Main()
12+
{
13+
// register event callbacks
14+
Events::menuDrawingEvent += []{ gInstance.RunTests(); };
15+
}
16+
17+
void RunTests()
18+
{
19+
// just once
20+
static bool ran = false;
21+
if (ran) return;
22+
ran = true;
23+
24+
if(AllocConsole())
25+
{
26+
SetWindowText(GetConsoleWindow(), "Plugin-SDK Unit Tests");
27+
//RemoveMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_BYCOMMAND);
28+
29+
// redirect output into new console
30+
FILE* fDummy;
31+
freopen_s(&fDummy, "CONOUT$", "w", stdout);
32+
std::cout.clear();
33+
std::clog.clear();
34+
}
35+
36+
utest_main(__argc, __argv);
37+
}
38+
} gInstance;
39+

0 commit comments

Comments
 (0)