-- Perform some random operation
local db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
luaunit.assertIsTrue(log_callback_called)
end
-- Open the database
db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
-- Verify
luaunit.assertIsTrue(db:verify(ENV_TEST_SIGNING_KEY))
-- Open the database
db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
-- Perform a lookup
network1 = db:lookup("81.3.27.32")
location = require("location")
n1 = location.Network.new("10.0.0.0/8")
+ luaunit.assertNotNil(n1)
-- The ASN should be nul
luaunit.assertNil(n1:get_asn())
function test_as()
location = require("location")
+ luaunit.assertNotNil(location)
-- Create a new AS
as = location.AS.new(12345)
-- Open the database
db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
-- Fetch an AS
as = db:get_as(0)
location = require("location")
c1 = location.Country.new("DE")
+ luaunit.assertNotNil(c1)
luaunit.assertEquals(c1:get_code(), "DE")
luaunit.assertNil(c1:get_name())
luaunit.assertNil(c1:get_continent_code())
c2 = location.Country.new("GB")
+ luaunit.assertNotNil(c2)
luaunit.assertNotEquals(c1, c2)
c1 = nil
-- Open the database
db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
-- Fetch an invalid country
c = db:get_country("XX")
-- Open the database
db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
local network = db:lookup("1.1.1.1")
-- Open the database
db = location.Database.open(ENV_TEST_DATABASE)
+ luaunit.assertNotNil(db)
for network in db:list_networks() do
print(network, network:reverse_pointer())