INNER CODE UNIT · Rust
serializing_to_vec
ZenGo-X/curv · src/arithmetic/mod.rs:103
fn serializing_to_vec() {
let n = BigInt::from(1_000_000_u32);
let v = n.to_bytes();
assert_eq!(v, b"\x0f\x42\x40");
}
#[test]
fn deserializing_from_bytes() {
let v: &[u8] = b"\x0f\x42\x40";
let n = BigInt::from_bytes(v);
assert_eq!(n, BigInt::from(1_000_000_u32))
}
#[test]
fn count_bits() {
let mut n = BigInt::one();
let mut expected_bits = 1_usize;
for _ in 0..100 {