Modify new test

This commit is contained in:
wborgeaud 2021-06-24 22:57:50 +02:00
parent 54a15c012c
commit 3ce9183970

View File

@ -371,6 +371,8 @@ mod tests {
use crate::field::extension_field::quartic::QuarticCrandallField;
use crate::field::field::Field;
use crate::fri::FriConfig;
use crate::gates::arithmetic::ArithmeticGate;
use crate::target::Target;
use crate::witness::PartialWitness;
#[test]
@ -385,15 +387,22 @@ mod tests {
let x = F::rand();
let y = F::rand();
let z = x / y;
let xt = builder.constant(x);
let yt = builder.constant(y);
let zt = builder.constant(z);
let comp_zt = builder.div_unsafe(xt, yt);
let mut pw = PartialWitness::new();
/// Computes x*x + 0*y = x^2.
let square_gate = builder.add_gate(ArithmeticGate::new(), vec![F::ONE, F::ZERO]);
pw.set_target(Target::wire(square_gate, 0), x);
pw.set_target(Target::wire(square_gate, 1), x);
let x2t = Target::wire(square_gate, ArithmeticGate::WIRE_OUTPUT);
let yt = Target::wire(square_gate, ArithmeticGate::WIRE_ADDEND);
pw.set_target(yt, y);
// Constant for x*x/y.
let zt = builder.constant(x * x / y);
// Computed division for x*x/y using the division gadget.
let comp_zt = builder.div_unsafe(x2t, yt);
builder.assert_equal(zt, comp_zt);
let data = builder.build();
let proof = data.prove(PartialWitness::new());
let proof = data.prove(pw);
}
#[test]