You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
833 B

use ark_r1cs_std::{
alloc::AllocVar,
fields::nonnative::{NonNativeFieldMulResultVar, NonNativeFieldVar},
R1CSVar,
};
use ark_relations::r1cs::ConstraintSystem;
use ark_std::UniformRand;
#[test]
fn from_test() {
type F = ark_bls12_377::Fr;
type CF = ark_bls12_377::Fq;
let mut rng = ark_std::test_rng();
let cs = ConstraintSystem::<CF>::new_ref();
let f = F::rand(&mut rng);
let f_var = NonNativeFieldVar::<F, CF>::new_input(cs.clone(), || Ok(f)).unwrap();
let f_var_converted = NonNativeFieldMulResultVar::<F, CF>::from(&f_var);
let f_var_converted_reduced = f_var_converted.reduce().unwrap();
let f_var_value = f_var.value().unwrap();
let f_var_converted_reduced_value = f_var_converted_reduced.value().unwrap();
assert_eq!(f_var_value, f_var_converted_reduced_value);
}