Sha256: 5c29643027c774e12fa25d7ea2c592c94c1f3382a024f6aa3ab07fd9baf5b9e0

Contents?: true

Size: 1.15 KB

Versions: 46

Compression:

Stored size: 1.15 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class TC_DarwinTest < Test::Unit::TestCase
  def setup
    sample = IO.readlines("#{File.dirname(__FILE__)}"+
                          "/../../ifconfig_examples/darwin.txt").join
    @cfg = IfconfigWrapper.new('BSD',sample).parse
  end

  def test_interface_list
    assert(@cfg.interfaces.sort == ["en0", "lo0"].sort,
           "Failed to parse all interfaces")
  end

  def test_mac_parse
    assert(@cfg['en0'].mac == "00:03:93:0a:16:76",
    "Failed to parse MAC address: "+@cfg['en0'].mac)
  end

  def test_flags
    assert(@cfg['en0'].flags.include?('BROADCAST') &&
          @cfg['en0'].flags.include?('RUNNING') &&
          @cfg['en0'].flags.include?('MULTICAST') &&
          @cfg['en0'].up?,
           "FLAG Parsing failed: #{@cfg['en0'].flags}")
  end

  def test_addr_types
    assert(@cfg['en0'].addr_types.include?('inet') &&
           @cfg['en0'].addr_types.include?('inet6'),
           "Failed to parse all address types")
  end

  def test_attribs
    assert(@cfg['en0'].rx['bytes'].class == Fixnum || NilClass &&
           @cfg['en0'].tx['bytes'].class == Fixnum || NilClass, "Wrong class")

  end

end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
trema-0.3.12 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.11 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.10 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.9 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.8 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.7 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.6 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.5 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.4 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.3 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.2 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.1 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.3.0 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.8 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.7 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.6 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.5 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.4 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.3 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb
trema-0.2.2.1 vendor/ruby-ifconfig-1.2/test/unit/tc_darwin.rb