test/ipaddress_test.rb in ipaddress-0.5.0 vs test/ipaddress_test.rb in ipaddress-0.6.0
- old
+ new
@@ -31,8 +31,25 @@
assert_raise(ArgumentError) {@method.call(@invalid_ipv6)}
assert_raise(ArgumentError) {@method.call(@invalid_mapped)}
end
+ def test_module_method_valid?
+ assert_equal true, IPAddress::valid?("10.0.0.1")
+ assert_equal true, IPAddress::valid?("10.0.0.0")
+ assert_equal true, IPAddress::valid?("2002::1")
+ assert_equal true, IPAddress::valid?("dead:beef:cafe:babe::f0ad")
+ assert_equal false, IPAddress::valid?("10.0.0.256")
+ assert_equal false, IPAddress::valid?("10.0.0.0.0")
+ assert_equal false, IPAddress::valid?("10.0.0")
+ assert_equal false, IPAddress::valid?("10.0")
+ assert_equal false, IPAddress::valid?("2002:::1")
+ end
+
+ def test_module_method_valid_ipv4_netmark?
+ assert_equal true, IPAddress::valid_ipv4_netmask?("255.255.255.0")
+ assert_equal false, IPAddress::valid_ipv4_netmask?("10.0.0.1")
+ end
+
end