-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] Added some tests for basic functions
- Loading branch information
1 parent
3c04450
commit 50b0891
Showing
4 changed files
with
44 additions
and
13 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
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,31 @@ | ||
local lu = require('luaunit') | ||
|
||
local basic_functions = require('basic_functions') | ||
|
||
function testSplitFunction() | ||
-- When pattern is present | ||
lu.assertEquals(basic_functions.split("OpenWISP","n"), {"Ope", "WISP"}) | ||
lu.assertEquals(basic_functions.split("OpenWISP","WISP"), {"Open"}) | ||
|
||
-- When pattern is not available | ||
lu.assertEquals(basic_functions.split("OpenWISP","a"), {"OpenWISP"}) | ||
end | ||
|
||
function testHasValue() | ||
-- When value is present | ||
lu.assertEquals(basic_functions.has_value({2,4,5},4), true) | ||
lu.assertEquals(basic_functions.has_value({1,2,3,7,9},9), true) | ||
|
||
-- When value is not present | ||
lu.assertEquals(basic_functions.has_value({2,4,5},3), false) | ||
lu.assertEquals(basic_functions.has_value({1,2,3,7,9},8), false) | ||
|
||
end | ||
|
||
function testRandom() | ||
-- When value is present | ||
-- lu.assertEquals(netjson_monitoring.) | ||
|
||
end | ||
|
||
os.exit( lu.LuaUnit.run() ) |
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