Sha256: b007e1a364daae063726fc0648ed749d14a780e7440198bb916a5f3949c65eb3
Contents?: true
Size: 863 Bytes
Versions: 2
Compression:
Stored size: 863 Bytes
Contents
#!/usr/bin/env ruby # -*- coding: binary -*- $:.unshift(File.join(File.dirname(__FILE__), '..', '..')) require 'test/unit' require 'rex/socket/range_walker' class Rex::Socket::RangeWalker::UnitTest < Test::Unit::TestCase Klass = Rex::Socket::RangeWalker 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
librex-0.0.68 | lib/rex/socket/range_walker.rb.ut.rb |
librex-0.0.66 | lib/rex/socket/range_walker.rb.ut.rb |