-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathtest_findNil.sqf
More file actions
41 lines (30 loc) · 1.08 KB
/
test_findNil.sqf
File metadata and controls
41 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ----------------------------------------------------------------------------
#define DEBUG_MODE_FULL
#include "script_component.hpp"
SCRIPT(test_findNil);
// ----------------------------------------------------------------------------
private ["_expected", "_result", "_fn"];
_fn = "CBA_fnc_findNil";
LOG("Testing " + _fn);
TEST_DEFINED("CBA_fnc_findNil","");
// Use of embeded nil
_result = ["", 5, objNull, nil, player] call CBA_fnc_findNil;
_expected = 3;
TEST_OP(_result,==,_expected,_fn);
// Only find the first nil
_result = ["", 5, objNull, player, nil, nil] call CBA_fnc_findNil;
_expected = 4;
TEST_OP(_result,==,_expected,_fn);
// Return a not found when there is no nil
_result = ["", 5, objNull, displayNull, player] call CBA_fnc_findNil;
_expected = -1;
TEST_OP(_result,==,_expected,_fn);
// Return a not found when empty array is given
_result = [] call CBA_fnc_findNil;
_expected = -1;
TEST_OP(_result,==,_expected,_fn);
// Return a not found when a non array is given
_result = "not an array" call CBA_fnc_findNil;
_expected = -1;
TEST_OP(_result,==,_expected,_fn);
nil;