mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-02-06 06:53:21 +00:00
Modify new test
This commit is contained in:
parent
54a15c012c
commit
3ce9183970
@ -371,6 +371,8 @@ mod tests {
|
|||||||
use crate::field::extension_field::quartic::QuarticCrandallField;
|
use crate::field::extension_field::quartic::QuarticCrandallField;
|
||||||
use crate::field::field::Field;
|
use crate::field::field::Field;
|
||||||
use crate::fri::FriConfig;
|
use crate::fri::FriConfig;
|
||||||
|
use crate::gates::arithmetic::ArithmeticGate;
|
||||||
|
use crate::target::Target;
|
||||||
use crate::witness::PartialWitness;
|
use crate::witness::PartialWitness;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -385,15 +387,22 @@ mod tests {
|
|||||||
|
|
||||||
let x = F::rand();
|
let x = F::rand();
|
||||||
let y = F::rand();
|
let y = F::rand();
|
||||||
let z = x / y;
|
let mut pw = PartialWitness::new();
|
||||||
let xt = builder.constant(x);
|
/// Computes x*x + 0*y = x^2.
|
||||||
let yt = builder.constant(y);
|
let square_gate = builder.add_gate(ArithmeticGate::new(), vec![F::ONE, F::ZERO]);
|
||||||
let zt = builder.constant(z);
|
pw.set_target(Target::wire(square_gate, 0), x);
|
||||||
let comp_zt = builder.div_unsafe(xt, yt);
|
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);
|
builder.assert_equal(zt, comp_zt);
|
||||||
|
|
||||||
let data = builder.build();
|
let data = builder.build();
|
||||||
let proof = data.prove(PartialWitness::new());
|
let proof = data.prove(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user