Skip to content

Commit

Permalink
Add more is_valid() test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
divergentdave committed Oct 17, 2024
1 parent 9c76459 commit 2bba2fc
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion poc/tests/test_vdaf_poplar1.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,26 @@ def test_is_valid(self) -> None:
]
self.assertFalse(cls.is_valid(agg_params[1], list(agg_params[:1])))

# Test `is_valid` rejects unsorted prefixes.
# Test `is_valid` rejects unsorted and duplicate prefixes.
agg_params = [
(0, (int_to_bit_string(0b1, 1), int_to_bit_string(0b0, 1))),
]
self.assertFalse(cls.is_valid(agg_params[0], list(agg_params)))
agg_params = [
(2, (
int_to_bit_string(0b100, 3),
int_to_bit_string(0b011, 3),
)),
]
self.assertFalse(cls.is_valid(agg_params[0], list(agg_params)))
agg_params = [
(2, (
int_to_bit_string(0b000, 3),
int_to_bit_string(0b010, 3),
int_to_bit_string(0b010, 3),
)),
]
self.assertFalse(cls.is_valid(agg_params[0], list(agg_params)))

def test_aggregation_parameter_encoding(self) -> None:
# Test aggregation parameter encoding.
Expand Down

0 comments on commit 2bba2fc

Please sign in to comment.