1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00
metasploit-framework/lib/rex/socket/subnet_walker.rb.ut.rb
Ramon de C Valle f124597a56 Code cleanups
git-svn-id: file:///home/svn/framework3/trunk@5773 4d416f70-5f16-0410-b530-b9f4589650da
2008-10-19 21:03:39 +00:00

28 lines
512 B
Ruby

#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), '..', '..'))
require 'test/unit'
require 'rex/socket/subnet_walker'
class Rex::Socket::SubnetWalker::UnitTest < Test::Unit::TestCase
Klass = Rex::Socket::SubnetWalker
def test_walker
s = Klass.new('10.0.0.0', '255.255.255.0')
0.upto(255) { |x|
assert_equal('10.0.0.' + x.to_s, s.next_ip)
}
assert_nil(s.next_ip)
s.reset
0.upto(255) { |x|
assert_equal('10.0.0.' + x.to_s, s.next_ip)
}
assert_nil(s.next_ip)
end
end