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

Function test_roll

bitvm/src/bigint/std.rs:818–851  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

816
817 #[test]
818 fn test_roll() {
819 const N_U30_LIMBS: u32 = 9;
820
821 let mut prng = ChaCha20Rng::seed_from_u64(0);
822
823 for _ in 0..50 {
824 let mut v = vec![];
825 for _ in 0..N_U30_LIMBS {
826 v.push(prng.gen::<i32>());
827 }
828 for _ in 0..N_U30_LIMBS {
829 v.push(prng.gen::<i32>());
830 }
831
832 let mut expected = vec![];
833 for i in 0..N_U30_LIMBS {
834 expected.push(v[i as usize]);
835 }
836
837 let script = script! {
838 for i in 0..N_U30_LIMBS * 2 {
839 { v[i as usize] }
840 }
841 { U254::roll(1) }
842 for i in 0..N_U30_LIMBS {
843 { expected[(N_U30_LIMBS - 1 - i) as usize] }
844 OP_EQUALVERIFY
845 }
846 { U254::drop() }
847 OP_TRUE
848 };
849 run(script);
850 }
851 }
852
853 #[test]
854 fn test_copy_zip() {

Callers

nothing calls this directly

Calls 2

runFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected