month.rb 0.11.0 → 0.11.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG +74 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +145 -0
- data/TODO.txt +26 -0
- data/lib/Month/VERSION.rb +1 -1
- data/month.rb.gemspec +44 -0
- data/test/tc_Date_to_month.rb +21 -0
- data/test/tc_Month_begin_date.rb +21 -0
- data/test/tc_Month_beginning.rb +21 -0
- data/test/tc_Month_beginning_of_month.rb +21 -0
- data/test/tc_Month_beginning_of_the_month.rb +21 -0
- data/test/tc_Month_cdate.rb +34 -0
- data/test/tc_Month_cdates.rb +111 -0
- data/test/tc_Month_comparator.rb +17 -0
- data/test/tc_Month_date.rb +34 -0
- data/test/tc_Month_dates.rb +111 -0
- data/test/tc_Month_day.rb +226 -0
- data/test/tc_Month_day_long.rb +152 -0
- data/test/tc_Month_day_short.rb +152 -0
- data/test/tc_Month_day_shortest.rb +152 -0
- data/test/tc_Month_days.rb +21 -0
- data/test/tc_Month_days_in_month.rb +21 -0
- data/test/tc_Month_days_in_the_month.rb +21 -0
- data/test/tc_Month_each_day.rb +21 -0
- data/test/tc_Month_end.rb +21 -0
- data/test/tc_Month_end_date.rb +21 -0
- data/test/tc_Month_end_of_month.rb +21 -0
- data/test/tc_Month_end_of_the_month.rb +21 -0
- data/test/tc_Month_eqlQ.rb +13 -0
- data/test/tc_Month_finish.rb +21 -0
- data/test/tc_Month_finish_date.rb +21 -0
- data/test/tc_Month_finish_of_month.rb +21 -0
- data/test/tc_Month_finish_of_the_month.rb +21 -0
- data/test/tc_Month_initialize.rb +28 -0
- data/test/tc_Month_last.rb +11 -0
- data/test/tc_Month_last_month.rb +11 -0
- data/test/tc_Month_method_missing.rb +116 -0
- data/test/tc_Month_minus.rb +23 -0
- data/test/tc_Month_next.rb +12 -0
- data/test/tc_Month_next_month.rb +12 -0
- data/test/tc_Month_plus.rb +23 -0
- data/test/tc_Month_prev.rb +11 -0
- data/test/tc_Month_prev_month.rb +11 -0
- data/test/tc_Month_previous.rb +11 -0
- data/test/tc_Month_previous_month.rb +11 -0
- data/test/tc_Month_prior.rb +11 -0
- data/test/tc_Month_prior_month.rb +11 -0
- data/test/tc_Month_self.begin_date.rb +46 -0
- data/test/tc_Month_self.beginning.rb +46 -0
- data/test/tc_Month_self.beginning_of_month.rb +46 -0
- data/test/tc_Month_self.beginning_of_the_month.rb +46 -0
- data/test/tc_Month_self.cdate.rb +33 -0
- data/test/tc_Month_self.cdates.rb +325 -0
- data/test/tc_Month_self.date.rb +33 -0
- data/test/tc_Month_self.dates.rb +325 -0
- data/test/tc_Month_self.day.rb +226 -0
- data/test/tc_Month_self.day_long.rb +152 -0
- data/test/tc_Month_self.day_short.rb +152 -0
- data/test/tc_Month_self.day_shortest.rb +152 -0
- data/test/tc_Month_self.days.rb +124 -0
- data/test/tc_Month_self.days_in_month.rb +124 -0
- data/test/tc_Month_self.days_in_the_month.rb +124 -0
- data/test/tc_Month_self.end.rb +21 -0
- data/test/tc_Month_self.end_date.rb +21 -0
- data/test/tc_Month_self.end_of_month.rb +21 -0
- data/test/tc_Month_self.end_of_the_month.rb +21 -0
- data/test/tc_Month_self.finish.rb +21 -0
- data/test/tc_Month_self.finish_date.rb +21 -0
- data/test/tc_Month_self.finish_of_month.rb +21 -0
- data/test/tc_Month_self.finish_of_the_month.rb +21 -0
- data/test/tc_Month_self.from_date.rb +21 -0
- data/test/tc_Month_self.last.rb +47 -0
- data/test/tc_Month_self.last_month.rb +47 -0
- data/test/tc_Month_self.method_missing.rb +227 -0
- data/test/tc_Month_self.next.rb +23 -0
- data/test/tc_Month_self.next_month.rb +23 -0
- data/test/tc_Month_self.now.rb +9 -0
- data/test/tc_Month_self.of.rb +78 -0
- data/test/tc_Month_self.prev.rb +23 -0
- data/test/tc_Month_self.prev_month.rb +23 -0
- data/test/tc_Month_self.previous.rb +23 -0
- data/test/tc_Month_self.previous_month.rb +23 -0
- data/test/tc_Month_self.prior.rb +23 -0
- data/test/tc_Month_self.prior_month.rb +23 -0
- data/test/tc_Month_self.start.rb +21 -0
- data/test/tc_Month_self.start_date.rb +21 -0
- data/test/tc_Month_self.start_of_month.rb +21 -0
- data/test/tc_Month_self.start_of_the_month.rb +21 -0
- data/test/tc_Month_self.succ.rb +23 -0
- data/test/tc_Month_self.succ_month.rb +23 -0
- data/test/tc_Month_self.successor.rb +23 -0
- data/test/tc_Month_self.successor_month.rb +23 -0
- data/test/tc_Month_self.this.rb +23 -0
- data/test/tc_Month_self.to_i.rb +100 -0
- data/test/tc_Month_self.to_long.rb +100 -0
- data/test/tc_Month_self.to_num.rb +100 -0
- data/test/tc_Month_self.to_number.rb +100 -0
- data/test/tc_Month_self.to_short.rb +100 -0
- data/test/tc_Month_self.today.rb +9 -0
- data/test/tc_Month_self.wday.rb +292 -0
- data/test/tc_Month_start.rb +21 -0
- data/test/tc_Month_start_date.rb +21 -0
- data/test/tc_Month_start_of_month.rb +21 -0
- data/test/tc_Month_start_of_the_month.rb +21 -0
- data/test/tc_Month_succ.rb +11 -0
- data/test/tc_Month_succ_month.rb +11 -0
- data/test/tc_Month_successor.rb +11 -0
- data/test/tc_Month_successor_month.rb +11 -0
- data/test/tc_Month_to_date.rb +17 -0
- data/test/tc_Month_to_i.rb +20 -0
- data/test/tc_Month_to_long.rb +20 -0
- data/test/tc_Month_to_num.rb +20 -0
- data/test/tc_Month_to_number.rb +20 -0
- data/test/tc_Month_to_s.rb +40 -0
- data/test/tc_Month_to_short.rb +20 -0
- data/test/tc_gemspec.rb +42 -0
- data/test/ts_Month.rb +14 -0
- metadata +126 -5
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# test/tc_Month_self.method_missing.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_method_missing < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_method_missing_for_months
|
|
6
|
+
assert_equal Month.new(1).month, Month.january.month
|
|
7
|
+
assert_equal Month.new(1).year, Month.january.year
|
|
8
|
+
assert_equal Month.new(2).month, Month.february.month
|
|
9
|
+
assert_equal Month.new(2).year, Month.february.year
|
|
10
|
+
assert_equal Month.new(3).month, Month.march.month
|
|
11
|
+
assert_equal Month.new(3).year, Month.march.year
|
|
12
|
+
assert_equal Month.new(4).month, Month.april.month
|
|
13
|
+
assert_equal Month.new(4).year, Month.april.year
|
|
14
|
+
assert_equal Month.new(5).month, Month.may.month
|
|
15
|
+
assert_equal Month.new(5).year, Month.may.year
|
|
16
|
+
assert_equal Month.new(6).month, Month.june.month
|
|
17
|
+
assert_equal Month.new(6).year, Month.june.year
|
|
18
|
+
assert_equal Month.new(7).month, Month.july.month
|
|
19
|
+
assert_equal Month.new(7).year, Month.july.year
|
|
20
|
+
assert_equal Month.new(8).month, Month.august.month
|
|
21
|
+
assert_equal Month.new(8).year, Month.august.year
|
|
22
|
+
assert_equal Month.new(9).month, Month.september.month
|
|
23
|
+
assert_equal Month.new(9).year, Month.september.year
|
|
24
|
+
assert_equal Month.new(10).month, Month.october.month
|
|
25
|
+
assert_equal Month.new(10).year, Month.october.year
|
|
26
|
+
assert_equal Month.new(11).month, Month.november.month
|
|
27
|
+
assert_equal Month.new(11).year, Month.november.year
|
|
28
|
+
assert_equal Month.new(12).month, Month.december.month
|
|
29
|
+
assert_equal Month.new(12).year, Month.december.year
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_self_method_missing_for_days
|
|
33
|
+
if Date.today.year == 2011 && Date.today.month == 1
|
|
34
|
+
assert_equal Month.new(2011, 1).mondays, Month.mondays
|
|
35
|
+
assert_equal [3, 10, 17, 24, 31], Month.mondays
|
|
36
|
+
assert_equal Month.new(2011, 1).tuesdays, Month.tuesdays
|
|
37
|
+
assert_equal [4, 11, 18, 25], Month.tuesdays
|
|
38
|
+
assert_equal Month.new(2011, 1).wednesdays, Month.wednesdays
|
|
39
|
+
assert_equal [5, 12, 19, 26], Month.wednesdays
|
|
40
|
+
assert_equal Month.new(2011, 1).thursdays, Month.thursdays
|
|
41
|
+
assert_equal [6, 13, 20, 27], Month.thursdays
|
|
42
|
+
assert_equal Month.new(2011, 1).fridays, Month.fridays
|
|
43
|
+
assert_equal [7, 14, 21, 28], Month.fridays
|
|
44
|
+
assert_equal Month.new(2011, 1).saturdays, Month.saturdays
|
|
45
|
+
assert_equal [1, 8, 15, 22, 29], Month.saturdays
|
|
46
|
+
assert_equal Month.new(2011, 1).sundays, Month.sundays
|
|
47
|
+
assert_equal [2, 9, 16, 23, 30], Month.sundays
|
|
48
|
+
end
|
|
49
|
+
if Date.today.year == 2011 && Date.today.month == 2
|
|
50
|
+
assert_equal Month.new(2011, 2).mondays, Month.mondays
|
|
51
|
+
assert_equal [7, 14, 21, 28], Month.mondays
|
|
52
|
+
assert_equal Month.new(2011, 2).tuesdays, Month.tuesdays
|
|
53
|
+
assert_equal [1, 8, 15, 22], Month.tuesdays
|
|
54
|
+
assert_equal Month.new(2011, 2).wednesdays, Month.wednesdays
|
|
55
|
+
assert_equal [2, 9, 16, 23], Month.wednesdays
|
|
56
|
+
assert_equal Month.new(2011, 2).thursdays, Month.thursdays
|
|
57
|
+
assert_equal [3, 10, 17, 24], Month.thursdays
|
|
58
|
+
assert_equal Month.new(2011, 2).fridays, Month.fridays
|
|
59
|
+
assert_equal [4, 11, 18, 25], Month.fridays
|
|
60
|
+
assert_equal Month.new(2011, 2).saturdays, Month.saturdays
|
|
61
|
+
assert_equal [5, 12, 19, 26], Month.saturdays
|
|
62
|
+
assert_equal Month.new(2011, 2).sundays, Month.sundays
|
|
63
|
+
assert_equal [6, 13, 20, 27], Month.sundays
|
|
64
|
+
end
|
|
65
|
+
if Date.today.year == 2011 && Date.today.month == 3
|
|
66
|
+
assert_equal Month.new(2011, 3).mondays, Month.mondays
|
|
67
|
+
assert_equal [7, 14, 21, 28], Month.mondays
|
|
68
|
+
assert_equal Month.new(2011, 3).tuesdays, Month.tuesdays
|
|
69
|
+
assert_equal [1, 8, 15, 22, 29], Month.tuesdays
|
|
70
|
+
assert_equal Month.new(2011, 3).wednesdays, Month.wednesdays
|
|
71
|
+
assert_equal [2, 9, 16, 23, 30], Month.wednesdays
|
|
72
|
+
assert_equal Month.new(2011, 3).thursdays, Month.thursdays
|
|
73
|
+
assert_equal [3, 10, 17, 24, 31], Month.thursdays
|
|
74
|
+
assert_equal Month.new(2011, 3).fridays, Month.fridays
|
|
75
|
+
assert_equal [4, 11, 18, 25], Month.fridays
|
|
76
|
+
assert_equal Month.new(2011, 3).saturdays, Month.saturdays
|
|
77
|
+
assert_equal [5, 12, 19, 26], Month.saturdays
|
|
78
|
+
assert_equal Month.new(2011, 3).sundays, Month.sundays
|
|
79
|
+
assert_equal [6, 13, 20, 27], Month.sundays
|
|
80
|
+
end
|
|
81
|
+
if Date.today.year == 2011 && Date.today.month == 4
|
|
82
|
+
assert_equal Month.new(2011, 4).mondays, Month.mondays
|
|
83
|
+
assert_equal [4, 11, 18, 25], Month.mondays
|
|
84
|
+
assert_equal Month.new(2011, 4).tuesdays, Month.tuesdays
|
|
85
|
+
assert_equal [5, 12, 19, 26], Month.tuesdays
|
|
86
|
+
assert_equal Month.new(2011, 4).wednesdays, Month.wednesdays
|
|
87
|
+
assert_equal [6, 13, 20, 27], Month.wednesdays
|
|
88
|
+
assert_equal Month.new(2011, 4).thursdays, Month.thursdays
|
|
89
|
+
assert_equal [7, 14, 21, 28], Month.thursdays
|
|
90
|
+
assert_equal Month.new(2011, 4).fridays, Month.fridays
|
|
91
|
+
assert_equal [1, 8, 15, 22, 29], Month.fridays
|
|
92
|
+
assert_equal Month.new(2011, 4).saturdays, Month.saturdays
|
|
93
|
+
assert_equal [2, 9, 16, 23, 30], Month.saturdays
|
|
94
|
+
assert_equal Month.new(2011, 4).sundays, Month.sundays
|
|
95
|
+
assert_equal [3, 10, 17, 24], Month.sundays
|
|
96
|
+
end
|
|
97
|
+
if Date.today.year == 2011 && Date.today.month == 5
|
|
98
|
+
assert_equal Month.new(2011, 5).mondays, Month.mondays
|
|
99
|
+
assert_equal [2, 9, 16, 23, 30], Month.mondays
|
|
100
|
+
assert_equal Month.new(2011, 5).tuesdays, Month.tuesdays
|
|
101
|
+
assert_equal [3, 10, 17, 24, 31], Month.tuesdays
|
|
102
|
+
assert_equal Month.new(2011, 5).wednesdays, Month.wednesdays
|
|
103
|
+
assert_equal [4, 11, 18, 25], Month.wednesdays
|
|
104
|
+
assert_equal Month.new(2011, 5).thursdays, Month.thursdays
|
|
105
|
+
assert_equal [5, 12, 19, 26], Month.thursdays
|
|
106
|
+
assert_equal Month.new(2011, 5).fridays, Month.fridays
|
|
107
|
+
assert_equal [6, 13, 20, 27], Month.fridays
|
|
108
|
+
assert_equal Month.new(2011, 5).saturdays, Month.saturdays
|
|
109
|
+
assert_equal [7, 14, 21, 28], Month.saturdays
|
|
110
|
+
assert_equal Month.new(2011, 5).sundays, Month.sundays
|
|
111
|
+
assert_equal [1, 8, 15, 22, 29], Month.sundays
|
|
112
|
+
end
|
|
113
|
+
if Date.today.year == 2011 && Date.today.month == 6
|
|
114
|
+
assert_equal Month.new(2011, 6).mondays, Month.mondays
|
|
115
|
+
assert_equal [6, 13, 20, 27], Month.mondays
|
|
116
|
+
assert_equal Month.new(2011, 6).tuesdays, Month.tuesdays
|
|
117
|
+
assert_equal [7, 14, 21, 28], Month.tuesdays
|
|
118
|
+
assert_equal Month.new(2011, 6).wednesdays, Month.wednesdays
|
|
119
|
+
assert_equal [1, 8, 15, 22, 29], Month.wednesdays
|
|
120
|
+
assert_equal Month.new(2011, 6).thursdays, Month.thursdays
|
|
121
|
+
assert_equal [2, 9, 16, 23, 30], Month.thursdays
|
|
122
|
+
assert_equal Month.new(2011, 6).fridays, Month.fridays
|
|
123
|
+
assert_equal [3, 10, 17, 24], Month.fridays
|
|
124
|
+
assert_equal Month.new(2011, 6).saturdays, Month.saturdays
|
|
125
|
+
assert_equal [4, 11, 18, 25], Month.saturdays
|
|
126
|
+
assert_equal Month.new(2011, 6).sundays, Month.sundays
|
|
127
|
+
assert_equal [5, 12, 19, 26], Month.sundays
|
|
128
|
+
end
|
|
129
|
+
if Date.today.year == 2011 && Date.today.month == 7
|
|
130
|
+
assert_equal Month.new(2011, 7).mondays, Month.mondays
|
|
131
|
+
assert_equal [4, 11, 18, 25], Month.mondays
|
|
132
|
+
assert_equal Month.new(2011, 7).tuesdays, Month.tuesdays
|
|
133
|
+
assert_equal [5, 12, 19, 26], Month.tuesdays
|
|
134
|
+
assert_equal Month.new(2011, 7).wednesdays, Month.wednesdays
|
|
135
|
+
assert_equal [6, 13, 20, 27], Month.wednesdays
|
|
136
|
+
assert_equal Month.new(2011, 7).thursdays, Month.thursdays
|
|
137
|
+
assert_equal [7, 14, 21, 28], Month.thursdays
|
|
138
|
+
assert_equal Month.new(2011, 7).fridays, Month.fridays
|
|
139
|
+
assert_equal [1, 8, 15, 22, 29], Month.fridays
|
|
140
|
+
assert_equal Month.new(2011, 7).saturdays, Month.saturdays
|
|
141
|
+
assert_equal [2, 9, 16, 23, 30], Month.saturdays
|
|
142
|
+
assert_equal Month.new(2011, 7).sundays, Month.sundays
|
|
143
|
+
assert_equal [3, 10, 17, 24, 31], Month.sundays
|
|
144
|
+
end
|
|
145
|
+
if Date.today.year == 2011 && Date.today.month == 8
|
|
146
|
+
assert_equal Month.new(2011, 8).mondays, Month.mondays
|
|
147
|
+
assert_equal [1, 8, 15, 22, 29], Month.mondays
|
|
148
|
+
assert_equal Month.new(2011, 8).tuesdays, Month.tuesdays
|
|
149
|
+
assert_equal [2, 9, 16, 23, 30], Month.tuesdays
|
|
150
|
+
assert_equal Month.new(2011, 8).wednesdays, Month.wednesdays
|
|
151
|
+
assert_equal [3, 10, 17, 24, 31], Month.wednesdays
|
|
152
|
+
assert_equal Month.new(2011, 8).thursdays, Month.thursdays
|
|
153
|
+
assert_equal [4, 11, 18, 25], Month.thursdays
|
|
154
|
+
assert_equal Month.new(2011, 8).fridays, Month.fridays
|
|
155
|
+
assert_equal [5, 12, 19, 26], Month.fridays
|
|
156
|
+
assert_equal Month.new(2011, 8).saturdays, Month.saturdays
|
|
157
|
+
assert_equal [6, 13, 20, 27], Month.saturdays
|
|
158
|
+
assert_equal Month.new(2011, 8).sundays, Month.sundays
|
|
159
|
+
assert_equal [7, 14, 21, 28], Month.sundays
|
|
160
|
+
end
|
|
161
|
+
if Date.today.year == 2011 && Date.today.month == 9
|
|
162
|
+
assert_equal Month.new(2011, 9).mondays, Month.mondays
|
|
163
|
+
assert_equal [5, 12, 19, 26], Month.mondays
|
|
164
|
+
assert_equal Month.new(2011, 9).tuesdays, Month.tuesdays
|
|
165
|
+
assert_equal [6, 13, 20, 27], Month.tuesdays
|
|
166
|
+
assert_equal Month.new(2011, 9).wednesdays, Month.wednesdays
|
|
167
|
+
assert_equal [7, 14, 21, 28], Month.wednesdays
|
|
168
|
+
assert_equal Month.new(2011, 9).thursdays, Month.thursdays
|
|
169
|
+
assert_equal [1, 8, 15, 22, 29], Month.thursdays
|
|
170
|
+
assert_equal Month.new(2011, 9).fridays, Month.fridays
|
|
171
|
+
assert_equal [2, 9, 16, 23, 30], Month.fridays
|
|
172
|
+
assert_equal Month.new(2011, 9).saturdays, Month.saturdays
|
|
173
|
+
assert_equal [3, 10, 17, 24], Month.saturdays
|
|
174
|
+
assert_equal Month.new(2011, 9).sundays, Month.sundays
|
|
175
|
+
assert_equal [4, 11, 18, 25], Month.sundays
|
|
176
|
+
end
|
|
177
|
+
if Date.today.year == 2011 && Date.today.month == 10
|
|
178
|
+
assert_equal Month.new(2011, 10).mondays, Month.mondays
|
|
179
|
+
assert_equal [3, 10, 17, 24, 31], Month.mondays
|
|
180
|
+
assert_equal Month.new(2011, 10).tuesdays, Month.tuesdays
|
|
181
|
+
assert_equal [4, 11, 18, 25], Month.tuesdays
|
|
182
|
+
assert_equal Month.new(2011, 10).wednesdays, Month.wednesdays
|
|
183
|
+
assert_equal [5, 12, 19, 26], Month.wednesdays
|
|
184
|
+
assert_equal Month.new(2011, 10).thursdays, Month.thursdays
|
|
185
|
+
assert_equal [6, 13, 20, 27], Month.thursdays
|
|
186
|
+
assert_equal Month.new(2011, 10).fridays, Month.fridays
|
|
187
|
+
assert_equal [7, 14, 21, 28], Month.fridays
|
|
188
|
+
assert_equal Month.new(2011, 10).saturdays, Month.saturdays
|
|
189
|
+
assert_equal [1, 8, 15, 22, 29], Month.saturdays
|
|
190
|
+
assert_equal Month.new(2011, 10).sundays, Month.sundays
|
|
191
|
+
assert_equal [2, 9, 16, 23, 30], Month.sundays
|
|
192
|
+
end
|
|
193
|
+
if Date.today.year == 2011 && Date.today.month == 11
|
|
194
|
+
assert_equal Month.new(2011, 11).mondays, Month.mondays
|
|
195
|
+
assert_equal [7, 14, 21, 28], Month.mondays
|
|
196
|
+
assert_equal Month.new(2011, 11).tuesdays, Month.tuesdays
|
|
197
|
+
assert_equal [1, 8, 15, 22, 29], Month.tuesdays
|
|
198
|
+
assert_equal Month.new(2011, 11).wednesdays, Month.wednesdays
|
|
199
|
+
assert_equal [2, 9, 16, 23, 30], Month.wednesdays
|
|
200
|
+
assert_equal Month.new(2011, 11).thursdays, Month.thursdays
|
|
201
|
+
assert_equal [3, 10, 17, 24], Month.thursdays
|
|
202
|
+
assert_equal Month.new(2011, 11).fridays, Month.fridays
|
|
203
|
+
assert_equal [4, 11, 18, 25], Month.fridays
|
|
204
|
+
assert_equal Month.new(2011, 11).saturdays, Month.saturdays
|
|
205
|
+
assert_equal [5, 12, 19, 26], Month.saturdays
|
|
206
|
+
assert_equal Month.new(2011, 11).sundays, Month.sundays
|
|
207
|
+
assert_equal [6, 13, 20, 27], Month.sundays
|
|
208
|
+
end
|
|
209
|
+
if Date.today.year == 2011 && Date.today.month == 12
|
|
210
|
+
assert_equal Month.new(2011, 12).mondays, Month.mondays
|
|
211
|
+
assert_equal [5, 12, 19, 26], Month.mondays
|
|
212
|
+
assert_equal Month.new(2011, 12).tuesdays, Month.tuesdays
|
|
213
|
+
assert_equal [6, 13, 20, 27], Month.tuesdays
|
|
214
|
+
assert_equal Month.new(2011, 12).wednesdays, Month.wednesdays
|
|
215
|
+
assert_equal [7, 14, 21, 28], Month.wednesdays
|
|
216
|
+
assert_equal Month.new(2011, 12).thursdays, Month.thursdays
|
|
217
|
+
assert_equal [1, 8, 15, 22, 29], Month.thursdays
|
|
218
|
+
assert_equal Month.new(2011, 12).fridays, Month.fridays
|
|
219
|
+
assert_equal [2, 9, 16, 23, 30], Month.fridays
|
|
220
|
+
assert_equal Month.new(2011, 12).saturdays, Month.saturdays
|
|
221
|
+
assert_equal [3, 10, 17, 24, 31], Month.saturdays
|
|
222
|
+
assert_equal Month.new(2011, 12).sundays, Month.sundays
|
|
223
|
+
assert_equal [4, 11, 18, 25], Month.sundays
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.next.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_next < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_next
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(2).month, Month.next.month
|
|
9
|
+
when 2; assert_equal Month.new(3).month, Month.next.month
|
|
10
|
+
when 3; assert_equal Month.new(4).month, Month.next.month
|
|
11
|
+
when 4; assert_equal Month.new(5).month, Month.next.month
|
|
12
|
+
when 5; assert_equal Month.new(6).month, Month.next.month
|
|
13
|
+
when 6; assert_equal Month.new(7).month, Month.next.month
|
|
14
|
+
when 7; assert_equal Month.new(8).month, Month.next.month
|
|
15
|
+
when 8; assert_equal Month.new(9).month, Month.next.month
|
|
16
|
+
when 9; assert_equal Month.new(10).month, Month.next.month
|
|
17
|
+
when 10; assert_equal Month.new(11).month, Month.next.month
|
|
18
|
+
when 11; assert_equal Month.new(12).month, Month.next.month
|
|
19
|
+
when 12; assert_equal Month.new(today.year + 1, 1).month, Month.next.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.next_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_next_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_next_month
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(2).month, Month.next_month.month
|
|
9
|
+
when 2; assert_equal Month.new(3).month, Month.next_month.month
|
|
10
|
+
when 3; assert_equal Month.new(4).month, Month.next_month.month
|
|
11
|
+
when 4; assert_equal Month.new(5).month, Month.next_month.month
|
|
12
|
+
when 5; assert_equal Month.new(6).month, Month.next_month.month
|
|
13
|
+
when 6; assert_equal Month.new(7).month, Month.next_month.month
|
|
14
|
+
when 7; assert_equal Month.new(8).month, Month.next_month.month
|
|
15
|
+
when 8; assert_equal Month.new(9).month, Month.next_month.month
|
|
16
|
+
when 9; assert_equal Month.new(10).month, Month.next_month.month
|
|
17
|
+
when 10; assert_equal Month.new(11).month, Month.next_month.month
|
|
18
|
+
when 11; assert_equal Month.new(12).month, Month.next_month.month
|
|
19
|
+
when 12; assert_equal Month.new(today.year + 1, 1).month, Month.next_month.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# test/tc_Month_self.of.rb
|
|
2
|
+
|
|
3
|
+
if __FILE__ == $0
|
|
4
|
+
require 'minitest/autorun'
|
|
5
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
|
|
6
|
+
require 'Month/Constants'
|
|
7
|
+
require 'Month/self.of'
|
|
8
|
+
require 'Month/_equals'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class TC_Month_self_of < Minitest::Test
|
|
12
|
+
|
|
13
|
+
def test_long_capitalized
|
|
14
|
+
assert_equal true, Month.of('January') == Month.new(1)
|
|
15
|
+
assert_equal true, Month.of('February') == Month.new(2)
|
|
16
|
+
assert_equal true, Month.of('March') == Month.new(3)
|
|
17
|
+
assert_equal true, Month.of('April') == Month.new(4)
|
|
18
|
+
assert_equal true, Month.of('May') == Month.new(5)
|
|
19
|
+
assert_equal true, Month.of('June') == Month.new(6)
|
|
20
|
+
assert_equal true, Month.of('July') == Month.new(7)
|
|
21
|
+
assert_equal true, Month.of('August') == Month.new(8)
|
|
22
|
+
assert_equal true, Month.of('September') == Month.new(9)
|
|
23
|
+
assert_equal true, Month.of('October') == Month.new(10)
|
|
24
|
+
assert_equal true, Month.of('November') == Month.new(11)
|
|
25
|
+
assert_equal true, Month.of('December') == Month.new(12)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_long_downcase
|
|
29
|
+
assert_equal true, Month.of('january') == Month.new(1)
|
|
30
|
+
assert_equal true, Month.of('february') == Month.new(2)
|
|
31
|
+
assert_equal true, Month.of('march') == Month.new(3)
|
|
32
|
+
assert_equal true, Month.of('april') == Month.new(4)
|
|
33
|
+
assert_equal true, Month.of('may') == Month.new(5)
|
|
34
|
+
assert_equal true, Month.of('june') == Month.new(6)
|
|
35
|
+
assert_equal true, Month.of('july') == Month.new(7)
|
|
36
|
+
assert_equal true, Month.of('august') == Month.new(8)
|
|
37
|
+
assert_equal true, Month.of('september') == Month.new(9)
|
|
38
|
+
assert_equal true, Month.of('october') == Month.new(10)
|
|
39
|
+
assert_equal true, Month.of('november') == Month.new(11)
|
|
40
|
+
assert_equal true, Month.of('december') == Month.new(12)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_short_capitalized
|
|
44
|
+
assert_equal true, Month.of('Jan') == Month.new(1)
|
|
45
|
+
assert_equal true, Month.of('Feb') == Month.new(2)
|
|
46
|
+
assert_equal true, Month.of('Mar') == Month.new(3)
|
|
47
|
+
assert_equal true, Month.of('Apr') == Month.new(4)
|
|
48
|
+
assert_equal true, Month.of('May') == Month.new(5)
|
|
49
|
+
assert_equal true, Month.of('Jun') == Month.new(6)
|
|
50
|
+
assert_equal true, Month.of('Jul') == Month.new(7)
|
|
51
|
+
assert_equal true, Month.of('Aug') == Month.new(8)
|
|
52
|
+
assert_equal true, Month.of('Sep') == Month.new(9)
|
|
53
|
+
assert_equal true, Month.of('Oct') == Month.new(10)
|
|
54
|
+
assert_equal true, Month.of('Nov') == Month.new(11)
|
|
55
|
+
assert_equal true, Month.of('Dec') == Month.new(12)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_short_downcase
|
|
59
|
+
assert_equal true, Month.of('jan') == Month.new(1)
|
|
60
|
+
assert_equal true, Month.of('feb') == Month.new(2)
|
|
61
|
+
assert_equal true, Month.of('mar') == Month.new(3)
|
|
62
|
+
assert_equal true, Month.of('apr') == Month.new(4)
|
|
63
|
+
assert_equal true, Month.of('may') == Month.new(5)
|
|
64
|
+
assert_equal true, Month.of('jun') == Month.new(6)
|
|
65
|
+
assert_equal true, Month.of('jul') == Month.new(7)
|
|
66
|
+
assert_equal true, Month.of('aug') == Month.new(8)
|
|
67
|
+
assert_equal true, Month.of('sep') == Month.new(9)
|
|
68
|
+
assert_equal true, Month.of('oct') == Month.new(10)
|
|
69
|
+
assert_equal true, Month.of('nov') == Month.new(11)
|
|
70
|
+
assert_equal true, Month.of('dec') == Month.new(12)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_crap
|
|
74
|
+
assert_nil Month.of('random')
|
|
75
|
+
assert_nil Month.of(12)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.prev.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_prev < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_prev
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(today.year - 1, 12).month, Month.prev.month
|
|
9
|
+
when 2; assert_equal Month.new(1).month, Month.prev.month
|
|
10
|
+
when 3; assert_equal Month.new(2).month, Month.prev.month
|
|
11
|
+
when 4; assert_equal Month.new(3).month, Month.prev.month
|
|
12
|
+
when 5; assert_equal Month.new(4).month, Month.prev.month
|
|
13
|
+
when 6; assert_equal Month.new(5).month, Month.prev.month
|
|
14
|
+
when 7; assert_equal Month.new(6).month, Month.prev.month
|
|
15
|
+
when 8; assert_equal Month.new(7).month, Month.prev.month
|
|
16
|
+
when 9; assert_equal Month.new(8).month, Month.prev.month
|
|
17
|
+
when 10; assert_equal Month.new(9).month, Month.prev.month
|
|
18
|
+
when 11; assert_equal Month.new(10).month, Month.prev.month
|
|
19
|
+
when 12; assert_equal Month.new(11).month, Month.prev.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.prev_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_prev_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_prev_month
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(today.year - 1, 12).month, Month.prev_month.month
|
|
9
|
+
when 2; assert_equal Month.new(1).month, Month.prev_month.month
|
|
10
|
+
when 3; assert_equal Month.new(2).month, Month.prev_month.month
|
|
11
|
+
when 4; assert_equal Month.new(3).month, Month.prev_month.month
|
|
12
|
+
when 5; assert_equal Month.new(4).month, Month.prev_month.month
|
|
13
|
+
when 6; assert_equal Month.new(5).month, Month.prev_month.month
|
|
14
|
+
when 7; assert_equal Month.new(6).month, Month.prev_month.month
|
|
15
|
+
when 8; assert_equal Month.new(7).month, Month.prev_month.month
|
|
16
|
+
when 9; assert_equal Month.new(8).month, Month.prev_month.month
|
|
17
|
+
when 10; assert_equal Month.new(9).month, Month.prev_month.month
|
|
18
|
+
when 11; assert_equal Month.new(10).month, Month.prev_month.month
|
|
19
|
+
when 12; assert_equal Month.new(11).month, Month.prev_month.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.previous.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_previous < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_previous
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(today.year - 1, 12).month, Month.previous.month
|
|
9
|
+
when 2; assert_equal Month.new(1).month, Month.previous.month
|
|
10
|
+
when 3; assert_equal Month.new(2).month, Month.previous.month
|
|
11
|
+
when 4; assert_equal Month.new(3).month, Month.previous.month
|
|
12
|
+
when 5; assert_equal Month.new(4).month, Month.previous.month
|
|
13
|
+
when 6; assert_equal Month.new(5).month, Month.previous.month
|
|
14
|
+
when 7; assert_equal Month.new(6).month, Month.previous.month
|
|
15
|
+
when 8; assert_equal Month.new(7).month, Month.previous.month
|
|
16
|
+
when 9; assert_equal Month.new(8).month, Month.previous.month
|
|
17
|
+
when 10; assert_equal Month.new(9).month, Month.previous.month
|
|
18
|
+
when 11; assert_equal Month.new(10).month, Month.previous.month
|
|
19
|
+
when 12; assert_equal Month.new(11).month, Month.previous.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.previous_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_previous_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_previous_month
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(today.year - 1, 12).month, Month.previous_month.month
|
|
9
|
+
when 2; assert_equal Month.new(1).month, Month.previous_month.month
|
|
10
|
+
when 3; assert_equal Month.new(2).month, Month.previous_month.month
|
|
11
|
+
when 4; assert_equal Month.new(3).month, Month.previous_month.month
|
|
12
|
+
when 5; assert_equal Month.new(4).month, Month.previous_month.month
|
|
13
|
+
when 6; assert_equal Month.new(5).month, Month.previous_month.month
|
|
14
|
+
when 7; assert_equal Month.new(6).month, Month.previous_month.month
|
|
15
|
+
when 8; assert_equal Month.new(7).month, Month.previous_month.month
|
|
16
|
+
when 9; assert_equal Month.new(8).month, Month.previous_month.month
|
|
17
|
+
when 10; assert_equal Month.new(9).month, Month.previous_month.month
|
|
18
|
+
when 11; assert_equal Month.new(10).month, Month.previous_month.month
|
|
19
|
+
when 12; assert_equal Month.new(11).month, Month.previous_month.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.prior.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_prior < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_prior
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(today.year - 1, 12).month, Month.prior.month
|
|
9
|
+
when 2; assert_equal Month.new(1).month, Month.prior.month
|
|
10
|
+
when 3; assert_equal Month.new(2).month, Month.prior.month
|
|
11
|
+
when 4; assert_equal Month.new(3).month, Month.prior.month
|
|
12
|
+
when 5; assert_equal Month.new(4).month, Month.prior.month
|
|
13
|
+
when 6; assert_equal Month.new(5).month, Month.prior.month
|
|
14
|
+
when 7; assert_equal Month.new(6).month, Month.prior.month
|
|
15
|
+
when 8; assert_equal Month.new(7).month, Month.prior.month
|
|
16
|
+
when 9; assert_equal Month.new(8).month, Month.prior.month
|
|
17
|
+
when 10; assert_equal Month.new(9).month, Month.prior.month
|
|
18
|
+
when 11; assert_equal Month.new(10).month, Month.prior.month
|
|
19
|
+
when 12; assert_equal Month.new(11).month, Month.prior.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.prior_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_prior_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_prior_month
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(today.year - 1, 12).month, Month.prior_month.month
|
|
9
|
+
when 2; assert_equal Month.new(1).month, Month.prior_month.month
|
|
10
|
+
when 3; assert_equal Month.new(2).month, Month.prior_month.month
|
|
11
|
+
when 4; assert_equal Month.new(3).month, Month.prior_month.month
|
|
12
|
+
when 5; assert_equal Month.new(4).month, Month.prior_month.month
|
|
13
|
+
when 6; assert_equal Month.new(5).month, Month.prior_month.month
|
|
14
|
+
when 7; assert_equal Month.new(6).month, Month.prior_month.month
|
|
15
|
+
when 8; assert_equal Month.new(7).month, Month.prior_month.month
|
|
16
|
+
when 9; assert_equal Month.new(8).month, Month.prior_month.month
|
|
17
|
+
when 10; assert_equal Month.new(9).month, Month.prior_month.month
|
|
18
|
+
when 11; assert_equal Month.new(10).month, Month.prior_month.month
|
|
19
|
+
when 12; assert_equal Month.new(11).month, Month.prior_month.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# test/tc_Month_self.start.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_start < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_start
|
|
6
|
+
assert_equal Date.new(2006, 1, 1), Month.start(2006, 1)
|
|
7
|
+
assert_equal Date.new(2006, 2, 1), Month.start(2006, 2)
|
|
8
|
+
assert_equal Date.new(2008, 2, 1), Month.start(2008, 2)
|
|
9
|
+
assert_equal Date.new(2006, 3, 1), Month.start(2006, 3)
|
|
10
|
+
assert_equal Date.new(2006, 4, 1), Month.start(2006, 4)
|
|
11
|
+
assert_equal Date.new(2006, 5, 1), Month.start(2006, 5)
|
|
12
|
+
assert_equal Date.new(2006, 6, 1), Month.start(2006, 6)
|
|
13
|
+
assert_equal Date.new(2006, 7, 1), Month.start(2006, 7)
|
|
14
|
+
assert_equal Date.new(2006, 8, 1), Month.start(2006, 8)
|
|
15
|
+
assert_equal Date.new(2006, 9, 1), Month.start(2006, 9)
|
|
16
|
+
assert_equal Date.new(2006, 10, 1), Month.start(2006, 10)
|
|
17
|
+
assert_equal Date.new(2006, 11, 1), Month.start(2006, 11)
|
|
18
|
+
assert_equal Date.new(2006, 12, 1), Month.start(2006, 12)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# test/tc_Month_self.start_date.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_start_date < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_start_date
|
|
6
|
+
assert_equal Date.new(2006, 1, 1), Month.start_date(2006, 1)
|
|
7
|
+
assert_equal Date.new(2006, 2, 1), Month.start_date(2006, 2)
|
|
8
|
+
assert_equal Date.new(2008, 2, 1), Month.start_date(2008, 2)
|
|
9
|
+
assert_equal Date.new(2006, 3, 1), Month.start_date(2006, 3)
|
|
10
|
+
assert_equal Date.new(2006, 4, 1), Month.start_date(2006, 4)
|
|
11
|
+
assert_equal Date.new(2006, 5, 1), Month.start_date(2006, 5)
|
|
12
|
+
assert_equal Date.new(2006, 6, 1), Month.start_date(2006, 6)
|
|
13
|
+
assert_equal Date.new(2006, 7, 1), Month.start_date(2006, 7)
|
|
14
|
+
assert_equal Date.new(2006, 8, 1), Month.start_date(2006, 8)
|
|
15
|
+
assert_equal Date.new(2006, 9, 1), Month.start_date(2006, 9)
|
|
16
|
+
assert_equal Date.new(2006, 10, 1), Month.start_date(2006, 10)
|
|
17
|
+
assert_equal Date.new(2006, 11, 1), Month.start_date(2006, 11)
|
|
18
|
+
assert_equal Date.new(2006, 12, 1), Month.start_date(2006, 12)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# test/tc_Month_self.start_of_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_start_of_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_start_of_month
|
|
6
|
+
assert_equal Date.new(2006, 1, 1), Month.start_of_month(2006, 1)
|
|
7
|
+
assert_equal Date.new(2006, 2, 1), Month.start_of_month(2006, 2)
|
|
8
|
+
assert_equal Date.new(2008, 2, 1), Month.start_of_month(2008, 2)
|
|
9
|
+
assert_equal Date.new(2006, 3, 1), Month.start_of_month(2006, 3)
|
|
10
|
+
assert_equal Date.new(2006, 4, 1), Month.start_of_month(2006, 4)
|
|
11
|
+
assert_equal Date.new(2006, 5, 1), Month.start_of_month(2006, 5)
|
|
12
|
+
assert_equal Date.new(2006, 6, 1), Month.start_of_month(2006, 6)
|
|
13
|
+
assert_equal Date.new(2006, 7, 1), Month.start_of_month(2006, 7)
|
|
14
|
+
assert_equal Date.new(2006, 8, 1), Month.start_of_month(2006, 8)
|
|
15
|
+
assert_equal Date.new(2006, 9, 1), Month.start_of_month(2006, 9)
|
|
16
|
+
assert_equal Date.new(2006, 10, 1), Month.start_of_month(2006, 10)
|
|
17
|
+
assert_equal Date.new(2006, 11, 1), Month.start_of_month(2006, 11)
|
|
18
|
+
assert_equal Date.new(2006, 12, 1), Month.start_of_month(2006, 12)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# test/tc_Month_self.start_of_the_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_start_of_the_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_start_of_the_month
|
|
6
|
+
assert_equal Date.new(2006, 1, 1), Month.start_of_the_month(2006, 1)
|
|
7
|
+
assert_equal Date.new(2006, 2, 1), Month.start_of_the_month(2006, 2)
|
|
8
|
+
assert_equal Date.new(2008, 2, 1), Month.start_of_the_month(2008, 2)
|
|
9
|
+
assert_equal Date.new(2006, 3, 1), Month.start_of_the_month(2006, 3)
|
|
10
|
+
assert_equal Date.new(2006, 4, 1), Month.start_of_the_month(2006, 4)
|
|
11
|
+
assert_equal Date.new(2006, 5, 1), Month.start_of_the_month(2006, 5)
|
|
12
|
+
assert_equal Date.new(2006, 6, 1), Month.start_of_the_month(2006, 6)
|
|
13
|
+
assert_equal Date.new(2006, 7, 1), Month.start_of_the_month(2006, 7)
|
|
14
|
+
assert_equal Date.new(2006, 8, 1), Month.start_of_the_month(2006, 8)
|
|
15
|
+
assert_equal Date.new(2006, 9, 1), Month.start_of_the_month(2006, 9)
|
|
16
|
+
assert_equal Date.new(2006, 10, 1), Month.start_of_the_month(2006, 10)
|
|
17
|
+
assert_equal Date.new(2006, 11, 1), Month.start_of_the_month(2006, 11)
|
|
18
|
+
assert_equal Date.new(2006, 12, 1), Month.start_of_the_month(2006, 12)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.succ.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_succ < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_succ
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(2).month, Month.succ.month
|
|
9
|
+
when 2; assert_equal Month.new(3).month, Month.succ.month
|
|
10
|
+
when 3; assert_equal Month.new(4).month, Month.succ.month
|
|
11
|
+
when 4; assert_equal Month.new(5).month, Month.succ.month
|
|
12
|
+
when 5; assert_equal Month.new(6).month, Month.succ.month
|
|
13
|
+
when 6; assert_equal Month.new(7).month, Month.succ.month
|
|
14
|
+
when 7; assert_equal Month.new(8).month, Month.succ.month
|
|
15
|
+
when 8; assert_equal Month.new(9).month, Month.succ.month
|
|
16
|
+
when 9; assert_equal Month.new(10).month, Month.succ.month
|
|
17
|
+
when 10; assert_equal Month.new(11).month, Month.succ.month
|
|
18
|
+
when 11; assert_equal Month.new(12).month, Month.succ.month
|
|
19
|
+
when 12; assert_equal Month.new(today.year + 1, 1).month, Month.succ.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# test/tc_Month_self.succ_month.rb
|
|
2
|
+
|
|
3
|
+
class TC_Month_self_succ_month < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_self_succ_month
|
|
6
|
+
today = Date.today
|
|
7
|
+
case today.month
|
|
8
|
+
when 1; assert_equal Month.new(2).month, Month.succ_month.month
|
|
9
|
+
when 2; assert_equal Month.new(3).month, Month.succ_month.month
|
|
10
|
+
when 3; assert_equal Month.new(4).month, Month.succ_month.month
|
|
11
|
+
when 4; assert_equal Month.new(5).month, Month.succ_month.month
|
|
12
|
+
when 5; assert_equal Month.new(6).month, Month.succ_month.month
|
|
13
|
+
when 6; assert_equal Month.new(7).month, Month.succ_month.month
|
|
14
|
+
when 7; assert_equal Month.new(8).month, Month.succ_month.month
|
|
15
|
+
when 8; assert_equal Month.new(9).month, Month.succ_month.month
|
|
16
|
+
when 9; assert_equal Month.new(10).month, Month.succ_month.month
|
|
17
|
+
when 10; assert_equal Month.new(11).month, Month.succ_month.month
|
|
18
|
+
when 11; assert_equal Month.new(12).month, Month.succ_month.month
|
|
19
|
+
when 12; assert_equal Month.new(today.year + 1, 1).month, Month.succ_month.month
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|