From d42329c948cafec31250c8cdba028d116a76a709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Fri, 19 Jul 2019 21:43:02 +0000 Subject: add inet:bits() 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 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/inet.lua') diff --git a/test/inet.lua b/test/inet.lua index dd90fef..b974179 100644 --- a/test/inet.lua +++ b/test/inet.lua @@ -296,6 +296,15 @@ local function misc() 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) + + assert(inet('192.0.2.24'):bits(-1) == nil) + assert(inet('192.0.2.24'):bits(0) == nil) + assert(inet('192.0.2.24'):bits(3) == nil) + assert(inet('192.0.2.24'):bits(33) == nil) + assert(inet('2001:db8::42/64'):bits(-1) == nil) + assert(inet('2001:db8::42/64'):bits(0) == nil) + assert(inet('2001:db8::42/64'):bits(42) == nil) + assert(inet('2001:db8::42/64'):bits(64) == nil) end local t = test.new() -- cgit v1.2.1