Skip to content

Commit

Permalink
Fix description
Browse files Browse the repository at this point in the history
Add Tests
  • Loading branch information
dedmen committed Feb 14, 2017
1 parent 6b4f5f8 commit faa20e6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/hashes/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CfgFunctions
// CBA_fnc_hashGetKeys
class hashGetKeys
{
description = "Returns all the Keys in a Hash";
description = "Returns all Keys in a Hash";
file = "\x\cba\addons\hashes\fnc_hashGetKeys.sqf";
};
// CBA_fnc_hashGet
Expand Down
2 changes: 1 addition & 1 deletion addons/hashes/fnc_hashGetKeys.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Function: CBA_fnc_hashGetKeys
Description:
Returns all the Keys in a Hash
Returns all Keys in a Hash
See <CBA_fnc_hashCreate>.
Expand Down
15 changes: 14 additions & 1 deletion addons/hashes/test_hashes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SCRIPT(test_hashes);

// ----------------------------------------------------------------------------
#define DEBUG_MODE_FULL
private ["_hash", "_expected", "_result", "_size"];
private ["_hash", "_expected", "_result", "_size", "_keys"];

LOG("Testing Hashes");

Expand All @@ -17,6 +17,7 @@ TEST_DEFINED("CBA_fnc_hashSet","");
TEST_DEFINED("CBA_fnc_hashHasKey","");
TEST_DEFINED("CBA_fnc_isHash","");
TEST_DEFINED("CBA_fnc_hashSize","");
TEST_DEFINED("CBA_fnc_hashGetKeys","");

TEST_FALSE([[]] call CBA_fnc_isHash,"CBA_fnc_isHash");
_hash = [5, [4], [1], 2]; // Not a real hash.
Expand Down Expand Up @@ -115,4 +116,16 @@ _hash = [5, [4], [1], 2];
_size = [_hash] call CBA_fnc_hashSize;
TEST_OP(_size,==,-1,"hashSize");

// Empty hash keys
_hash = [] call CBA_fnc_hashCreate;
_keys = [_hash] call CBA_fnc_hashGetKeys;
TEST_OP(_keys,isEqualTo,[],"hashGetKeys");

// Two elements keys with different types
[_hash, "123", 1] call CBA_fnc_hashSet;
[_hash, "124", 2] call CBA_fnc_hashSet;
[_hash, 125, 3] call CBA_fnc_hashSet;
_keys = [_hash] call CBA_fnc_hashSize;
TEST_OP(_keys,isEqualTo,["123","124",125],"hashSize");

nil;

0 comments on commit faa20e6

Please sign in to comment.