Sha256: 5c5b156350e7f87ebbae1a4cb95729f41df1b3d6e5558159dcbd3526a17c3c77

Contents?: true

Size: 1017 Bytes

Versions: 78

Compression:

Stored size: 1017 Bytes

Contents

require File.expand_path('../../helper', __FILE__)
require 'citrus/grammars'

Citrus.require 'ipv6address'

class IPv6AddressTest < Test::Unit::TestCase
  def test_hexdig
    match = IPv6Address.parse('0', :root => :HEXDIG)
    assert(match)

    match = IPv6Address.parse('A', :root => :HEXDIG)
    assert(match)
  end

  def test_1
    match = IPv6Address.parse('1:2:3:4:5:6:7:8')
    assert(match)
    assert_equal(6, match.version)
  end

  def test_2
    match = IPv6Address.parse('12AD:34FC:A453:1922::')
    assert(match)
    assert_equal(6, match.version)
  end

  def test_3
    match = IPv6Address.parse('12AD::34FC')
    assert(match)
    assert_equal(6, match.version)
  end

  def test_4
    match = IPv6Address.parse('12AD::')
    assert(match)
    assert_equal(6, match.version)
  end

  def test_5
    match = IPv6Address.parse('::')
    assert(match)
    assert_equal(6, match.version)
  end

  def test_invalid
    assert_raise Citrus::ParseError do
      IPv6Address.parse('1:2')
    end
  end
end

Version data entries

78 entries across 78 versions & 2 rubygems

Version Path
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.10 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.9 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.8 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.7 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.6 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.5 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.4 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.3 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.2 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.1 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.2.0 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.99 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.98 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.97 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.96 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.95 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.94 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.93 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb
harbr-0.1.91 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/grammars/ipv6address_test.rb