aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_consdiff.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-03-07 12:30:13 -0500
committerNick Mathewson <nickm@torproject.org>2017-03-16 14:38:29 -0400
commitd6594bfa8c56a6a6896c8ca8761e39f0c3dd59a2 (patch)
tree5d3a9fc9157595bd6b9ea70d5613fe7f57920159 /src/test/test_consdiff.c
parentc86e77ac20997282ca007ac7347e9910f55f880e (diff)
downloadtor-d6594bfa8c56a6a6896c8ca8761e39f0c3dd59a2.tar.gz
tor-d6594bfa8c56a6a6896c8ca8761e39f0c3dd59a2.zip
Add a couple more cases to reach 100% coverage.
Diffstat (limited to 'src/test/test_consdiff.c')
-rw-r--r--src/test/test_consdiff.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test_consdiff.c b/src/test/test_consdiff.c
index b511d94ec3..bbe3532e5a 100644
--- a/src/test/test_consdiff.c
+++ b/src/test/test_consdiff.c
@@ -449,6 +449,25 @@ test_consdiff_gen_ed_diff(void *arg)
"because the target consensus doesn't have its router entries sorted "
"properly.");
+ /* Same as the two above, but with the reversed thing immediately after a
+ match. (The code handles this differently) */
+ smartlist_del(cons1, 0);
+ smartlist_add(cons1, (char*)"r name aaaaaaaaaaaaaaaaaaaaaaaaaaa etc");
+
+ mock_clean_saved_logs();
+ diff = gen_ed_diff(cons1, cons2);
+ tt_ptr_op(NULL, OP_EQ, diff);
+ expect_single_log_msg_containing("Refusing to generate consensus diff "
+ "because the base consensus doesn't have its router entries sorted "
+ "properly.");
+
+ mock_clean_saved_logs();
+ diff = gen_ed_diff(cons2, cons1);
+ tt_ptr_op(NULL, OP_EQ, diff);
+ expect_single_log_msg_containing("Refusing to generate consensus diff "
+ "because the target consensus doesn't have its router entries sorted "
+ "properly.");
+
/* Identity hashes are repeated, return NULL. */
smartlist_clear(cons1);