Sha256: 25cc6dd04ae1dfcd198303fe8714d0258be7e8432d96153aeee2bc994b73cb63

Contents?: true

Size: 1.92 KB

Versions: 4

Compression:

Stored size: 1.92 KB

Contents

######################################################################
# tc_windows.rb
#
# Test suite for MS Windows systems. This should be run via the
# 'rake test' task.
######################################################################
require "test/unit"
require "sys/cpu"
require "tc_version"
require "socket"
include Sys

class TC_Windows_CPU < Test::Unit::TestCase
   def setup
      @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 teardown
      @host = nil
   end  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sys-cpu-0.6.0-i586-linux test/tc_windows.rb
sys-cpu-0.6.0 test/tc_windows.rb
sys-cpu-0.6.1-x86-linux test/tc_windows.rb
sys-cpu-0.6.1 test/tc_windows.rb