diff options
| author | Steve Kemp <steve@steve.org.uk> | 2012-11-20 14:42:28 +0000 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2012-11-20 14:42:28 +0000 | 
| commit | 78f5a2cfaa0b32c33260c0a84c4bc5d85047ff16 (patch) | |
| tree | 48221670dc895520067ad8adf0f04cdb2dee6cfb /t | |
| parent | 62850ade3f55c6150b75adf9f0e613c9deb45989 (diff) | |
  Moved inside_bytemark? into its own method, added trivial test-cases.
Diffstat (limited to 't')
| -rwxr-xr-x | t/test-alerter.rb | 40 | 
1 files changed, 40 insertions, 0 deletions
| diff --git a/t/test-alerter.rb b/t/test-alerter.rb index 995b27b..a09c666 100755 --- a/t/test-alerter.rb +++ b/t/test-alerter.rb @@ -86,6 +86,7 @@ class TestAlerter < Test::Unit::TestCase        if ( text =~ /OUTSIDE/ )          assert( inside == false )        end +      end      # @@ -102,4 +103,43 @@ class TestAlerter < Test::Unit::TestCase +  # +  #  Test inside_bytemark? +  # +  def test_inside_bytemark + +    # +    #  Hash of hostnames and version of address. +    # +    to_test = { + +      # +      # Hosts inside the Bytemark network +      # +      "80.68.85.48"               => true, +      "2001:41c8:125:46::10"      => true, + +      # +      # Hosts outside the Bytemark network +      # +      "127.0.0.1"                 => false, +      "192.168.1.1"               => false, +      "2a00:1450:400c:c00::93"    => false, +    } + + +    to_test.each do |name,inside| + +      obj = Alerter.new( nil ) + +      if ( inside ) +        assert( obj.inside_bytemark?( name ) == true  ) +      else +        assert( obj.inside_bytemark?( name ) == false ) +      end +    end + +  end + +  end | 
