Sha256: b31d28d409cc08abb44b8959630d5657b6613438db80077d31246a0d442b3463

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require 'rubygems'
gem 'test-unit'

require 'test/unit'
require 'linux/kstat'

class TC_Linux_Kstat < Test::Unit::TestCase
  def setup
    @kstat = Linux::Kstat.new
  end

  test "version constant is set to the expected value" do
    assert_equal('0.1.0', Linux::Kstat::VERSION)
  end

  test "kstat object can be accessed like a hash" do
    assert_respond_to(@kstat, :[])
    assert_nothing_raised{ @kstat[:cpu] }
  end

  test "kstat object contains expected keys" do
    assert_kind_of(Hash, @kstat[:cpu])
    assert_kind_of(Numeric, @kstat[:btime])
    assert_kind_of(Array, @kstat[:intr])
  end

  test "values cannot be assigned to keys" do
    assert_raise(NoMethodError){ @kstat[:cpu] = 'test' }
  end

  def teardown
    @kstat = nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linux-kstat-0.1.0 test/test_linux_kstat.rb