From 1d7959d798b367b96cf489d08623647587334821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Fri, 19 Jul 2019 20:55:31 +0000 Subject: check bounds properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Asbjørn Sloth Tønnesen --- test/inet.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/inet.lua b/test/inet.lua index 26d05e3..dd90fef 100644 --- a/test/inet.lua +++ b/test/inet.lua @@ -288,6 +288,14 @@ local function misc() assert(inet.is(inet('::'))) assert(inet.version == 1) + + -- check out of bounds handling + assert(inet('0.0.0.0') - 1 == nil) + assert(inet('255.255.255.255') + 1 == nil) + assert(inet('::') - 1 == nil) + assert(inet('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff') + 1 == nil) + assert(inet('0.0.0.0/24') * -1 == nil) + assert(inet('255.255.255.0/24') * 1 == nil) end local t = test.new() -- cgit v1.2.1