From 2bba2fc9f819d630b72f2c94d4e0bdd7741e7805 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 17 Oct 2024 16:23:57 -0500 Subject: [PATCH] Add more is_valid() test cases --- poc/tests/test_vdaf_poplar1.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/poc/tests/test_vdaf_poplar1.py b/poc/tests/test_vdaf_poplar1.py index d81cc8d1..7d887188 100644 --- a/poc/tests/test_vdaf_poplar1.py +++ b/poc/tests/test_vdaf_poplar1.py @@ -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.