Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (36 sloc) 0.934 kb
require File.expand_path('../../helper', __FILE__)
require 'citrus/grammars'
Citrus.require 'ipv4address'
class IPv4AddressTest < Test::Unit::TestCase
def test_dec_octet
match = IPv4Address.parse('0', :root => :'dec-octet')
assert(match)
match = IPv4Address.parse('255', :root => :'dec-octet')
assert(match)
end
def test_1
match = IPv4Address.parse('0.0.0.0')
assert(match)
assert_equal(4, match.version)
end
def test_2
match = IPv4Address.parse('255.255.255.255')
assert(match)
assert_equal(4, match.version)
end
def test_invalid
assert_raise Citrus::ParseError do
IPv4Address.parse('255.255.255.256')
end
end
def test_invalid_short
assert_raise Citrus::ParseError do
IPv4Address.parse('255.255.255')
end
end
def test_invalid_long
assert_raise Citrus::ParseError do
IPv4Address.parse('255.255.255.255.255')
end
end
end
Jump to Line
Something went wrong with that request. Please try again.