#[test]
fn test_not() {
for &(ref a, ref not) in NOT_VALUES.iter() { let a = a.to_bigint().unwrap(); let not = not.to_bigint().unwrap();
// sanity check for tests that fit in i64 iflet (Some(prim_a), Some(prim_not)) = (a.to_i64(), not.to_i64()) {
assert_eq!(!prim_a, prim_not);
}
assert_eq!(!a.clone(), not, "!{:x}", a);
assert_eq!(!not.clone(), a, "!{:x}", not);
}
}
#[test]
fn test_not_i64() {
for &prim_a in I64_VALUES.iter() { let a = prim_a.to_bigint().unwrap(); let not = (!prim_a).to_bigint().unwrap();
assert_eq!(!a.clone(), not, "!{:x}", a);
}
}
#[test]
fn test_bitwise() {
for &(ref a, ref b, ref and, ref or, ref xor) in BITWISE_VALUES.iter() { let a = a.to_bigint().unwrap(); let b = b.to_bigint().unwrap(); let and = and.to_bigint().unwrap(); let or = or.to_bigint().unwrap(); let xor = xor.to_bigint().unwrap();
#[test]
fn test_bitwise_i64() {
for &prim_a in I64_VALUES.iter() { let a = prim_a.to_bigint().unwrap();
for &prim_b in I64_VALUES.iter() { let b = prim_b.to_bigint().unwrap(); let and = (prim_a & prim_b).to_bigint().unwrap(); let or = (prim_a | prim_b).to_bigint().unwrap(); let xor = (prim_a ^ prim_b).to_bigint().unwrap();
assert_eq!(a.clone() & &b, and, "{:x} & {:x}", a, b);
assert_eq!(a.clone() | &b, or, "{:x} | {:x}", a, b);
assert_eq!(a.clone() ^ &b, xor, "{:x} ^ {:x}", a, b);
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.