Sha256: 54f967d96e52c14df98989a1f509ee5d1c71c99870b0464f552677fe0f12565c

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

#####################################################################
# tc_hpux.rb
#
# Test suite for the HP-UX platform. This should be run via the
# 'rake test' task.
#####################################################################
require "sys/cpu"
require "test/unit"
require "tc_version"
include Sys

class TC_HPUX < Test::Unit::TestCase
   def test_cpu_freq
      assert_respond_to(CPU, :freq)
      assert_nothing_raised{ CPU.freq }
      assert_nothing_raised{ CPU.freq(0) }
      assert_kind_of(Integer, CPU.freq, "Invalid Type")
   end

   def test_num_cpu
      assert_respond_to(CPU, :num_cpu)
      assert_nothing_raised{ CPU.num_cpu }
      assert_kind_of(Integer, CPU.num_cpu, "Invalid Type")
   end

   def test_num_active_cpu
      assert_respond_to(CPU, :num_active_cpu)
      assert_nothing_raised{ CPU.num_active_cpu }
      assert_kind_of(Integer, CPU.num_active_cpu, "Invalid Type")
   end

   def test_cpu_architecture
      assert_respond_to(CPU, :architecture)
      assert_nothing_raised{ CPU.architecture }
      assert_kind_of(String, CPU.architecture, "Invalid Type")
   end

   def test_load_avg
      assert_respond_to(CPU, :load_avg)
      assert_nothing_raised{ CPU.load_avg }
      assert_nothing_raised{ CPU.load_avg(0) }
      assert_nothing_raised{ CPU.load_avg{ |e| } }
      assert_raises(ArgumentError){ CPU.load_avg(0){ } }
      assert_kind_of(Array, CPU.load_avg, "Invalid Type")
      assert_kind_of(Array, CPU.load_avg(0), "Invalid Type")
      assert_equal(3, CPU.load_avg.length, "Bad number of elements") 
      assert_equal(3, CPU.load_avg(0).length, "Bad number of elements")
   end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sys-cpu-0.6.0-i586-linux test/tc_hpux.rb
sys-cpu-0.6.0 test/tc_hpux.rb
sys-cpu-0.6.1-x86-linux test/tc_hpux.rb
sys-cpu-0.6.1 test/tc_hpux.rb