LkEngine
0.1.2
Loading...
Searching...
No Matches
AutomationTest.h
1
#pragma once
2
3
#include <
LkEngine/Core/CoreTypes.h
>
4
#include <
LkEngine/Core/CoreMacros.h
>
5
#include <LkEngine/Core/Log/Log.h>
6
#include <
LkEngine/Core/LObject/Object.h
>
7
#include <LkEngine/Core/LObject/ObjectPtr.h>
8
9
#include "TestMacros.h"
10
11
namespace
LkEngine::Test {
12
13
struct
FTestExecutionEntry
14
{
15
std::string Filename{};
16
int
LineNumber = -1;
17
};
18
19
class
LTestExecutionData
20
{
21
public
:
22
LTestExecutionData
() =
default
;
23
~LTestExecutionData
() =
default
;
24
25
FORCEINLINE
void
PushContext(
const
std::string& Context)
26
{
27
ContextStack.push_front(Context);
28
}
29
30
FORCEINLINE
void
PopContext()
31
{
32
ContextStack.pop_front();
33
}
34
35
public
:
36
bool
bSuccessful =
false
;
37
private
:
38
int
Warnings = 0;
39
int
Errors = 0;
40
std::deque<std::string> ContextStack{};
41
45
std::deque<FTestExecutionEntry> Entries{};
46
};
47
51
class
LAutomationTest
:
public
LObject
52
{
53
public
:
54
explicit
LAutomationTest
(
const
std::string& InName);
55
virtual
~LAutomationTest
();
56
60
virtual
bool
RunTest
() = 0;
61
65
virtual
ETestSuite
GetTestSuite
()
const
= 0;
66
67
public
:
68
bool
TestEqual(
const
int32_t Actual,
const
int32_t Expected,
const
char
* Message);
69
bool
TestEqual(
const
int64_t Actual,
const
int64_t Expected,
const
char
* Message);
70
bool
TestEqual(
const
std::size_t Actual,
const
std::size_t Expected,
const
char
* Message);
71
bool
TestEqual(
const
float
Actual,
const
float
Expected,
const
char
* Message);
72
bool
TestGreaterEqual(
const
int32_t Actual,
const
int32_t Expected,
const
char
* Message);
73
bool
TestGreaterEqual(
const
int64_t Actual,
const
int64_t Expected,
const
char
* Message);
74
bool
TestGreaterEqual(
const
std::size_t Actual,
const
std::size_t Expected,
const
char
* Message);
75
bool
TestGreaterEqual(
const
float
Actual,
const
float
Expected,
const
char
* Message);
76
bool
TestGreaterThan(
const
int32_t Actual,
const
int32_t Expected,
const
char
* Message);
77
bool
TestGreaterThan(
const
int64_t Actual,
const
int64_t Expected,
const
char
* Message);
78
bool
TestGreaterThan(
const
float
Actual,
const
float
Expected,
const
char
* Message);
79
bool
TestGreaterThan(
const
std::size_t Actual,
const
std::size_t Expected,
const
char
* Message);
80
bool
TestLessEqual(
const
int32_t Actual,
const
int32_t Expected,
const
char
* Message);
81
bool
TestLessEqual(
const
int64_t Actual,
const
int64_t Expected,
const
char
* Message);
82
bool
TestLessEqual(
const
float
Actual,
const
float
Expected,
const
char
* Message);
83
bool
TestLessThan(
const
int32_t Actual,
const
int32_t Expected,
const
char
* Message);
84
bool
TestLessThan(
const
int64_t Actual,
const
int64_t Expected,
const
char
* Message);
85
bool
TestLessThan(
const
float
Actual,
const
float
Expected,
const
char
* Message);
86
87
void
AddError(
const
std::string& ErrorMessage);
88
89
const
char
* GetName()
const
{
return
TestName.c_str(); }
90
91
public
:
93
static
int
SuppressLogs
;
94
static
bool
bElevateWarningsToErrors;
95
protected
:
96
LTestExecutionData
ExecutionData{};
97
std::string TestName{};
98
private
:
99
LCLASS
(
LAutomationTest
);
100
};
101
102
}
CoreMacros.h
Core macros used by the entire engine.
CoreTypes.h
Core types.
Object.h
LObject implementation.
LkEngine::LObject
Definition
Object.h:46
LkEngine::Test::LAutomationTest
Definition
AutomationTest.h:52
LkEngine::Test::LAutomationTest::GetTestSuite
virtual ETestSuite GetTestSuite() const =0
Get the test suite.
LkEngine::Test::LAutomationTest::SuppressLogs
static int SuppressLogs
Definition
AutomationTest.h:93
LkEngine::Test::LAutomationTest::RunTest
virtual bool RunTest()=0
Run the test.
LkEngine::Test::LTestExecutionData
Definition
AutomationTest.h:20
LCLASS
#define LCLASS(Class)
Definition
CoreMacros.h:226
LkEngine::Test::FTestExecutionEntry
Definition
AutomationTest.h:14
LkEngine
Test
LTesto
Source
LTesto
Core
AutomationTest.h
Generated by
1.12.0