aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <ast@2e8.dk>2019-07-19 21:43:02 +0000
committerAsbjørn Sloth Tønnesen <ast@2e8.dk>2019-07-19 21:43:02 +0000
commitd42329c948cafec31250c8cdba028d116a76a709 (patch)
tree309a341171ef2275573c6f472fc746dda3ebbbe3 /test
parent1d7959d798b367b96cf489d08623647587334821 (diff)
downloadlua-inet-d42329c948cafec31250c8cdba028d116a76a709.tar.gz
lua-inet-d42329c948cafec31250c8cdba028d116a76a709.tar.xz
lua-inet-d42329c948cafec31250c8cdba028d116a76a709.zip
add inet:bits()
Signed-off-by: Asbjørn Sloth Tønnesen <ast@2e8.dk>
Diffstat (limited to 'test')
-rw-r--r--test/inet.lua9
1 files changed, 9 insertions, 0 deletions
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()