mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-11 02:03:07 +00:00
sub test
This commit is contained in:
parent
72134a3eb0
commit
c664eba3e6
@ -151,6 +151,30 @@ mod tests {
|
||||
verify(proof, &data.verifier_only, &data.common)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nonnative_sub() -> Result<()> {
|
||||
type FF = Secp256K1Base;
|
||||
let x_ff = FF::rand();
|
||||
let y_ff = FF::rand();
|
||||
let diff_ff = x_ff - y_ff;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
let x = builder.constant_ff(x_ff);
|
||||
let y = builder.constant_ff(y_ff);
|
||||
let diff = builder.sub_nonnative(&x, &y);
|
||||
|
||||
let diff_expected = builder.constant_ff(diff_ff);
|
||||
builder.connect_ff_reduced(&diff, &diff_expected);
|
||||
|
||||
let data = builder.build();
|
||||
let proof = data.prove(pw).unwrap();
|
||||
verify(proof, &data.verifier_only, &data.common)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nonnative_mul() -> Result<()> {
|
||||
type FF = Secp256K1Base;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user