mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Implements Lua unit tests
This commit is contained in:
parent
3819af0037
commit
831e5d91e6
15 changed files with 179 additions and 20 deletions
23
scripts/lua/modules/test/test_ping_req_reply.lua
Normal file
23
scripts/lua/modules/test/test_ping_req_reply.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
--
|
||||
-- (C) 2017-18 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/test/?.lua;" .. package.path
|
||||
local unittest = require("unittest"):new()
|
||||
local if_stats = interface.getStats()
|
||||
|
||||
unittest:appendTest("Basic checks",
|
||||
function()
|
||||
unittest:assertEqual(if_stats.stats.hosts, 2, "Unexpected number of hosts")
|
||||
unittest:assertEqual(if_stats.stats.flows, 1, "Unexpected number of flows")
|
||||
end
|
||||
)
|
||||
|
||||
unittest:appendTest("Dummy test",
|
||||
function()
|
||||
unittest:assertEqual(1, 1, "Math is an opinion")
|
||||
end
|
||||
)
|
||||
|
||||
unittest:run()
|
||||
Loading…
Add table
Add a link
Reference in a new issue