mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-27 14:13:46 +01:00
Fix the remaining curve and field tests (#118)
* push * push * cargo ready Co-authored-by: onewayfunc <onewayfunc@gmail.com>
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
use ark_algebra_test_templates::{
|
||||
fields::*, generate_field_serialization_test, generate_field_test,
|
||||
};
|
||||
use ark_algebra_test_templates::*;
|
||||
use ark_ff::{
|
||||
biginteger::{BigInt, BigInteger, BigInteger384},
|
||||
fields::{FftField, Field, Fp6Config, PrimeField},
|
||||
One, UniformRand, Zero,
|
||||
Fp384, One, UniformRand, Zero,
|
||||
};
|
||||
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
|
||||
use ark_std::{rand::Rng, test_rng};
|
||||
use core::{
|
||||
use ark_std::{
|
||||
cmp::Ordering,
|
||||
ops::{AddAssign, MulAssign, SubAssign},
|
||||
ops::{AddAssign, MulAssign},
|
||||
test_rng,
|
||||
};
|
||||
|
||||
use crate::{Fq, Fq12, Fq2, Fq6, Fq6Config, FqConfig, Fr, FrConfig};
|
||||
use crate::{Fq, Fq12, Fq2, Fq6, Fq6Config, Fr};
|
||||
|
||||
generate_field_test!(bls12_377; fq2; fq6; fq12; mont(6, 4); );
|
||||
generate_field_serialization_test!(bls12_377; fq2; fq6; fq12;);
|
||||
test_field!(fr; Fr; mont_prime_field);
|
||||
test_field!(fq; Fq; mont_prime_field);
|
||||
test_field!(fq2; Fq2);
|
||||
test_field!(fq6; Fq6);
|
||||
test_field!(fq12; Fq12);
|
||||
|
||||
#[test]
|
||||
fn test_fq_repr_from() {
|
||||
@@ -85,7 +85,7 @@ fn test_fq_ordering() {
|
||||
// BigInteger384's ordering is well-tested, but we still need to make sure the
|
||||
// Fq elements aren't being compared in Montgomery form.
|
||||
for i in 0..100u64 {
|
||||
assert!(Fq::from(BigInteger384::from(i + 1)) > Fq::from(BigInteger384::from(i)));
|
||||
assert!(Fq::from(Fp384::from(i + 1)) > Fq::from(Fp384::from(i)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,14 +95,8 @@ fn test_fq_legendre() {
|
||||
|
||||
assert_eq!(QuadraticResidue, Fq::one().legendre());
|
||||
assert_eq!(Zero, Fq::zero().legendre());
|
||||
assert_eq!(
|
||||
QuadraticResidue,
|
||||
Fq::from(BigInteger384::from(4u64)).legendre()
|
||||
);
|
||||
assert_eq!(
|
||||
QuadraticNonResidue,
|
||||
Fq::from(BigInteger384::from(5u64)).legendre()
|
||||
);
|
||||
assert_eq!(QuadraticResidue, Fq::from(Fp384::from(4u64)).legendre());
|
||||
assert_eq!(QuadraticNonResidue, Fq::from(Fp384::from(5u64)).legendre());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user