Sha256: c82d5db137e0440ff7b704121c1eab5109a4ad3836091afeb0f65d72b58dbc80

Contents?: true

Size: 981 Bytes

Versions: 2

Compression:

Stored size: 981 Bytes

Contents

########################################
# tc_linux.rb
#
# Test Suite for sys-cpu for Linux
########################################
base = File.basename(Dir.pwd)
if base == "test" || base =~ /sys-cpu/
   require "ftools"
   Dir.chdir ".." if base == "test"
   Dir.mkdir("sys") unless File.exists?("sys")
   File.copy("lib/sys/linux.rb","sys/cpu.rb")
   $LOAD_PATH.unshift Dir.pwd
end

require "sys/cpu"
require "test/unit"
include Sys

class TC_Linux < Test::Unit::TestCase
   def test_all_dynamic_methods
      assert_nothing_raised{
         CPU.processors{ |cs|
            cs.members.each{ |m|
               puts "#{m}: " + cs[m].to_s
            }
         }
      }
   end

   def test_load_avg
      assert_nothing_raised{ CPU.load_avg }
      assert_equal(3, CPU.load_avg.length)
   end

   def test_cpu_stats
      assert_nothing_raised{ CPU.cpu_stats }
      assert_kind_of(Hash, CPU.cpu_stats)
      assert_equal(true, CPU.cpu_stats["cpu0"].length >= 4)
   end
end
  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sys-cpu-0.5.5-i586-linux test/tc_linux.rb
sys-cpu-0.5.5 test/tc_linux.rb