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)
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);
TFResult NTFR(TFR result)
class TFModule m_OnInitModule
Test Framework.
TFResult Or(TFResult other)
bool Assert(bool condition)
void TFResult(TFR result)
TFResult And(TFResult other)
ref TFModule m_OnFrameModule
void AddFrameTest(string test)
void AddInitTest(string test)
override void EOnInit(IEntity other, int extra)
TFResult BTFR(bool result)
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 ...
ref array< string > m_FailedTests
ref array< string > m_SucceededTests
ref TFResultArr m_Results
void PrintResult(string prefix="", TestFramework caller=null, string function="")
bool RunTest(TFCaller caller, float dt)
void AddTest(Class instance, string test, bool repeat)
bool Run(bool fatal, float dt)
void TFCaller(Class instance, string test, TFResult result)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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.