Sha256: 100c822fcf776d953395e6613673394c4bf50afc713ad5912a43fb74f90b7a0e

Contents?: true

Size: 1.93 KB

Versions: 5

Compression:

Stored size: 1.93 KB

Contents

######################################################################
# test_sys_cpu_windows.rb
#
# Test suite for MS Windows systems. This should be run via the
# 'rake test' task.
######################################################################
require 'rubygems'
gem 'test-unit'

require 'test/unit'
require 'sys/cpu'
require 'test_sys_cpu_version'
require 'socket'
include Sys

class TC_Sys_CPU_Windows < Test::Unit::TestCase
  def self.startup
    @@host = Socket.gethostname
  end
   
  def test_architecture
    assert_respond_to(CPU, :architecture)
    assert_nothing_raised{ CPU.architecture }
    assert_nothing_raised{ CPU.architecture(@@host) }
    assert_kind_of(String, CPU.architecture, 'Invalid Type')
  end
   
  def test_freq
    assert_respond_to(CPU, :freq)
    assert_nothing_raised{ CPU.freq }
    assert_nothing_raised{ CPU.freq(0) }
    assert_nothing_raised{ CPU.freq(0, @@host) }
    assert_kind_of(Integer, CPU.freq, 'Invalid Type')
  end
    
  def test_model
    assert_respond_to(CPU, :model)
    assert_nothing_raised{ CPU.model }
    assert_nothing_raised{ CPU.model(@@host) }
    assert_kind_of(String, CPU.model, 'Invalid Type')
  end
   
  def test_num_cpu
    assert_respond_to(CPU, :num_cpu)
    assert_nothing_raised{ CPU.num_cpu }
    assert_nothing_raised{ CPU.num_cpu(@@host) }
    assert_kind_of(Integer, CPU.num_cpu, 'Invalid Type')
  end
   
  def test_type
    assert_respond_to(CPU, :type)
    assert_nothing_raised{ CPU.type }
    assert_nothing_raised{ CPU.type(@@host) }
    assert_kind_of(String, CPU.type, '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, @@host) }
    assert_kind_of(Integer, CPU.load_avg, 'Invalid Type')
  end
   
  def test_processors
    assert_respond_to(CPU, :processors)
    assert_nothing_raised{ CPU.processors{} }
  end

  def self.shutdown
    @@host = nil
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sys-cpu-0.6.4-universal-linux test/test_sys_cpu_windows.rb
sys-cpu-0.6.4 test/test_sys_cpu_windows.rb
sys-cpu-0.6.3-x86-linux test/test_sys_cpu_windows.rb
sys-cpu-0.6.3 test/test_sys_cpu_windows.rb
sys-cpu-0.6.3-x86-mingw32 test/test_sys_cpu_windows.rb