mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-11 16:31:36 +01:00
Simplify the field and curve tests using macros (#90)
* Simplify the field and curve tests using macros * minor * remove redundant code Co-authored-by: weikeng <w.k@berkeley.edu>
This commit is contained in:
@@ -1,46 +1,9 @@
|
||||
use ark_ff::Field;
|
||||
use ark_std::rand::Rng;
|
||||
use ark_ff::{Field, One, SquareRootField, UniformRand, Zero};
|
||||
use ark_std::test_rng;
|
||||
|
||||
use crate::*;
|
||||
use ark_algebra_test_templates::{fields::*, generate_field_test};
|
||||
|
||||
use ark_algebra_test_templates::fields::*;
|
||||
use core::ops::{AddAssign, MulAssign, SubAssign};
|
||||
|
||||
#[test]
|
||||
fn test_fr() {
|
||||
let mut rng = test_rng();
|
||||
let a: Fr = rng.gen();
|
||||
let b: Fr = rng.gen();
|
||||
field_test(a, b);
|
||||
sqrt_field_test(a);
|
||||
primefield_test::<Fr>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fq() {
|
||||
let mut rng = test_rng();
|
||||
let a: Fq = rng.gen();
|
||||
let b: Fq = rng.gen();
|
||||
field_test(a, b);
|
||||
sqrt_field_test(a);
|
||||
primefield_test::<Fq>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fq2() {
|
||||
let mut rng = test_rng();
|
||||
let a: Fq2 = rng.gen();
|
||||
let b: Fq2 = rng.gen();
|
||||
field_test(a, b);
|
||||
sqrt_field_test(a);
|
||||
frobenius_test::<Fq2, _>(Fq::characteristic(), 13);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fq4() {
|
||||
let mut rng = test_rng();
|
||||
let a: Fq4 = rng.gen();
|
||||
let b: Fq4 = rng.gen();
|
||||
field_test(a, b);
|
||||
frobenius_test::<Fq4, _>(Fq::characteristic(), 13);
|
||||
}
|
||||
generate_field_test!(mnt4_753; fq2; fq4;);
|
||||
|
||||
Reference in New Issue
Block a user