19 if (
Result ==
TFR.PENDING || other.Result ==
TFR.PENDING)
20 ErrorEx(
"Trying to And while one of the results are PENDING.");
22 if (
Result ==
TFR.SUCCESS && other.Result ==
TFR.SUCCESS)
32 if (
Result ==
TFR.PENDING || other.Result ==
TFR.PENDING)
33 ErrorEx(
"Trying to Or while one of the results are PENDING.");
35 if (
Result ==
TFR.SUCCESS || other.Result ==
TFR.SUCCESS)
63 ErrorEx(
string.Format(
"Failed to call function \'%1\' on \'%2\'", m_Test,
m_Instance.GetDebugName()));
64 m_Result.Result =
TFR.FAIL;
130 m_Tests.Insert(
new TFCaller(instance, test, result));
133 bool Run(
bool fatal,
float dt)
138 int runningTests =
m_Tests.Count();
139 for (
int i = 0; i < runningTests; ++i)
147 foreach (TFCaller doneT : done)
151 if (fatal &&
m_Tests.Count() > 0)
153 Print(
"- Active tests -------------------------");
154 foreach (TFCaller rTest :
m_Tests)
155 Print(rTest.GetTest());
156 Print(
"----------------------------------------");
158 ErrorEx(
"Not all tests are done while run was fatal.");
165 private bool RunTest(TFCaller caller,
float dt)
167 TFR res = caller.Run(dt).Result;
181 return res !=
TFR.PENDING;
194 Debug.
TFLog(
" |-[SUCCESS]", caller, function);
197 Debug.
TFLog(
string.Format(
" |- %1", success), caller, function);
205 Debug.
TFLog(
string.Format(
" |- %1", fail), caller, function);
protected void AddFrameTest(string test)
protected override void EOnInit(IEntity other, int extra)
private ref TFModule m_OnFrameModule
protected void AddInitTest(string test)
TFResult NTFR(TFR result)
class TFModule m_OnInitModule
Test Framework.
protected bool Assert(bool condition)
TFResult Or(TFResult other)
void TFResult(TFR result)
TFResult And(TFResult other)
TFResult BTFR(bool result)
protected override void EOnFrame(IEntity other, float timeSlice)
array< ref TFResult > TFResultArr
override ScriptCallQueue GetCallQueue(int call_category)
Super root of all classes in Enforce script.
static void TFLog(string message=LOG_DEFAULT, TestFramework caller=null, string function="")
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
void PrintResult(string prefix="", TestFramework caller=null, string function="")
private ref TFCallerArr m_Tests
private bool RunTest(TFCaller caller, float dt)
private ref array< string > m_SucceededTests
private ref TFResultArr m_Results
void AddTest(Class instance, string test, bool repeat)
bool Run(bool fatal, float dt)
private ref array< string > m_FailedTests
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
private ref TFResult m_Result
void TFCaller(Class instance, string test, TFResult result)
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)
EntityEvent
Entity events for event-mask, or throwing event from code.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.