diff options
-rwxr-xr-x | lib/custodian/util/timespan.rb | 2 | ||||
-rwxr-xr-x | t/test-custodian-util-timespan.rb | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/custodian/util/timespan.rb b/lib/custodian/util/timespan.rb index a43ca55..27ece7a 100755 --- a/lib/custodian/util/timespan.rb +++ b/lib/custodian/util/timespan.rb @@ -78,7 +78,7 @@ module Custodian while( hour != p_end ) valid[hour] = 1 hour += 1 - hour = 0 if ( hour >= 23 ) + hour = 0 if ( hour > 23 ) end valid[p_end]=1 diff --git a/t/test-custodian-util-timespan.rb b/t/test-custodian-util-timespan.rb index 307a171..048f582 100755 --- a/t/test-custodian-util-timespan.rb +++ b/t/test-custodian-util-timespan.rb @@ -150,4 +150,17 @@ class TestTimeSpanUtil < Test::Unit::TestCase end + + # + # Since the implementation of our test involves + # iterating over the specified period then any 24-hour + # period is the worst case. + # + # + def test_worst() + for i in 0..23 + assert( Custodian::Util::TimeSpan.inside?( 0, 23, i ) ) + end + + end end |