Sha256: bb10f818a0e406dafc811bc79a6338f533741443afdd188620751b3d1c47203f

Contents?: true

Size: 841 Bytes

Versions: 2

Compression:

Stored size: 841 Bytes

Contents

require 'test_helper'

class IpaddressTest < Test::Unit::TestCase

  must "be valid ip" do
    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")
  end

  must "be valid netmask" do
    assert_equal true, IPAddress::valid_ipv4_netmask?("255.255.255.0")
  end

  must "be invalid netmask" do
    assert_equal false, IPAddress::valid_ipv4_netmask?("10.0.0.1")
  end
 
  must "be invalid" do
    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

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
relevance_ipaddress-0.5.0 test/ipaddress/ipbase_test.rb
ipaddress-0.5.0 test/ipaddress/ipbase_test.rb