C0 code coverage information generated on Wed Mar 15 10:52:01 MST 2006


Marked code looks like this.
This line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this.
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
./test/test_hostname.rb 102 102
98.0% 
100.0% 
  1 $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
  2 $:.unshift File.join(File.dirname(__FILE__), "..", "bin")
  3 
  4 require 'hostname'
  5 require 'test/unit'
  6 
  7 class TestHostName < Test::Unit::TestCase
  8   def setup
  9     @bad_name         = 'smeagol'
 10     @primary_a_pwr    = 'paws-007-031'
 11     @primary_b_pwr    = 'pbws-007-032'
 12     @secondary_a_pwr  = 'saws-007-031'
 13     @secondary_b_pwr  = 'sbws-007-032'
 14     @demo             = 'dm-ws-012-031'
 15     @sys_test_a_pwr   = 'st-paws-053-031'
 16     @sys_test_b_pwr   = 'st-pbws-053-032'
 17     @failover_pri     = 'fo-paws-007-031'
 18     @failover_sec     = 'fo-saws-007-031'
 19     @search_dev_a_pwr = 'sd-pasc-007-031'
 20     @search_dev_b_pwr = 'sd-pbsc-007-032'
 21   end
 22 
 23   def test_verify_name_failures
 24     host = HostName.new('10.64.7.32', @primary_a_pwr, 'pp')
 25     assert !(host.verify_name)
 26     host = HostName.new('10.68.7.32', @secondary_a_pwr, 'sp')
 27     assert !(host.verify_name)
 28     host = HostName.new('10.72.12.31', @failover_pri, 'dm')
 29     assert !(host.verify_name)
 30   end
 31 
 32   def test_verify_name_prod_pri
 33     host = HostName.new('10.64.7.31', @primary_a_pwr, 'pp')
 34     assert host.verify_name
 35     host = HostName.new('10.64.7.32', @primary_b_pwr, 'pp')
 36     assert host.verify_name
 37   end
 38  
 39   def test_verify_name_prod_sec
 40     host = HostName.new('10.68.7.31', @secondary_a_pwr, 'sp')
 41     assert host.verify_name
 42     host = HostName.new('10.68.7.32', @secondary_b_pwr, 'sp')
 43     assert host.verify_name
 44   end
 45 
 46   def test_verify_name_non_prod_demo
 47     host = HostName.new('10.72.12.31', @demo, 'dm')
 48     assert host.verify_name
 49   end
 50 
 51   def test_verify_name_non_prod_sys_test
 52     host = HostName.new('10.72.53.31', @sys_test_a_pwr, 'st')
 53     assert host.verify_name
 54     host = HostName.new('10.72.53.32', @sys_test_b_pwr, 'st')
 55     assert host.verify_name
 56   end
 57 
 58   def test_bad_name
 59     host = HostName.new('10.72.8.34', @bad_name, 'st')
 60     assert !host.verify_name
 61     host = HostName.new('10.64.8.34', 'nohostname4', 'pp')
 62     assert !host.verify_name
 63   end
 64 
 65   def test_hostname
 66     host = HostName.new('10.64.7.32', @primary_a_pwr, 'pp')
 67     assert_equal(@primary_a_pwr, host.hostname)
 68     host = HostName.new('10.68.7.32', @secondary_a_pwr, 'sp')
 69     assert_equal(@secondary_a_pwr, host.hostname)
 70     host = HostName.new('10.72.12.31', @failover_pri, 'dm')
 71     assert_equal(@failover_pri, host.hostname)
 72   end
 73 
 74   def test_ip
 75     host = HostName.new('10.64.7.32', @primary_a_pwr, 'pp')
 76     assert_equal('10.64.7.32', host.ip)
 77     host = HostName.new('10.68.7.32', @secondary_a_pwr, 'sp')
 78     assert_equal('10.68.7.32', host.ip)
 79     host = HostName.new('10.72.12.31', @failover_pri, 'dm')
 80     assert_equal('10.72.12.31', host.ip)
 81   end
 82 
 83   def test_ref_code
 84     host = HostName.new('10.64.7.32', @primary_a_pwr, 'pp')
 85     assert_equal('pp', host.ref_code)
 86     host = HostName.new('10.68.7.32', @secondary_a_pwr, 'sp')
 87     assert_equal('sp', host.ref_code)
 88     host = HostName.new('10.72.12.31', @failover_pri, 'dm')
 89     assert_equal('dm', host.ref_code)
 90   end
 91 
 92   def test_to_s
 93     host = HostName.new('10.64.7.32', @primary_a_pwr, 'pp')
 94     assert_equal("#{@primary_a_pwr}|10.64.7.32|pp", host.to_s)
 95     host = HostName.new('10.68.7.32', @secondary_a_pwr, 'sp')
 96     assert_equal("#{@secondary_a_pwr}|10.68.7.32|sp", host.to_s)
 97     host = HostName.new('10.72.12.31', @failover_pri, 'dm')
 98     assert_equal("#{@failover_pri}|10.72.12.31|dm", host.to_s)
 99   end
100 end
101 
102 # vim:ts=2:sw=2:sts=2:et

Valid XHTML 1.0!Valid CSS!