[tor-commits] [tor/master] Fix unearthed problems in unit tests

nickm at torproject.org nickm at torproject.org
Thu May 8 17:16:11 UTC 2014


commit df684789380a51c9de14120160adfb796d891436
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu May 8 13:16:08 2014 -0400

    Fix unearthed problems in unit tests
---
 src/test/test_buffers.c |    3 +--
 src/test/test_util.c    |    8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c
index 78b3aea..61ac5bc 100644
--- a/src/test/test_buffers.c
+++ b/src/test/test_buffers.c
@@ -663,8 +663,6 @@ test_buffers_zlib_fin_with_nil(void *arg)
 static void
 test_buffers_zlib_fin_at_chunk_end(void *arg)
 {
-  (void) arg;
-
   char *msg = NULL;
   char *contents = NULL;
   char *expanded = NULL;
@@ -672,6 +670,7 @@ test_buffers_zlib_fin_at_chunk_end(void *arg)
   tor_zlib_state_t *zlib_state = NULL;
   size_t out_len, in_len;
   size_t sz, headerjunk;
+  (void) arg;
 
   buf = buf_new_with_capacity(128); /* will round up */
   sz = buf_get_default_chunk_size(buf);
diff --git a/src/test/test_util.c b/src/test/test_util.c
index e21f5aa..2c29429 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -1291,10 +1291,10 @@ test_util_pow2(void)
   test_eq(round_to_power_of_2(120), 128);
   test_eq(round_to_power_of_2(128), 128);
   test_eq(round_to_power_of_2(130), 128);
-  test_eq(round_to_power_of_2(U64_LITERAL(40000000000000000)),
-          U64_LITERAL(1)<<55);
-  test_eq(round_to_power_of_2(U64_LITERAL(0xffffffffffffffff)),
-          U64_LITERAL(1)<<63);
+  test_assert(round_to_power_of_2(U64_LITERAL(40000000000000000)) ==
+              U64_LITERAL(1)<<55);
+  test_assert(round_to_power_of_2(U64_LITERAL(0xffffffffffffffff)) ==
+              U64_LITERAL(1)<<63);
   test_eq(round_to_power_of_2(0), 1);
   test_eq(round_to_power_of_2(1), 1);
   test_eq(round_to_power_of_2(2), 2);



More information about the tor-commits mailing list