|
@ -365,10 +365,9 @@ mod test { |
|
|
use crate::{prelude::*, ToConstraintFieldGadget, Vec};
|
|
|
use crate::{prelude::*, ToConstraintFieldGadget, Vec};
|
|
|
use ark_ff::{FpParameters, PrimeField, ToConstraintField};
|
|
|
use ark_ff::{FpParameters, PrimeField, ToConstraintField};
|
|
|
use ark_relations::r1cs::{ConstraintSystem, SynthesisError};
|
|
|
use ark_relations::r1cs::{ConstraintSystem, SynthesisError};
|
|
|
|
|
|
use ark_std::rand::distributions::Uniform;
|
|
|
|
|
|
use ark_std::rand::Rng;
|
|
|
use ark_test_curves::bls12_381::Fr;
|
|
|
use ark_test_curves::bls12_381::Fr;
|
|
|
use rand::distributions::Uniform;
|
|
|
|
|
|
use rand::{Rng, SeedableRng};
|
|
|
|
|
|
use rand_xorshift::XorShiftRng;
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_uint8_from_bits_to_bits() -> Result<(), SynthesisError> {
|
|
|
fn test_uint8_from_bits_to_bits() -> Result<(), SynthesisError> {
|
|
@ -407,7 +406,7 @@ mod test { |
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_uint8_from_bits() -> Result<(), SynthesisError> {
|
|
|
fn test_uint8_from_bits() -> Result<(), SynthesisError> {
|
|
|
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
|
|
|
|
|
|
|
|
let mut rng = ark_std::test_rng();
|
|
|
|
|
|
|
|
|
for _ in 0..1000 {
|
|
|
for _ in 0..1000 {
|
|
|
let v = (0..8)
|
|
|
let v = (0..8)
|
|
@ -438,7 +437,7 @@ mod test { |
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_uint8_xor() -> Result<(), SynthesisError> {
|
|
|
fn test_uint8_xor() -> Result<(), SynthesisError> {
|
|
|
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
|
|
|
|
|
|
|
|
let mut rng = ark_std::test_rng();
|
|
|
|
|
|
|
|
|
for _ in 0..1000 {
|
|
|
for _ in 0..1000 {
|
|
|
let cs = ConstraintSystem::<Fr>::new_ref();
|
|
|
let cs = ConstraintSystem::<Fr>::new_ref();
|
|
@ -475,7 +474,7 @@ mod test { |
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_uint8_to_constraint_field() -> Result<(), SynthesisError> {
|
|
|
fn test_uint8_to_constraint_field() -> Result<(), SynthesisError> {
|
|
|
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
|
|
|
|
|
|
|
|
let mut rng = ark_std::test_rng();
|
|
|
let max_size = (<Fr as PrimeField>::Params::CAPACITY / 8) as usize;
|
|
|
let max_size = (<Fr as PrimeField>::Params::CAPACITY / 8) as usize;
|
|
|
|
|
|
|
|
|
let modes = [Input, Witness, Constant];
|
|
|
let modes = [Input, Witness, Constant];
|
|
@ -506,7 +505,7 @@ mod test { |
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_uint8_random_access() {
|
|
|
fn test_uint8_random_access() {
|
|
|
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
|
|
|
|
|
|
|
|
let mut rng = ark_std::test_rng();
|
|
|
|
|
|
|
|
|
for _ in 0..100 {
|
|
|
for _ in 0..100 {
|
|
|
let cs = ConstraintSystem::<Fr>::new_ref();
|
|
|
let cs = ConstraintSystem::<Fr>::new_ref();
|
|
|