13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/rex/socket/range_walker.rb.ut.rb', line 13
def test_walker
s = Klass.new('10.0.0.0-10.0.0.255')
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)
s = Klass.new('10.0.0.255-10.0.0.0')
0.upto(255) { |x|
assert_equal('10.0.0.' + x.to_s, s.next_ip)
}
assert_nil(s.next_ip)
s = Klass.new('10.0.0.255-10.0.0.255')
assert_equal('10.0.0.255', s.next_ip)
assert_nil(s.next_ip)
end
|