File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
branches/incoming/src/libstd/num Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
- refs/heads/incoming: 1f62b23411abcfbe66eeea294f4258f1bb169e7d
9
+ refs/heads/incoming: 36771ef60997b5882ad391839b5f7854d077cc42
10
10
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
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