Sha256: ebab8dab50b77433b23b44f56b99f4845e416979ba4d428f18f16c303125c985

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: binary -*-

$:.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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/socket/subnet_walker.rb.ut.rb
librex-0.0.66 lib/rex/socket/subnet_walker.rb.ut.rb