This commit is contained in:
Alex Dunae 2007-11-24 00:45:30 +00:00
parent 3781e24a30
commit 02e323ce9c
30 changed files with 1911 additions and 580 deletions

View file

@ -1,19 +1,45 @@
require File.dirname(__FILE__) + '/test_helper'
require 'date'
require 'holidays'
require 'holidays/ca'
require 'benchmark'
n = 10000
Benchmark.bm do |x|
x.report('calculate_mday') do
n.times do
Holidays.calculate_mday(2008, 1, 1, 3)
n = 10000
dt = Date.civil(2035,3,23)
Benchmark.bm do |x|
x.report('0001') do
1.times do
r = Holidays.on(dt, :any)
end
end
x.report('calculate_mdaya') do
n.times do
Holidays.calculate_mdaya(:third, 1, 1, 2008)
x.report('0010') do
10.times do
r = Holidays.on(dt, :any)
end
end
x.report('0100') do
100.times do
r = Holidays.on(dt, :any)
end
end
x.report('1000') do
1000.times do
r = Holidays.on(dt, :any)
end
end
x.report('5000') do
5000.times do
r = Holidays.on(dt, :any)
end
end
end

View file

@ -25,8 +25,6 @@ class HolidaysTests < Test::Unit::TestCase
assert_equal 0, holidays.length
end
def test_requires_valid_regions
assert_raises Holidays::UnkownRegionError do
Holidays.on(Date.civil(2008,1,1), :xx)