Add tests for UpperHex and LowerHex

This commit is contained in:
Colin Davidson 2016-01-17 12:13:45 -08:00
parent 04000436b1
commit d5d7c855b0
1 changed files with 18 additions and 0 deletions

View File

@ -3723,6 +3723,24 @@ mod biguint_tests {
}
}
#[test]
fn test_upper_hex() {
let a = BigUint::parse_bytes(b"A", 16).unwrap();
let hello = BigUint::parse_bytes("22405534230753963835153736737".as_bytes(), 10).unwrap();
assert_eq!(format!("{:x}", a), "a");
assert_eq!(format!("{:x}", hello), "48656c6c6f20776f726c6421");
}
#[test]
fn test_lower_hex() {
let a = BigUint::parse_bytes(b"A", 16).unwrap();
let hello = BigUint::parse_bytes("22405534230753963835153736737".as_bytes(), 10).unwrap();
assert_eq!(format!("{:X}", a), "A");
assert_eq!(format!("{:X}", hello), "48656C6C6F20776F726C6421");
}
#[test]
fn test_factor() {
fn factor(n: usize) -> BigUint {