INNER CODE UNIT · Rust

sample_on_zero_bits_returns_zero

ZenGo-X/curv · src/arithmetic/mod.rs:175

    fn sample_on_zero_bits_returns_zero() {
        assert_eq!(BigInt::sample(0), BigInt::zero());
        assert_eq!(BigInt::strict_sample(0), BigInt::zero());
    }

    #[test]
    fn fuzz_sample_returns_number_not_more_than_n_bits_length() {
        const BITS: usize = 100;

        for _ in 0..100 {
            let n = BigInt::sample(BITS);
            assert!(
                n.bit_length() <= BITS,
                "returned {} bits length number",
                n.bit_length()
            );
        }
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…