Sha256: 830bc8b09e5487e4e3af4b42acb16eda35701f86849d211e42ab2dc5aa2ef330
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
examples = File.expand_path('..', __FILE__) $LOAD_PATH.unshift(examples) unless $LOAD_PATH.include?(examples) # This file contains a suite of tests for the IPv4Address grammar found in # ipv4address.citrus. require 'citrus' Citrus.require 'ipv4address' require 'test/unit' 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
Version data entries
5 entries across 5 versions & 1 rubygems