PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/test/l3/ts_ipv6.rb

https://github.com/bahoom/racket
Ruby | 26 lines | 18 code | 5 blank | 3 comment | 0 complexity | 992f0393cf61ba3066195375f5496cf2 MD5 | raw file
  1. # $Id$
  2. $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
  3. require 'test/unit'
  4. require 'racket'
  5. class TestIPV6 < Test::Unit::TestCase
  6. def test_init
  7. assert_nothing_raised() { Racket::L3::IPv6.new }
  8. assert_nothing_raised() { Racket::L3::IPv6.new(Racket::Misc.randstring(30)) }
  9. end
  10. def test_convert
  11. long = rand(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
  12. ipv6 = Racket::L3::Misc.long2ipv6(long)
  13. assert_equal(long, Racket::L3::Misc.ipv62long(ipv6))
  14. assert_equal(ipv6, Racket::L3::Misc.long2ipv6(long))
  15. # assert_nothing_raised { Racket::L3::IPv6.new("a:b:c::1") }
  16. assert_nothing_raised { Racket::L3::Misc.soll_mcast_addr6(ipv6) }
  17. mac = Racket::L2::Misc.randommac
  18. assert_nothing_raised { Racket::L3::Misc.soll_mcast_mac(mac) }
  19. end
  20. end
  21. # vim: set ts=2 et sw=2: