]> git.ipfire.org Git - location/libloc.git/blobdiff - tests/lua/main.lua
lua: Add a Network object
[location/libloc.git] / tests / lua / main.lua
index 174bd3bd201a6ae97686dfdfea16da2034320094..fada1680cc77247eedd808b2ae744816bf9c67c3 100755 (executable)
@@ -46,4 +46,19 @@ function test_lookup()
        db.lookup("81.3.27.32")
 end
 
+function test_network()
+       location = require("location")
+
+       n1 = location.Network.new("10.0.0.0/8")
+
+       -- The ASN should be nul
+       luaunit.assertNil(n1.get_asn())
+
+       -- The family should be IPv4
+       luaunit.assertEquals(n1.get_family(), 2)
+
+       -- The country code should be empty
+       luaunit.assertNil(n1.get_country_code())
+end
+
 os.exit(luaunit.LuaUnit.run())