DayZ 1.24
Loading...
Searching...
No Matches
TestFramework.c File Reference

Go to the source code of this file.

Classes

class  array
 Result for an object found in CGame.IsBoxCollidingGeometryProxy. More...
 
class  TFModule
 

Typedefs

typedef array< ref TFResultTFResultArr
 

Enumerations

enum  TFR { FAIL = -1 , SUCCESS , PENDING }
 

Functions

void TFResult (TFR result)
 
TFResult And (TFResult other)
 
TFResult Or (TFResult other)
 
void TestFramework ()
 
void ~TestFramework ()
 
override void EOnInit (IEntity other, int extra)
 
override void EOnFrame (IEntity other, float timeSlice)
 
void AddInitTest (string test)
 
void AddFrameTest (string test)
 
bool Assert (bool condition)
 
TFResult NTFR (TFR result)
 
TFResult BTFR (bool result)
 
TFResult CTFR ()
 

Variables

enum TFR Result
 
class TFModule m_OnInitModule
 Test Framework.
 
ref TFModule m_OnFrameModule
 

Typedef Documentation

◆ TFResultArr

Definition at line 43 of file TestFramework.c.

Enumeration Type Documentation

◆ TFR

Enumerator
FAIL 
SUCCESS 
PENDING 

Definition at line 1 of file TestFramework.c.

2{
3 FAIL = -1,
6}
@ PENDING
@ FAIL
@ SUCCESS

Function Documentation

◆ AddFrameTest()

void AddFrameTest ( string test)
protected

◆ AddInitTest()

void AddInitTest ( string test)
protected

Definition at line 245 of file TestFramework.c.

246 {
247 m_OnInitModule.AddTest(this, test, false);
248 }
class TFModule m_OnInitModule
Test Framework.

References m_OnInitModule.

Referenced by EnProfilerTests::EnProfilerTests(), PMTCreationAndCleanup(), PMTPlayback::PMTPlayback(), and ScriptInvokerTests::ScriptInvokerTests().

◆ And()

TFResult And ( TFResult other)

Definition at line 17 of file TestFramework.c.

18 {
19 if (Result == TFR.PENDING || other.Result == TFR.PENDING)
20 ErrorEx("Trying to And while one of the results are PENDING.");
21
22 if (Result == TFR.SUCCESS && other.Result == TFR.SUCCESS)
23 Result = TFR.SUCCESS;
24 else
25 Result = TFR.FAIL;
26
27 return this;
28 }
TFR
enum TFR Result
enum ShapeType ErrorEx

References ErrorEx, and Result.

◆ Assert()

◆ BTFR()

◆ CTFR()

TFResult CTFR ( )
protected

Definition at line 282 of file TestFramework.c.

283 {
284 return new TFResult(TFR.SUCCESS);
285 }

References TFResult().

Referenced by TestCleanup(), and TestMultiCreation().

◆ EOnFrame()

override void EOnFrame ( IEntity other,
float timeSlice )
protected

Definition at line 236 of file TestFramework.c.

237 {
238 if (m_OnFrameModule.Run(false, timeSlice))
239 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(Delete);
240 }
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

References CALL_CATEGORY_SYSTEM, GetGame(), and m_OnFrameModule.

◆ EOnInit()

override void EOnInit ( IEntity other,
int extra )
protected

Definition at line 231 of file TestFramework.c.

232 {
233 m_OnInitModule.Run(true, 0);
234 }

References m_OnInitModule.

◆ NTFR()

◆ Or()

TFResult Or ( TFResult other)

Definition at line 30 of file TestFramework.c.

31 {
32 if (Result == TFR.PENDING || other.Result == TFR.PENDING)
33 ErrorEx("Trying to Or while one of the results are PENDING.");
34
35 if (Result == TFR.SUCCESS || other.Result == TFR.SUCCESS)
36 Result = TFR.SUCCESS;
37 else
38 Result = TFR.FAIL;
39
40 return this;
41 }

References ErrorEx, and Result.

◆ TestFramework()

void TestFramework ( )
private

Definition at line 213 of file TestFramework.c.

214 {
215 SetEventMask(EntityEvent.INIT);
216 SetEventMask(EntityEvent.FRAME);
217
218 m_OnInitModule = new TFModule();
220 }
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44

References m_OnFrameModule, and m_OnInitModule.

◆ TFResult()

void TFResult ( TFR result)

Definition at line 12 of file TestFramework.c.

13 {
14 Result = result;
15 }

References Result.

Referenced by TFModule::AddTest(), BTFR(), CTFR(), NTFR(), TestCleanup(), and TestMultiCreation().

◆ ~TestFramework()

void ~TestFramework ( )
private

Definition at line 222 of file TestFramework.c.

223 {
224 m_OnInitModule.PrintResult("IM: ", this, "~TestFrameWork");
225 m_OnFrameModule.PrintResult("FM: ", this, "~TestFrameWork");
226 }

References m_OnFrameModule, and m_OnInitModule.

Variable Documentation

◆ m_OnFrameModule

ref TFModule m_OnFrameModule
private

Definition at line 211 of file TestFramework.c.

Referenced by AddFrameTest(), EOnFrame(), TestFramework(), and ~TestFramework().

◆ m_OnInitModule

class TFModule m_OnInitModule

Test Framework.

Referenced by AddInitTest(), EOnInit(), TestFramework(), and ~TestFramework().

◆ Result

enum TFR Result

Referenced by And(), Or(), and TFResult().