Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (18 sloc) 0.463 kb
require 'benchmark'
require './ip_filter'
ip_filter = IpFilter.new File.open('ranges.txt')
input = File.read('input.txt').lines.map do |line|
[line.strip[1..-1], line[0].chr == '+']
end
input.each do |ip, expected|
puts "#{ip} should#{expected ? '' : ' not'} be matched" if ip_filter.check(ip) != expected
end
Benchmark.bm do |x|
x.report do
10_000.times do
input.each do |ip, expected|
ip_filter.check(ip)
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.