Sha256: 4070e383f4be5922bbc1bfc65d8b98d2a6eb8c1db00dc96a3a7bf9611ae5eeb4

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'test_helper'

class MacmapTest < Test::Unit::TestCase
  context "darwin" do
    setup do
      @str = open(File.dirname(__FILE__)+"/fixtures/darwin").read
    end

    should "map the mac to ips on darwin" do
      hsh = Macmap.map_iface_to_ip(@str)
      assert_equal hsh["vmnet8"], "192.168.248.1"
      assert_equal hsh["vmnet1"], "172.16.66.1"
      assert_equal hsh["en3"], "10.37.129.2"
      assert_equal hsh["en2"], "10.211.55.2"
      assert_equal hsh["en1"], "10.0.1.7"
      assert_equal hsh["lo0"], "127.0.0.1"
    end
  end
  
  context "ubuntu" do
    setup do
      @str = open(File.dirname(__FILE__)+"/fixtures/ubuntu").read
    end

    should "map the mac to ips on ubuntu" do
      hsh = Macmap.map_iface_to_ip(@str)
      assert_equal hsh["eth0"], "192.168.248.133"
      assert_equal hsh["lo"], "127.0.0.1"
    end
  end
  
  context "solaris" do
    setup do
      @str = open(File.dirname(__FILE__)+"/fixtures/solaris").read
    end

    should "map the mac to ips on solaris" do
      hsh = Macmap.map_iface_to_ip(@str)
      assert_equal hsh["lo0"], "127.0.0.1"
      assert_equal hsh["e1000g0"], "72.2.115.28"
      assert_equal hsh["e1000g2"], "10.2.115.28"
      assert_equal hsh["ip.tun0"], "109.146.85.57"
      assert_equal hsh["eri0"], "172.17.128.208"
      assert_equal hsh["ip6.tun0"], "10.0.0.208"
    end
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auser-macmap-0.0.1 test/macmap_test.rb
auser-macmap-0.0.2 test/macmap_test.rb