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 | 1f39546155f568923149df3e3c6adcf4b2bd3169 (patch) | |
tree | 48221670dc895520067ad8adf0f04cdb2dee6cfb /t/test-alerter.rb | |
parent | 055b7aea1e11a85ff945147afcff6f6a1c20f88c (diff) |
Moved inside_bytemark? into its own method, added trivial test-cases.
Diffstat (limited to 't/test-alerter.rb')
-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 |