aboutsummaryrefslogtreecommitdiffstats
path: root/test/inet.lua
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <ast@2e8.dk>2019-07-19 20:55:31 +0000
committerAsbjørn Sloth Tønnesen <ast@2e8.dk>2019-07-19 20:55:31 +0000
commit1d7959d798b367b96cf489d08623647587334821 (patch)
tree466c2f4a0fea9273ac5cf38adc282868ca9cc5a9 /test/inet.lua
parent1f2c6d833c579c8c3169e22ef8af00265a438406 (diff)
downloadlua-inet-1d7959d798b367b96cf489d08623647587334821.tar.gz
lua-inet-1d7959d798b367b96cf489d08623647587334821.tar.xz
lua-inet-1d7959d798b367b96cf489d08623647587334821.zip
check bounds properly
Signed-off-by: Asbjørn Sloth Tønnesen <ast@2e8.dk>
Diffstat (limited to 'test/inet.lua')
-rw-r--r--test/inet.lua8
1 files changed, 8 insertions, 0 deletions
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()