Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:IPAddress/testcases
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Unit tests for [[Module:IPAddress]]. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_isIp() self:preprocess_equals_many('{{#invoke:IPAddress|isIp|', '}}', { {'200.200.200.200', '4'}, {' 200.200.200.200', ''}, -- whitespace not currently allowed {'200.200.200.200 ', ''}, -- whitespace not currently allowed {'200.200.256.200', ''}, {'200.200.200.200.', ''}, {'200.200.200', ''}, {'200.200.200.2d0', ''}, {'0.0.0.0', '4'}, {'00.00.00.00', ''}, -- according to talkpage, leading zeroes unacceptable. {'100.100.020.100', ''}, -- according to talkpage, leading zeroes unacceptable. {'255.255.255.255', '4'}, {'-1.0.0.0', ''}, {'200000000000000000000000000000000000000000000000000000000000000000000000000000.200.200.200', ''}, {'00000000000005.10.10.10', ''}, {'00AB:0002:3008:8CFD:00AB:0002:3008:8CFD', '6'}, -- full length {'00ab:0002:3008:8cfd:00ab:0002:3008:8cfd', '6'}, -- lowercase {'00aB:0002:3008:8cFd:00Ab:0002:3008:8cfD', '6'}, -- mixed case {'00AB:00002:3008:8CFD:00AB:0002:3008:8CFD', ''}, -- at most 4 digits per segment {':0002:3008:8CFD:00AB:0002:3008:8CFD', ''}, -- can't remove all 0s from first segment unless using :: {'00AB:0002:3008:8CFD:00AB:0002:3008:', ''}, -- can't remove all 0s from last segment unless using :: {'AB:02:3008:8CFD:AB:02:3008:8CFD', '6'}, -- abbreviated {'AB:02:3008:8CFD:AB:02:3008:8CFD:02', ''}, -- too long {'AB:02:3008:8CFD::02:3008:8CFD', '6'}, -- correct use of :: {'AB:02:3008:8CFD::02:3008:8CFD:02', ''}, -- too long {'AB:02:3008:8CFD::02::8CFD', ''}, -- can't have two ::s {'GB:02:3008:8CFD:AB:02:3008:8CFD', ''}, -- Invalid character G {'::', '6'}, -- unassigned IPv6 address {'::1', '6'}, -- loopback IPv6 address {'0::', '6'}, -- another name for unassigned IPv6 address {'0::0', '6'}, -- another name for unassigned IPv6 address {'2:::3', ''}, -- illegal: three colons }) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:IPAddress/testcases/doc
(
edit
)