@@ -167,33 +167,33 @@ fn test_date_from_ymd() {
167
167
168
168
#[ test]
169
169
fn test_date_from_yo ( ) {
170
- let yo_opt = NaiveDate :: from_yo_opt;
170
+ let from_yo = NaiveDate :: from_yo_opt;
171
171
let ymd = |y, m, d| NaiveDate :: from_ymd_opt ( y, m, d) . unwrap ( ) ;
172
172
173
- assert_eq ! ( yo_opt ( 2012 , 0 ) , None ) ;
174
- assert_eq ! ( yo_opt ( 2012 , 1 ) , Some ( ymd( 2012 , 1 , 1 ) ) ) ;
175
- assert_eq ! ( yo_opt ( 2012 , 2 ) , Some ( ymd( 2012 , 1 , 2 ) ) ) ;
176
- assert_eq ! ( yo_opt ( 2012 , 32 ) , Some ( ymd( 2012 , 2 , 1 ) ) ) ;
177
- assert_eq ! ( yo_opt ( 2012 , 60 ) , Some ( ymd( 2012 , 2 , 29 ) ) ) ;
178
- assert_eq ! ( yo_opt ( 2012 , 61 ) , Some ( ymd( 2012 , 3 , 1 ) ) ) ;
179
- assert_eq ! ( yo_opt ( 2012 , 100 ) , Some ( ymd( 2012 , 4 , 9 ) ) ) ;
180
- assert_eq ! ( yo_opt ( 2012 , 200 ) , Some ( ymd( 2012 , 7 , 18 ) ) ) ;
181
- assert_eq ! ( yo_opt ( 2012 , 300 ) , Some ( ymd( 2012 , 10 , 26 ) ) ) ;
182
- assert_eq ! ( yo_opt ( 2012 , 366 ) , Some ( ymd( 2012 , 12 , 31 ) ) ) ;
183
- assert_eq ! ( yo_opt ( 2012 , 367 ) , None ) ;
184
- assert_eq ! ( yo_opt ( 2012 , 1 << 28 | 60 ) , None ) ;
185
-
186
- assert_eq ! ( yo_opt ( 2014 , 0 ) , None ) ;
187
- assert_eq ! ( yo_opt ( 2014 , 1 ) , Some ( ymd( 2014 , 1 , 1 ) ) ) ;
188
- assert_eq ! ( yo_opt ( 2014 , 2 ) , Some ( ymd( 2014 , 1 , 2 ) ) ) ;
189
- assert_eq ! ( yo_opt ( 2014 , 32 ) , Some ( ymd( 2014 , 2 , 1 ) ) ) ;
190
- assert_eq ! ( yo_opt ( 2014 , 59 ) , Some ( ymd( 2014 , 2 , 28 ) ) ) ;
191
- assert_eq ! ( yo_opt ( 2014 , 60 ) , Some ( ymd( 2014 , 3 , 1 ) ) ) ;
192
- assert_eq ! ( yo_opt ( 2014 , 100 ) , Some ( ymd( 2014 , 4 , 10 ) ) ) ;
193
- assert_eq ! ( yo_opt ( 2014 , 200 ) , Some ( ymd( 2014 , 7 , 19 ) ) ) ;
194
- assert_eq ! ( yo_opt ( 2014 , 300 ) , Some ( ymd( 2014 , 10 , 27 ) ) ) ;
195
- assert_eq ! ( yo_opt ( 2014 , 365 ) , Some ( ymd( 2014 , 12 , 31 ) ) ) ;
196
- assert_eq ! ( yo_opt ( 2014 , 366 ) , None ) ;
173
+ assert_eq ! ( from_yo ( 2012 , 0 ) , None ) ;
174
+ assert_eq ! ( from_yo ( 2012 , 1 ) , Some ( ymd( 2012 , 1 , 1 ) ) ) ;
175
+ assert_eq ! ( from_yo ( 2012 , 2 ) , Some ( ymd( 2012 , 1 , 2 ) ) ) ;
176
+ assert_eq ! ( from_yo ( 2012 , 32 ) , Some ( ymd( 2012 , 2 , 1 ) ) ) ;
177
+ assert_eq ! ( from_yo ( 2012 , 60 ) , Some ( ymd( 2012 , 2 , 29 ) ) ) ;
178
+ assert_eq ! ( from_yo ( 2012 , 61 ) , Some ( ymd( 2012 , 3 , 1 ) ) ) ;
179
+ assert_eq ! ( from_yo ( 2012 , 100 ) , Some ( ymd( 2012 , 4 , 9 ) ) ) ;
180
+ assert_eq ! ( from_yo ( 2012 , 200 ) , Some ( ymd( 2012 , 7 , 18 ) ) ) ;
181
+ assert_eq ! ( from_yo ( 2012 , 300 ) , Some ( ymd( 2012 , 10 , 26 ) ) ) ;
182
+ assert_eq ! ( from_yo ( 2012 , 366 ) , Some ( ymd( 2012 , 12 , 31 ) ) ) ;
183
+ assert_eq ! ( from_yo ( 2012 , 367 ) , None ) ;
184
+ assert_eq ! ( from_yo ( 2012 , 1 << 28 | 60 ) , None ) ;
185
+
186
+ assert_eq ! ( from_yo ( 2014 , 0 ) , None ) ;
187
+ assert_eq ! ( from_yo ( 2014 , 1 ) , Some ( ymd( 2014 , 1 , 1 ) ) ) ;
188
+ assert_eq ! ( from_yo ( 2014 , 2 ) , Some ( ymd( 2014 , 1 , 2 ) ) ) ;
189
+ assert_eq ! ( from_yo ( 2014 , 32 ) , Some ( ymd( 2014 , 2 , 1 ) ) ) ;
190
+ assert_eq ! ( from_yo ( 2014 , 59 ) , Some ( ymd( 2014 , 2 , 28 ) ) ) ;
191
+ assert_eq ! ( from_yo ( 2014 , 60 ) , Some ( ymd( 2014 , 3 , 1 ) ) ) ;
192
+ assert_eq ! ( from_yo ( 2014 , 100 ) , Some ( ymd( 2014 , 4 , 10 ) ) ) ;
193
+ assert_eq ! ( from_yo ( 2014 , 200 ) , Some ( ymd( 2014 , 7 , 19 ) ) ) ;
194
+ assert_eq ! ( from_yo ( 2014 , 300 ) , Some ( ymd( 2014 , 10 , 27 ) ) ) ;
195
+ assert_eq ! ( from_yo ( 2014 , 365 ) , Some ( ymd( 2014 , 12 , 31 ) ) ) ;
196
+ assert_eq ! ( from_yo ( 2014 , 366 ) , None ) ;
197
197
}
198
198
199
199
#[ test]
0 commit comments