Skip to content

Commit

Permalink
chore: tests imports
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnevadoc committed Dec 3, 2024
1 parent 13a4a54 commit 54ed9c9
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/bls12381/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ pub(crate) fn hash_to_curve<'a>(
#[cfg(test)]
mod test {
use crate::arithmetic::CurveEndo;
use crate::serde::SerdeObject;
use crate::tests::curve::TestH2C;
use group::UncompressedEncoding;
use rand_core::OsRng;

use super::*;
crate::curve_testing_suite!(G1);
Expand Down
2 changes: 2 additions & 0 deletions src/bls12381/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ pub(crate) fn hash_to_curve<'a>(
mod test {
use super::*;
use crate::arithmetic::CurveEndo;
use crate::serde::SerdeObject;
use group::UncompressedEncoding;
use rand_core::OsRng;

crate::curve_testing_suite!(G2);
crate::curve_testing_suite!(G2, "endo_consistency");
Expand Down
2 changes: 2 additions & 0 deletions src/bn256/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ mod test {
use crate::tests::curve::TestH2C;

use super::*;
use crate::serde::SerdeObject;
use group::UncompressedEncoding;
use rand_core::OsRng;

crate::curve_testing_suite!(G2, "clear_cofactor");
crate::curve_testing_suite!(G1, G2);
Expand Down
2 changes: 2 additions & 0 deletions src/grumpkin/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ impl G1 {
#[cfg(test)]
mod test {
use super::*;
use crate::serde::SerdeObject;
use group::UncompressedEncoding;
use rand_core::OsRng;
crate::curve_testing_suite!(G1);
crate::curve_testing_suite!(G1, "endo_consistency");
crate::curve_testing_suite!(G1, "endo");
Expand Down
2 changes: 2 additions & 0 deletions src/pluto_eris/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ new_curve_impl!(
#[cfg(test)]
mod test {
use super::*;
use crate::serde::SerdeObject;
use group::UncompressedEncoding;
use rand_core::OsRng;

crate::curve_testing_suite!(G2, "clear_cofactor");
crate::curve_testing_suite!(G1, Eris, G2);
Expand Down
6 changes: 4 additions & 2 deletions src/secp256k1/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,12 @@ pub(crate) fn iso_map(x: Fp, y: Fp, z: Fp) -> Secp256k1 {

#[cfg(test)]
mod test {
use crate::tests::curve::TestH2C;

use super::*;
use crate::serde::SerdeObject;
use crate::tests::curve::TestH2C;
use group::UncompressedEncoding;
use rand_core::OsRng;

crate::curve_testing_suite!(Secp256k1);
crate::curve_testing_suite!(Secp256k1, "endo_consistency");
crate::curve_testing_suite!(Secp256k1, "ecdsa_example");
Expand Down
2 changes: 2 additions & 0 deletions src/secp256r1/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ mod test {
use crate::tests::curve::TestH2C;

use super::*;
use crate::serde::SerdeObject;
use group::UncompressedEncoding;
use rand_core::OsRng;
crate::curve_testing_suite!(Secp256r1);
crate::curve_testing_suite!(Secp256r1, "ecdsa_example");
crate::curve_testing_suite!(
Expand Down
3 changes: 3 additions & 0 deletions src/secq256k1/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ impl Secq256k1 {
#[cfg(test)]
mod test {
use super::*;
use crate::serde::SerdeObject;
use group::UncompressedEncoding;
use rand_core::OsRng;

crate::curve_testing_suite!(Secq256k1);
crate::curve_testing_suite!(Secq256k1, "endo_consistency");
crate::curve_testing_suite!(
Expand Down
4 changes: 3 additions & 1 deletion src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub(crate) enum CompressedFlagConfig {
Extra, // sign: 0 identity: 1

// Pasta curves should be encoded with
// SingleSpare, // sign: 0
SingleSpare, // sign: 0

// BN254 curve should be encoded with
TwoSpare, // sign: 0, identity: 1
Expand Down Expand Up @@ -237,6 +237,7 @@ where
fn pos_sign() -> u8 {
match Self::CONFIG {
CompressedFlagConfig::Extra => 0,
CompressedFlagConfig::SingleSpare => 0,
CompressedFlagConfig::TwoSpare => 0,
CompressedFlagConfig::ThreeSpare => 2,
}
Expand All @@ -252,6 +253,7 @@ where
fn pos_idetity() -> Option<u8> {
match Self::CONFIG {
CompressedFlagConfig::Extra => Some(1),
CompressedFlagConfig::SingleSpare => None,
CompressedFlagConfig::TwoSpare => Some(1),
CompressedFlagConfig::ThreeSpare => Some(1),
}
Expand Down
5 changes: 0 additions & 5 deletions src/tests/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,6 @@ macro_rules! curve_testing_suite {
}
}

use $crate::ff::Field;
use $crate::group::prime::PrimeCurveAffine;
use $crate::{group::GroupEncoding, serde::SerdeObject};
use $crate::{CurveAffine, CurveExt};
use rand_core::OsRng;


#[test]
Expand Down

0 comments on commit 54ed9c9

Please sign in to comment.