Sha256: a9f71d337d6c53868eca72050365ea85b411bda2bbc957f354a23f1ad8a58b8b

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

#####################################################################
# test_sys_cpu_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 'test_sys_cpu_version'
include Sys

class TC_Sys_CPU_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

8 entries across 8 versions & 2 rubygems

Version Path
sys-cpu-0.9.0 test/test_sys_cpu_hpux.rb
sys-cpu-0.8.3 test/test_sys_cpu_hpux.rb
sys-cpu-0.8.2 test/test_sys_cpu_hpux.rb
sys-cpu-0.8.1 test/test_sys_cpu_hpux.rb
sys-cpu-0.8.0 test/test_sys_cpu_hpux.rb
cpuinfo-1.0.0 test/test_sys_cpu_hpux.rb
sys-cpu-0.7.2 test/test_sys_cpu_hpux.rb
sys-cpu-0.7.1 test/test_sys_cpu_hpux.rb