runt 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +18 -0
- data/Rakefile +7 -4
- data/TODO +4 -2
- data/doc/tutorial_schedule.rdoc +355 -46
- data/doc/tutorial_te.rdoc +3 -3
- data/examples/reminder.rb +63 -0
- data/examples/schedule_tutorial.rb +59 -0
- data/examples/schedule_tutorialtest.rb +52 -0
- data/lib/runt/daterange.rb +1 -1
- data/lib/runt/pdate.rb +1 -1
- data/lib/runt/schedule.rb +1 -1
- data/lib/runt/temporalexpression.rb +109 -27
- data/test/baseexpressiontest.rb +110 -0
- data/test/collectiontest.rb +63 -0
- data/test/combinedexpressionstest.rb +158 -0
- data/test/daterangetest.rb +2 -0
- data/test/dayintervaltetest.rb +37 -0
- data/test/difftest.rb +37 -0
- data/test/dimonthtest.rb +59 -0
- data/test/diweektest.rb +32 -0
- data/test/everytetest.rb +36 -0
- data/test/intersecttest.rb +34 -0
- data/test/redaytest.rb +30 -0
- data/test/remonthtest.rb +37 -0
- data/test/reweektest.rb +51 -0
- data/test/reyeartest.rb +98 -0
- data/test/rspectest.rb +25 -0
- data/test/spectest.rb +36 -0
- data/test/temporalexpressiontest.rb +49 -585
- data/test/uniontest.rb +36 -0
- data/test/wimonthtest.rb +54 -0
- data/test/yeartetest.rb +22 -0
- metadata +54 -6
data/test/wimonthtest.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'baseexpressiontest'
|
4
|
+
|
5
|
+
# Unit tests for WIMonth class
|
6
|
+
# Author:: Matthew Lipper
|
7
|
+
|
8
|
+
class WIMonthTest < BaseExpressionTest
|
9
|
+
|
10
|
+
def setup
|
11
|
+
super
|
12
|
+
@date_range = @date_20050101..@date_20050228
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def test_second_week_in_month
|
17
|
+
expr = WIMonth.new(Second)
|
18
|
+
assert expr.include?(@pdate_20071008), "#{expr.to_s} should include #{@pdate_20071008.to_s}"
|
19
|
+
assert !expr.include?(@pdate_20071030), "#{expr.to_s} should not include #{@pdate_20071030.to_s}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_last_week_in_month
|
23
|
+
expr = WIMonth.new(Last_of)
|
24
|
+
# Make sure of day precision or things will be unusably slow!
|
25
|
+
assert expr.include?(@pdate_20071030), "#{expr.to_s} should include #{@pdate_20071030.to_s}"
|
26
|
+
assert !expr.include?(@pdate_20071008), "#{expr.to_s} should not include #{@pdate_20071008.to_s}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_second_to_last_week_in_month
|
30
|
+
expr = WIMonth.new(Second_to_last)
|
31
|
+
# Make sure of day precision or things will be unusably slow!
|
32
|
+
assert expr.include?(@pdate_20071024), "#{expr.to_s} should include #{@pdate_20071024}"
|
33
|
+
assert !expr.include?(@pdate_20071008), "#{expr.to_s} should not include #{@pdate_20071008}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_dates_mixin_second_week_in_month
|
37
|
+
dates = WIMonth.new(Second).dates(@date_range)
|
38
|
+
assert dates.size == 14, "Expected 14 dates, was #{dates.size}"
|
39
|
+
assert dates.first.mday == 8, "Expected first date.mday to be 8, was #{dates.first.mday}"
|
40
|
+
assert dates.last.mday == 14, "Expected last date.mday to be 14, was #{dates.last.mday}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_dates_mixin_last_week_in_month
|
44
|
+
dates = WIMonth.new(Last).dates(@date_range)
|
45
|
+
assert dates.size == 14, "Expected 14 dates, was #{dates.size}"
|
46
|
+
assert dates.first.mday == 25, "Expected first date.mday to be 25, was #{dates.first.mday}"
|
47
|
+
assert dates.last.mday == 28, "Expected last date.mday to be 28, was #{dates.last.mday}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_week_in_month_to_s
|
51
|
+
assert_equal 'last week of any month', WIMonth.new(Last).to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/test/yeartetest.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'baseexpressiontest'
|
4
|
+
|
5
|
+
# Unit tests for YearTE class
|
6
|
+
# Author:: Matthew Lipper
|
7
|
+
|
8
|
+
class YearTETest < BaseExpressionTest
|
9
|
+
|
10
|
+
def test_2006
|
11
|
+
expr = YearTE.new(2006)
|
12
|
+
assert expr.include?(@pdate_20060914), "Expression #{expr.to_s} should include #{@pdate_20060914}"
|
13
|
+
assert !expr.include?(@pdate_20071008), "Expression #{expr.to_s} should include #{@pdate_20071008}"
|
14
|
+
assert expr.include?(@date_20060504), "Expression #{expr.to_s} should include #{@date_20060504}"
|
15
|
+
assert !expr.include?(@date_20051231), "Expression #{expr.to_s} should include #{@date_20051231}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_to_s
|
19
|
+
assert_equal 'during the year 1934', YearTE.new(1934).to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: runt
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.6.0
|
7
|
+
date: 2007-12-31 00:00:00 -05:00
|
8
8
|
summary: Ruby Temporal Expressions.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -46,13 +46,34 @@ files:
|
|
46
46
|
- lib/runt/schedule.rb
|
47
47
|
- lib/runt/temporalexpression.rb
|
48
48
|
- lib/runt.rb
|
49
|
+
- test/baseexpressiontest.rb
|
50
|
+
- test/collectiontest.rb
|
51
|
+
- test/combinedexpressionstest.rb
|
49
52
|
- test/daterangetest.rb
|
53
|
+
- test/dayintervaltetest.rb
|
54
|
+
- test/difftest.rb
|
55
|
+
- test/dimonthtest.rb
|
56
|
+
- test/diweektest.rb
|
50
57
|
- test/dprecisiontest.rb
|
58
|
+
- test/everytetest.rb
|
51
59
|
- test/icalendartest.rb
|
60
|
+
- test/intersecttest.rb
|
52
61
|
- test/pdatetest.rb
|
62
|
+
- test/redaytest.rb
|
63
|
+
- test/remonthtest.rb
|
64
|
+
- test/reweektest.rb
|
65
|
+
- test/reyeartest.rb
|
66
|
+
- test/rspectest.rb
|
53
67
|
- test/runttest.rb
|
54
68
|
- test/scheduletest.rb
|
69
|
+
- test/spectest.rb
|
55
70
|
- test/temporalexpressiontest.rb
|
71
|
+
- test/uniontest.rb
|
72
|
+
- test/wimonthtest.rb
|
73
|
+
- test/yeartetest.rb
|
74
|
+
- examples/reminder.rb
|
75
|
+
- examples/schedule_tutorial.rb
|
76
|
+
- examples/schedule_tutorialtest.rb
|
56
77
|
- doc/tutorial_schedule.rdoc
|
57
78
|
- doc/tutorial_te.rdoc
|
58
79
|
- site/blue-robot3.css
|
@@ -62,17 +83,44 @@ files:
|
|
62
83
|
- site/runt-logo.gif
|
63
84
|
- site/runt-logo.psd
|
64
85
|
test_files:
|
86
|
+
- examples/schedule_tutorialtest.rb
|
87
|
+
- test/baseexpressiontest.rb
|
88
|
+
- test/collectiontest.rb
|
89
|
+
- test/combinedexpressionstest.rb
|
65
90
|
- test/daterangetest.rb
|
91
|
+
- test/dayintervaltetest.rb
|
92
|
+
- test/difftest.rb
|
93
|
+
- test/dimonthtest.rb
|
94
|
+
- test/diweektest.rb
|
66
95
|
- test/dprecisiontest.rb
|
96
|
+
- test/everytetest.rb
|
67
97
|
- test/icalendartest.rb
|
98
|
+
- test/intersecttest.rb
|
68
99
|
- test/pdatetest.rb
|
100
|
+
- test/redaytest.rb
|
101
|
+
- test/remonthtest.rb
|
102
|
+
- test/reweektest.rb
|
103
|
+
- test/reyeartest.rb
|
104
|
+
- test/rspectest.rb
|
69
105
|
- test/runttest.rb
|
70
106
|
- test/scheduletest.rb
|
107
|
+
- test/spectest.rb
|
71
108
|
- test/temporalexpressiontest.rb
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
109
|
+
- test/uniontest.rb
|
110
|
+
- test/wimonthtest.rb
|
111
|
+
- test/yeartetest.rb
|
112
|
+
rdoc_options:
|
113
|
+
- --main
|
114
|
+
- README
|
115
|
+
- --title
|
116
|
+
- Runt
|
117
|
+
extra_rdoc_files:
|
118
|
+
- README
|
119
|
+
- CHANGES
|
120
|
+
- TODO
|
121
|
+
- LICENSE.txt
|
122
|
+
- doc/tutorial_schedule.rdoc
|
123
|
+
- doc/tutorial_te.rdoc
|
76
124
|
executables: []
|
77
125
|
|
78
126
|
extensions: []
|