mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-27 22:23:48 +01:00
Add Pallas and Vesta curves (#21)
Co-authored-by: Ying Tong Lai <yingtong@electriccoin.co> Co-authored-by: Daira Hopwood <daira@jacaranda.org> Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu> Co-authored-by: therealyingtong <yingtong@z.cash>
This commit is contained in:
39
pallas/src/curves/tests.rs
Normal file
39
pallas/src/curves/tests.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
#![allow(unused_imports)]
|
||||
use ark_ff::{
|
||||
fields::{Field, FpParameters, PrimeField, SquareRootField},
|
||||
One, Zero,
|
||||
};
|
||||
use ark_serialize::CanonicalSerialize;
|
||||
use ark_std::test_rng;
|
||||
|
||||
use ark_ec::{models::SWModelParameters, AffineCurve, PairingEngine, ProjectiveCurve};
|
||||
use core::ops::{AddAssign, MulAssign};
|
||||
use rand::Rng;
|
||||
|
||||
use crate::{Affine, PallasParameters, Projective};
|
||||
|
||||
use ark_curve_tests::{
|
||||
curves::{curve_tests, sw_tests},
|
||||
groups::group_test,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_projective_curve() {
|
||||
curve_tests::<Projective>();
|
||||
sw_tests::<PallasParameters>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_projective_group() {
|
||||
let mut rng = test_rng();
|
||||
let a: Projective = rng.gen();
|
||||
let b: Projective = rng.gen();
|
||||
group_test(a, b);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_generator() {
|
||||
let generator = Affine::prime_subgroup_generator();
|
||||
assert!(generator.is_on_curve());
|
||||
assert!(generator.is_in_correct_subgroup_assuming_on_curve());
|
||||
}
|
||||
Reference in New Issue
Block a user