Parent

Methods

Class/Module Index [+]

Quicksearch

Rex::Socket::RangeWalker::UnitTest

Constants

Klass

Public Instance Methods

test_walker() click to toggle source
# File lib/rex/socket/range_walker.rb.ut.rb, line 11
def test_walker

        #
        # Single argument
        #
        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)

        #
        

        #
        # Backwards
        #
        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)

        #
        # Same address
        #
        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

[Validate]

Generated with the Darkfish Rdoc Generator 2.