MCPcopy Create free account
hub / github.com/BitVM/BitVM / test_add1

Function test_add1

bitvm/src/bigint/add.rs:588–604  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

586
587 #[test]
588 fn test_add1() {
589 println!("U254.add1: {} bytes", U254::add1().len());
590 let mut prng = ChaCha20Rng::seed_from_u64(0);
591 for _ in 0..100 {
592 let a: BigUint = prng.sample(RandomBits::new(254));
593 let c: BigUint = (a.clone() + BigUint::one()).rem(BigUint::one().shl(254));
594
595 let script = script! {
596 { U254::push_u32_le(&a.to_u32_digits()) }
597 { U254::add1() }
598 { U254::push_u32_le(&c.to_u32_digits()) }
599 { U254::equalverify(1, 0) }
600 OP_TRUE
601 };
602 run(script);
603 }
604 }
605
606 #[test]
607 fn test_double() {

Callers

nothing calls this directly

Calls 2

runFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected