File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -285,8 +285,7 @@ fn test_wrapping_traits() {
285
285
assert_eq ! ( wrapping_add( 255 , 1 ) , ( Wrapping ( 255u8 ) + Wrapping ( 1u8 ) ) . 0 ) ;
286
286
assert_eq ! ( wrapping_sub( 0 , 1 ) , ( Wrapping ( 0u8 ) - Wrapping ( 1u8 ) ) . 0 ) ;
287
287
assert_eq ! ( wrapping_mul( 255 , 2 ) , ( Wrapping ( 255u8 ) * Wrapping ( 2u8 ) ) . 0 ) ;
288
- // TODO: Test for Wrapping::Neg. Not possible yet since core::ops::Neg was
289
- // only added to core::num::Wrapping<_> in Rust 1.10.
288
+ assert_eq ! ( wrapping_neg( 255 ) , ( -Wrapping ( 255u8 ) ) . 0 ) ;
290
289
assert_eq ! ( wrapping_shl( 255 , 8 ) , ( Wrapping ( 255u8 ) << 8 ) . 0 ) ;
291
290
assert_eq ! ( wrapping_shr( 255 , 8 ) , ( Wrapping ( 255u8 ) >> 8 ) . 0 ) ;
292
291
}
@@ -309,8 +308,11 @@ fn wrapping_is_wrappingmul() {
309
308
require_wrappingmul ( & Wrapping ( 42 ) ) ;
310
309
}
311
310
312
- // TODO: Test for Wrapping::Neg. Not possible yet since core::ops::Neg was
313
- // only added to core::num::Wrapping<_> in Rust 1.10.
311
+ #[ test]
312
+ fn wrapping_is_wrappingneg ( ) {
313
+ fn require_wrappingneg < T : WrappingNeg > ( _: & T ) { }
314
+ require_wrappingneg ( & Wrapping ( 42 ) ) ;
315
+ }
314
316
315
317
#[ test]
316
318
fn wrapping_is_wrappingshl ( ) {
Original file line number Diff line number Diff line change @@ -209,11 +209,8 @@ fn unsigned_wrapping_is_unsigned() {
209
209
require_unsigned ( & Wrapping ( 42_u32 ) ) ;
210
210
}
211
211
212
- // Commenting this out since it doesn't compile on Rust 1.8,
213
- // because on this version Wrapping doesn't implement Neg and therefore can't
214
- // implement Signed.
215
- // #[test]
216
- // fn signed_wrapping_is_signed() {
217
- // fn require_signed<T: Signed>(_: &T) {}
218
- // require_signed(&Wrapping(-42));
219
- // }
212
+ #[ test]
213
+ fn signed_wrapping_is_signed ( ) {
214
+ fn require_signed < T : Signed > ( _: & T ) { }
215
+ require_signed ( & Wrapping ( -42 ) ) ;
216
+ }
You can’t perform that action at this time.
0 commit comments