sigar/bindings/ruby/test/cpu_test.rb

25 lines
577 B
Ruby
Raw Normal View History

2009-12-24 23:00:45 +08:00
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'helper'
class CpuTest < Test::Unit::TestCase
def check_cpu(cpu)
assert_gt_eq_zero cpu.user, "user"
assert_gt_eq_zero cpu.sys, "sys"
assert_gt_eq_zero cpu.idle, "idle"
assert_gt_eq_zero cpu.wait, "wait"
assert_gt_eq_zero cpu.irq, "irq"
assert_gt_eq_zero cpu.soft_irq, "soft_irq"
assert_gt_eq_zero cpu.stolen, "stolen"
assert_gt_zero cpu.total, "total"
end
def test_cpu
sigar = Sigar.new
check_cpu sigar.cpu
sigar.cpu_list.each do |cpu|
check_cpu cpu
end
end
end