]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
test/protover: add double-voting test
authorcypherpunks <cypherpunks@torproject.org>
Sat, 18 Aug 2018 18:15:59 +0000 (18:15 +0000)
committercypherpunks <cypherpunks@torproject.org>
Sun, 19 Aug 2018 02:21:46 +0000 (02:21 +0000)
src/test/test_protover.c

index 92ead3ca37fd668431b1002816cf1f8a79eb8846..17d620ca75314c5828e940497f4ce1cec7d3c237 100644 (file)
@@ -144,6 +144,14 @@ test_protover_vote(void *arg)
   tt_str_op(result, OP_EQ, "");
   tor_free(result);
 
+  /* Don't count double-voting. */
+  smartlist_clear(lst);
+  smartlist_add(lst, (void*) "Foo=1 Foo=1");
+  smartlist_add(lst, (void*) "Bar=1-2,2-3");
+  result = protover_compute_vote(lst, 2);
+  tt_str_op(result, OP_EQ, "");
+  tor_free(result);
+
   /* Bad votes: the result must be empty */
   smartlist_clear(lst);
   smartlist_add(lst, (void*) "Faux=10-5");