]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix numerous type errors in the unit tests
authorNick Mathewson <nickm@torproject.org>
Thu, 8 May 2014 17:08:13 +0000 (13:08 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 8 May 2014 17:08:13 +0000 (13:08 -0400)
Remove tinytest casts that were suppressing them.

Fix for #11825.

src/ext/tinytest_macros.h
src/test/test_buffers.c
src/test/test_circuitlist.c
src/test/test_extorport.c

index db2dfcbe6bc31ac5679e8173f6ef20f00dc52f09..c3728d1fdd61daeb016970abb45c5b0b056c0e7c 100644 (file)
 #define tt_assert_test_fmt_type(a,b,str_test,type,test,printf_type,printf_fmt, \
     setup_block,cleanup_block,die_on_fail)                             \
        TT_STMT_BEGIN                                                   \
-       type val1_ = (type)(a);                                         \
-       type val2_ = (type)(b);                                         \
+       type val1_ = (a);                                               \
+       type val2_ = (b);                                               \
        int tt_status_ = (test);                                        \
        if (!tt_status_ || tinytest_get_verbosity_()>1) {               \
                printf_type print_;                                     \
            (val1_ op val2_),"%lu",TT_EXIT_TEST_FUNCTION)
 
 #define tt_ptr_op(a,op,b)                                              \
-       tt_assert_test_type(a,b,#a" "#op" "#b,void*,                    \
+       tt_assert_test_type(a,b,#a" "#op" "#b,const void*,              \
            (val1_ op val2_),"%p",TT_EXIT_TEST_FUNCTION)
 
 #define tt_str_op(a,op,b)                                              \
 
 #define tt_mem_op(expr1, op, expr2, len)                                \
   tt_assert_test_fmt_type(expr1,expr2,#expr1" "#op" "#expr2,            \
-                         const char *,                                 \
+                         const void *,                                 \
                          (val1_ && val2_ && memcmp(val1_, val2_, len) op 0), \
                          char *, "%s",                                 \
                          { print_ = tinytest_format_hex_(value_, (len)); }, \
            (val1_ op val2_),"%lu",(void)0)
 
 #define tt_want_ptr_op(a,op,b)                                         \
-       tt_assert_test_type(a,b,#a" "#op" "#b,void*,                    \
+  tt_assert_test_type(a,b,#a" "#op" "#b,const void*,                   \
            (val1_ op val2_),"%p",(void)0)
 
 #define tt_want_str_op(a,op,b)                                         \
index cb78a4bb549e795db69662fb0ad48bc37b65c51c..78b3aead609412c52fc71f16a642d0e4c94d8206 100644 (file)
@@ -222,7 +222,7 @@ test_buffer_pullup(void *arg)
   buf_pullup(buf, 16, 1);
   buf_get_first_chunk_data(buf, &cp, &sz);
   tt_ptr_op(cp, ==, NULL);
-  tt_ptr_op(sz, ==, 0);
+  tt_uint_op(sz, ==, 0);
 
   /* Let's make sure nothing got allocated */
   tt_int_op(buf_get_total_allocation(), ==, 0);
index 7b7d4153e0fd0ff10b759527c429518586cfd531..b19edd1fd4edc471589d91e8e2ca9fb73100a7c3 100644 (file)
@@ -53,7 +53,7 @@ circuitmux_detach_mock(circuitmux_t *cmux, circuit_t *circ)
     tt_int_op(cam.ncalls, ==, 1);                \
     tt_ptr_op(cam.cmux, ==, (mux_));             \
     tt_ptr_op(cam.circ, ==, (circ_));            \
-    tt_ptr_op(cam.dir, ==, (dir_));              \
+    tt_int_op(cam.dir, ==, (dir_));              \
     memset(&cam, 0, sizeof(cam));                \
   } while (0)
 
index d47792fdbb835ea5679a0ee46e9e9306c773c1cb..64ed24eeeb3e4ed147eae54958f4d59c438b581a 100644 (file)
@@ -338,7 +338,7 @@ test_ext_or_cookie_auth_testvec(void *arg)
             handle_client_auth_nonce(client_nonce, 32, &client_hash, &reply,
                                      &reply_len));
   tt_ptr_op(reply, !=, NULL );
-  tt_ptr_op(reply_len, ==, 64);
+  tt_uint_op(reply_len, ==, 64);
   test_memeq(reply+32, "te road There is always another ", 32);
   /* HMACSHA256("Gliding wrapt in a brown mantle,"
    *     "ExtORPort authentication server-to-client hash"