]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a couple more cases to reach 100% coverage.
authorNick Mathewson <nickm@torproject.org>
Tue, 7 Mar 2017 17:30:13 +0000 (12:30 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 16 Mar 2017 18:38:29 +0000 (14:38 -0400)
src/test/test_consdiff.c

index b511d94ec3f0361e2b4d8be120d2bc5c5ccebfe1..bbe3532e5ac1767234f9aaef7c0cfae9674e5780 100644 (file)
@@ -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);