INNER CODE UNIT · Rust

strict_sample_within_invalid_range_should_panic

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

    fn strict_sample_within_invalid_range_should_panic() {
        BigInt::sample_range(&BigInt::from(5), &BigInt::from(5));
    }

    #[test]
    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,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…