Class: Rex::Socket::SubnetWalker::UnitTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/rex/socket/subnet_walker.rb.ut.rb

Constant Summary collapse

Klass =
Rex::Socket::SubnetWalker

Instance Method Summary collapse

Instance Method Details

#test_walkerObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rex/socket/subnet_walker.rb.ut.rb', line 12

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