Sha256: d805d560b3f8fb73cdd4e6be3317ee98daa7f375e5957b84be6f852d217a2d57

Contents?: true

Size: 1.14 KB

Versions: 46

Compression:

Stored size: 1.14 KB

Contents

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

class TC_NetBSDTest < Test::Unit::TestCase
  def setup
    sample = IO.readlines("#{File.dirname(__FILE__)}"+
                          '/../../ifconfig_examples/netbsd.txt').join
    @cfg = IfconfigWrapper.new('BSD',sample).parse
  end
  def test_interface_list
    assert(@cfg.interfaces == ["cs0", "lo0"],
           "Failed to parse all interfaces")
  end

  def test_mac_parse
    assert(@cfg['cs0'].mac == "08:00:2b:81:62:ca",
    "Failed to parse MAC address: "+@cfg['cs0'].mac)
  end

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

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

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

  end

end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
aaalex-ruby-ifconfig-1.2.1 test/unit/tc_netbsd.rb
aaalex-ruby-ifconfig-1.2.2 test/unit/tc_netbsd.rb
aaalex-ruby-ifconfig-1.2.3 test/unit/tc_netbsd.rb
trema-0.4.7 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.6 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.5 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.4 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.3 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.2 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.1 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.4.0 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.21 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.20 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.19 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.18 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.17 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.16 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.15 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.14 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb
trema-0.3.13 vendor/ruby-ifconfig-1.2/test/unit/tc_netbsd.rb