Sha256: c93f2e9275d919bd54a91006f64fe176bfc54389a97158686400c1bdd8524d49

Contents?: true

Size: 1.92 KB

Versions: 10

Compression:

Stored size: 1.92 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_cpu_type
    assert_respond_to(CPU, :cpu_type)
    assert_nothing_raised{ CPU.cpu_type }
    assert_nothing_raised{ CPU.cpu_type(@@host) }
    assert_kind_of(String, CPU.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

10 entries across 10 versions & 2 rubygems

Version Path
sys-cpu-0.9.0 test/test_sys_cpu_windows.rb
sys-cpu-0.8.3 test/test_sys_cpu_windows.rb
sys-cpu-0.8.2 test/test_sys_cpu_windows.rb
sys-cpu-0.8.1 test/test_sys_cpu_windows.rb
sys-cpu-0.8.0 test/test_sys_cpu_windows.rb
cpuinfo-1.0.0 test/test_sys_cpu_windows.rb
sys-cpu-0.7.2 test/test_sys_cpu_windows.rb
sys-cpu-0.7.1 test/test_sys_cpu_windows.rb
sys-cpu-0.7.0-universal-linux test/test_sys_cpu_windows.rb
sys-cpu-0.7.0 test/test_sys_cpu_windows.rb