File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 1f62b23411abcfbe66eeea294f4258f1bb169e7d
2
+ refs/heads/master: 36771ef60997b5882ad391839b5f7854d077cc42
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5
5
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
Original file line number Diff line number Diff line change @@ -445,7 +445,7 @@ impl Integer for BigUint {
445
445
if self . data . is_empty ( ) {
446
446
true
447
447
} else {
448
- self . data . last ( ) . is_even ( )
448
+ self . data [ 0 ] . is_even ( )
449
449
}
450
450
}
451
451
@@ -1446,6 +1446,17 @@ mod biguint_tests {
1446
1446
check ( 99 , 17 , 1683 ) ;
1447
1447
}
1448
1448
1449
+ #[ test]
1450
+ fn test_is_even ( ) {
1451
+ assert ! ( FromStr :: from_str:: <BigUint >( "1" ) . get( ) . is_odd( ) ) ;
1452
+ assert ! ( FromStr :: from_str:: <BigUint >( "2" ) . get( ) . is_even( ) ) ;
1453
+ assert ! ( FromStr :: from_str:: <BigUint >( "1000" ) . get( ) . is_even( ) ) ;
1454
+ assert ! ( FromStr :: from_str:: <BigUint >( "1000000000000000000000" ) . get( ) . is_even( ) ) ;
1455
+ assert ! ( FromStr :: from_str:: <BigUint >( "1000000000000000000001" ) . get( ) . is_odd( ) ) ;
1456
+ assert ! ( ( BigUint :: from_uint( 1 ) << 64 ) . is_even( ) ) ;
1457
+ assert ! ( ( ( BigUint :: from_uint( 1 ) << 64 ) + BigUint :: from_uint( 1 ) ) . is_odd( ) ) ;
1458
+ }
1459
+
1449
1460
fn to_str_pairs ( ) -> ~[ ( BigUint , ~[ ( uint , ~str ) ] ) ] {
1450
1461
let bits = BigDigit :: bits;
1451
1462
~[ ( Zero :: zero ( ) , ~[
You can’t perform that action at this time.
0 commit comments