2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-08-22 21:21:41 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
|
|
|
* Run test functions.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Specific test to run (default is to run all) <STRING> (default: #all)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [] call ace_common_fnc_runTests
|
|
|
|
* ["fcs"] call ace_common_fnc_runTests
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
params [["_specificTest", "#all", [""]]];
|
|
|
|
|
|
|
|
private _startTime = diag_tickTime;
|
|
|
|
private _fails = [];
|
|
|
|
private _total = 0;
|
|
|
|
|
2024-02-05 17:04:24 +00:00
|
|
|
INFO_1("ace_common_fnc_runTests starting for [%1]",_specificTest);
|
2017-08-22 21:21:41 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
private _testName = configName _x;
|
|
|
|
if ((_specificTest == "#all") || {_specificTest == _testName}) then {
|
|
|
|
_total = _total + 1;
|
|
|
|
private _testFile = getText _x;
|
|
|
|
diag_log text format ["----- Starting Testing %1 [%2] -----", _testName, _testFile];
|
|
|
|
private _return = ([nil] apply (compile preProcessFileLineNumbers _testFile)) select 0;
|
2021-02-27 17:05:05 +00:00
|
|
|
if ((isNil "_return") || {_return isNotEqualTo true}) then {
|
2017-08-22 21:21:41 +00:00
|
|
|
systemChat format ["Test [%1] Failed", _testName];
|
|
|
|
diag_log text format ["----- Finished Testing %1 [Failed] -----", _testName];
|
|
|
|
_fails pushBack _testName;
|
|
|
|
} else {
|
|
|
|
diag_log text format ["----- Finished Testing %1 [Passed] -----", _testName];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach (configProperties [configFile >> "ACE_Tests"]);
|
|
|
|
|
2024-02-05 17:04:24 +00:00
|
|
|
INFO_1("ace_common_fnc_runTests finished in %1 ms",(1000 * (diag_tickTime - _startTime)) toFixed 1);
|
|
|
|
INFO_2("[%1 / %2] Tests Passed",(_total - (count _fails)),_total);
|
2021-02-27 17:05:05 +00:00
|
|
|
if (_fails isNotEqualTo []) then {
|
2024-02-05 17:04:24 +00:00
|
|
|
INFO_1("Failed: %1",_fails);
|
2017-08-22 21:21:41 +00:00
|
|
|
};
|