Skip to content

Commit b8df358

Browse files
committed
---
yaml --- r: 59095 b: refs/heads/incoming c: 36771ef h: refs/heads/master i: 59093: 14cc799 59091: d39fe02 59087: f714978 v: v3
1 parent d05731b commit b8df358

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 1f62b23411abcfbe66eeea294f4258f1bb169e7d
9+
refs/heads/incoming: 36771ef60997b5882ad391839b5f7854d077cc42
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libstd/num/bigint.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ impl Integer for BigUint {
445445
if self.data.is_empty() {
446446
true
447447
} else {
448-
self.data.last().is_even()
448+
self.data[0].is_even()
449449
}
450450
}
451451

@@ -1446,6 +1446,17 @@ mod biguint_tests {
14461446
check(99, 17, 1683);
14471447
}
14481448

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+
14491460
fn to_str_pairs() -> ~[ (BigUint, ~[(uint, ~str)]) ] {
14501461
let bits = BigDigit::bits;
14511462
~[( Zero::zero(), ~[

0 commit comments

Comments
 (0)