Sha256: 26f6fadae2b0b93b6ae49aaa4f1e849810f07467e650621248150242308992a2

Contents?: true

Size: 1.65 KB

Versions: 2

Compression:

Stored size: 1.65 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

2 entries across 2 versions & 1 rubygems

Version Path
sys-cpu-0.6.0-mswin32 test/tc_hpux.rb
sys-cpu-0.6.1-x86-mswin32-60 test/tc_hpux.rb