mirror of
https://github.com/arnaucube/Nova.git
synced 2026-01-12 09:01:28 +01:00
[test-only] More genericity in tests (#171)
* refactor: make circuit tests generic wrt curves - Improve modularity by introducing generic `test_recursive_circuit_with` function in `src/circuit.rs` - Refactor `test_recursive_circuit` to utilize the new function - Implement type constraints for `test_recursive_circuit_with` function * refactor: make bellperson tests generic in type of group - Introduce `test_alloc_bit_with` function utilizing generic types - Adapt existing `test_alloc_bit` function to use the new `test_alloc_bit_with` function with correct types * refactor: make the nifs test generic in the type of group * refactor: make the ivc tests generic in the type of curve * refactor: simplify generics in tests * make the keccak tests generic * make the poseidon tests generic * make the spartan tests generic
This commit is contained in:
committed by
GitHub
parent
58fc746c0b
commit
54f758eef3
@@ -975,16 +975,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_ecc_circuit_ops() {
|
||||
test_ecc_circuit_ops_with::<pallas::Base, pallas::Scalar, pallas::Point, vesta::Point>();
|
||||
test_ecc_circuit_ops_with::<vesta::Base, vesta::Scalar, vesta::Point, pallas::Point>();
|
||||
test_ecc_circuit_ops_with::<pallas::Point, vesta::Point>();
|
||||
test_ecc_circuit_ops_with::<vesta::Point, pallas::Point>();
|
||||
}
|
||||
|
||||
fn test_ecc_circuit_ops_with<B, S, G1, G2>()
|
||||
fn test_ecc_circuit_ops_with<G1, G2>()
|
||||
where
|
||||
B: PrimeField,
|
||||
S: PrimeField,
|
||||
G1: Group<Base = B, Scalar = S>,
|
||||
G2: Group<Base = S, Scalar = B>,
|
||||
G1: Group<Base = <G2 as Group>::Scalar>,
|
||||
G2: Group<Base = <G1 as Group>::Scalar>,
|
||||
{
|
||||
// First create the shape
|
||||
let mut cs: ShapeCS<G2> = ShapeCS::new();
|
||||
@@ -1027,16 +1025,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_ecc_circuit_add_equal() {
|
||||
test_ecc_circuit_add_equal_with::<pallas::Base, pallas::Scalar, pallas::Point, vesta::Point>();
|
||||
test_ecc_circuit_add_equal_with::<vesta::Base, vesta::Scalar, vesta::Point, pallas::Point>();
|
||||
test_ecc_circuit_add_equal_with::<pallas::Point, vesta::Point>();
|
||||
test_ecc_circuit_add_equal_with::<vesta::Point, pallas::Point>();
|
||||
}
|
||||
|
||||
fn test_ecc_circuit_add_equal_with<B, S, G1, G2>()
|
||||
fn test_ecc_circuit_add_equal_with<G1, G2>()
|
||||
where
|
||||
B: PrimeField,
|
||||
S: PrimeField,
|
||||
G1: Group<Base = B, Scalar = S>,
|
||||
G2: Group<Base = S, Scalar = B>,
|
||||
G1: Group<Base = <G2 as Group>::Scalar>,
|
||||
G2: Group<Base = <G1 as Group>::Scalar>,
|
||||
{
|
||||
// First create the shape
|
||||
let mut cs: ShapeCS<G2> = ShapeCS::new();
|
||||
@@ -1083,17 +1079,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_ecc_circuit_add_negation() {
|
||||
test_ecc_circuit_add_negation_with::<pallas::Base, pallas::Scalar, pallas::Point, vesta::Point>(
|
||||
);
|
||||
test_ecc_circuit_add_negation_with::<vesta::Base, vesta::Scalar, vesta::Point, pallas::Point>();
|
||||
test_ecc_circuit_add_negation_with::<pallas::Point, vesta::Point>();
|
||||
test_ecc_circuit_add_negation_with::<vesta::Point, pallas::Point>();
|
||||
}
|
||||
|
||||
fn test_ecc_circuit_add_negation_with<B, S, G1, G2>()
|
||||
fn test_ecc_circuit_add_negation_with<G1, G2>()
|
||||
where
|
||||
B: PrimeField,
|
||||
S: PrimeField,
|
||||
G1: Group<Base = B, Scalar = S>,
|
||||
G2: Group<Base = S, Scalar = B>,
|
||||
G1: Group<Base = <G2 as Group>::Scalar>,
|
||||
G2: Group<Base = <G1 as Group>::Scalar>,
|
||||
{
|
||||
// First create the shape
|
||||
let mut cs: ShapeCS<G2> = ShapeCS::new();
|
||||
|
||||
Reference in New Issue
Block a user