Skip to content

Commit 2eb9c40

Browse files
committed
fix(tests): clean up test_validation_criteria
1 parent 705dbf8 commit 2eb9c40

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

src/tests/test_validation_criteria.rs

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,6 @@ mod instance_validation {
5858
assert!(result.is_err())
5959
}
6060

61-
#[test]
62-
fn test_empty_instance() {
63-
let rng = &mut rand::thread_rng();
64-
// Create an empty linear relation
65-
let relation = LinearRelation::<G>::new();
66-
67-
// Try to convert empty relation to canonical form
68-
let result = relation.into_nizk(b"test empty instance");
69-
70-
// Empty relations should be accepted as valid, and the proof be the empty string.
71-
assert!(result.is_ok());
72-
let proof = result.unwrap().prove_batchable(&vec![], rng);
73-
assert!(proof.is_ok());
74-
assert!(proof.unwrap().is_empty());
75-
}
76-
77-
/// Test function with the requested LinearRelation code
7861
#[test]
7962
#[allow(non_snake_case)]
8063
pub fn test_degenerate_equation() {
@@ -86,7 +69,6 @@ mod instance_validation {
8669
let x = relation.allocate_scalar();
8770
let B = relation.allocate_element();
8871
let _eq = relation.allocate_eq((x + (-Scalar::ONE)) * B + (-B));
89-
9072
assert!(CanonicalLinearRelation::try_from(&relation).is_err());
9173

9274
// 2. because the equation is void
@@ -102,25 +84,19 @@ mod instance_validation {
10284
fn test_inconsistent_equation_count() {
10385
// Create a relation with mismatched equations and image elements
10486
let mut relation = LinearRelation::<G>::new();
105-
106-
// Allocate elements
10787
let [var_x] = relation.allocate_scalars();
10888
let [var_g, var_h] = relation.allocate_elements::<2>();
109-
110-
// Set elements
11189
relation.set_elements([
11290
(var_g, G::generator()),
11391
(var_h, G::generator() * Scalar::from(2u64)),
11492
]);
11593

11694
// Add two equations but only one image element
117-
relation.linear_map.linear_combinations.push(
118-
crate::linear_relation::LinearCombination::from(vec![(var_x, var_g)]),
119-
);
120-
relation.linear_map.linear_combinations.push(
121-
crate::linear_relation::LinearCombination::from(vec![(var_x, var_h)]),
122-
);
123-
relation.image.push(var_g); // Only one image element for two equations
95+
let var_img_1 = relation.allocate_eq(var_x * var_g + var_h);
96+
relation.allocate_eq(var_x * var_h + var_g);
97+
relation.set_element(var_g, G::generator());
98+
relation.set_element(var_h, G::generator() * Scalar::from(2));
99+
relation.set_element(var_img_1, G::generator() * Scalar::from(3));
124100

125101
// Try to convert - should fail due to inconsistency
126102
let result = CanonicalLinearRelation::try_from(&relation);

0 commit comments

Comments
 (0)