aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_protover.c
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2018-08-18 18:15:59 +0000
committercypherpunks <cypherpunks@torproject.org>2018-08-19 02:21:46 +0000
commit6c0e7a9e1a43db307244c16b4290b292c035fa63 (patch)
treecbba0fd494ec34c8d03a8fe2dbd9bf164b473a18 /src/test/test_protover.c
parent4c355ff18544783a5a283f7660bcdca6cf93062b (diff)
downloadtor-6c0e7a9e1a43db307244c16b4290b292c035fa63.tar.gz
tor-6c0e7a9e1a43db307244c16b4290b292c035fa63.zip
test/protover: add double-voting test
Diffstat (limited to 'src/test/test_protover.c')
-rw-r--r--src/test/test_protover.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test_protover.c b/src/test/test_protover.c
index 92ead3ca37..17d620ca75 100644
--- a/src/test/test_protover.c
+++ b/src/test/test_protover.c
@@ -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");