-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Settings - Fixes for whitespaces and comments, added unit tests (#1622)
Co-authored-by: PabstMirror <[email protected]>
- Loading branch information
1 parent
843ab67
commit 71a08bd
Showing
11 changed files
with
238 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// ----------------------------------------------------------------------------- | ||
// Automatically generated by 'functions_config.rb' | ||
// DO NOT MANUALLY EDIT THIS FILE! | ||
// ----------------------------------------------------------------------------- | ||
#define DEBUG_MODE_FULL | ||
#include "script_component.hpp" | ||
|
||
#define TESTS ["parse"] | ||
|
||
SCRIPT(test-settings); | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
LOG("=== Testing Settings ==="); | ||
|
||
{ | ||
private _test = execVM format ["\x\cba\addons\settings\test_%1.sqf", _x]; | ||
waitUntil { scriptDone _test }; | ||
} forEach TESTS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// ---------------------------------------------------------------------------- | ||
#define DEBUG_MODE_FULL | ||
#include "script_component.hpp" | ||
|
||
SCRIPT(test_settings); | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
private ["_funcName", "_settings", "_result"]; | ||
|
||
LOG('Testing Settings'); | ||
|
||
// UNIT TESTS (parse) | ||
_funcName = QFUNC(parse); | ||
TEST_DEFINED(QFUNC(parse),""); | ||
|
||
// Purposely weird formatting, must remain this way because newlines remain part of result | ||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_regular.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["ace_advanced_ballistics_ammoTemperatureEnabled", true, 0], | ||
["ace_advanced_ballistics_barrelLengthInfluenceEnabled", false, 2], | ||
["ace_advanced_ballistics_bulletTraceEnabled", true, 1], | ||
["ace_advanced_fatigue_enabled", false, 0], | ||
["ace_advanced_fatigue_enableStaminaBar", true, 0], | ||
["ace_advanced_fatigue_performanceFactor", 1, 1], | ||
["ace_advanced_fatigue_terrainGradientFactor", 1, 2] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_multiline.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test1", "[ | ||
"" item_1 "", | ||
"" item_2 "" | ||
]", 0], | ||
["test2", "[ | ||
' item_1 ', | ||
' item_2 ' | ||
]", 1], | ||
["test3", "[ | ||
' item_1 ' , "" item_2 "" | ||
]", 2], | ||
["test4", " | ||
[ | ||
'"" item_1 ""', | ||
' item_2 ' | ||
] | ||
", 0] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_unicode.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [["test1", "[Āā, Ăă, Ҙ, привет]", 1]]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_strings.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test1", "", 0], | ||
["test2", "", 0], | ||
["test3", " T E S T " , 0], | ||
["test4", " T E S T ", 0], | ||
["test5", "[ ' t e s t ' , "" T E S T "" ]", 0], | ||
["test6", "[ "" t e s t "" , | ||
"""" T E S T """" ]", 0], | ||
["test7", "[ true, false ]", 0], | ||
["test8", "[ "" item_1 "" , "" item_2 "" ]", 0], | ||
["test9", "[ ' item_1 ' , ' item_2 ' ]", 0], | ||
["test10", "[ ' item_1 ' , "" item_2 "" ]", 0], | ||
["test11", "[ '"" item_1 ""' , ' item_2 ' ]", 0], | ||
["test12", "[ ' item_1 ' , ""' item_2 '"" ]", 0] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
// Don't preprocess for testing comments | ||
_settings = (loadFile "x\cba\addons\settings\test_settings_comments.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test2", "[true,false]", 1], | ||
["test4", "[ ' t e s t ' , "" T E S T "" ]", 0], | ||
["ace_advanced_ballistics_ammoTemperatureEnabled", true, 0], | ||
["ace_advanced_ballistics_barrelLengthInfluenceEnabled", true, 2], | ||
["ace_advanced_ballistics_bulletTraceEnabled", true, 1] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (loadFile "x\cba\addons\settings\test_settings_comments_eof.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test1", "[""item_1"",""item_2""]", 1] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
force test1 = "[""item_1"",""item_2""]"; | ||
*/ | ||
|
||
force test2 = "[true,false]"; | ||
/* | ||
//forceforceforce = true;//"[""ACE_DAGR"",""ACE_microDAGR""]"; | ||
*/ | ||
|
||
//test3 = "[Āā,Ăă,Ҙ,привет]"; | ||
test4 = "[ ' t e s t ' , "" T E S T "" ]"; | ||
/* | ||
test5 = '[ " t e s t ", | ||
"" T E S T "" ]'; | ||
test6 = ''; // "settings,"; | ||
test7 = " T S T "; | ||
*/ | ||
|
||
|
||
// ACE Advanced Ballistics | ||
ace_advanced_ballistics_ammoTemperatureEnabled = true; | ||
force force ace_advanced_ballistics_barrelLengthInfluenceEnabled = true; | ||
force ace_advanced_ballistics_bulletTraceEnabled = true; | ||
|
||
// ACE Advanced Fatigue | ||
/*/* | ||
ace_advanced_fatigue_enabled = true; | ||
ace_advanced_fatigue_enableStaminaBar = true; | ||
/* | ||
force ace_advanced_fatigue_performanceFactor = 1; | ||
force force ace_advanced_fatigue_terrainGradientFactor = 1; | ||
*/ | ||
|
||
// End of file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
force test1 = "[""item_1"",""item_2""]"; | ||
|
||
// ACE Advanced Fatigue | ||
/* | ||
force test2 = "[true,false]"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
test1 = "[ | ||
"" item_1 "", | ||
"" item_2 "" | ||
]"; | ||
|
||
force test2 = "[ | ||
' item_1 ', | ||
' item_2 ' | ||
]"; | ||
|
||
force force test3 = | ||
|
||
"[ | ||
' item_1 ' , "" item_2 "" | ||
]" | ||
|
||
; | ||
|
||
test4 = " | ||
[ | ||
'"" item_1 ""', | ||
' item_2 ' | ||
] | ||
" | ||
|
||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ACE Advanced Ballistics | ||
ace_advanced_ballistics_ammoTemperatureEnabled = true; | ||
force force ace_advanced_ballistics_barrelLengthInfluenceEnabled = false; | ||
force ace_advanced_ballistics_bulletTraceEnabled = true; | ||
|
||
// ACE Advanced Fatigue | ||
ace_advanced_fatigue_enabled = false; | ||
ace_advanced_fatigue_enableStaminaBar = true; | ||
force ace_advanced_fatigue_performanceFactor = 1; | ||
force force ace_advanced_fatigue_terrainGradientFactor = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
test1 = ""; | ||
|
||
test2 = ''; | ||
|
||
test3 = ' T E S T '; | ||
|
||
test4 = " T E S T "; | ||
|
||
test5 = "[ ' t e s t ' , "" T E S T "" ]"; | ||
|
||
test6 = '[ " t e s t " , | ||
"" T E S T "" ]'; | ||
|
||
test7 = "[ true, false ]"; | ||
|
||
test8 = "[ "" item_1 "" , "" item_2 "" ]"; | ||
|
||
test9 = "[ ' item_1 ' , ' item_2 ' ]"; | ||
|
||
test10 = "[ ' item_1 ' , "" item_2 "" ]"; | ||
|
||
test11 = "[ '"" item_1 ""' , ' item_2 ' ]"; | ||
|
||
test12 = "[ ' item_1 ' , ""' item_2 '"" ]"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
force test1 = "[Āā, Ăă, Ҙ, привет]"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters