[tor-commits] [tor/master] apply ahf's test_assert_int.cocci

nickm at torproject.org nickm at torproject.org
Thu Aug 24 20:11:49 UTC 2017


commit 047790a25343e3857fb95e8874755440da30a982
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Aug 24 15:49:59 2017 -0400

    apply ahf's test_assert_int.cocci
---
 src/test/test.c               |  23 +--
 src/test/test_addr.c          |  36 ++--
 src/test/test_address.c       |  10 +-
 src/test/test_channel.c       |   2 +-
 src/test/test_channeltls.c    |   2 +-
 src/test/test_config.c        | 386 +++++++++++++++++++++---------------------
 src/test/test_connection.c    | 272 +++++++++++++----------------
 src/test/test_controller.c    |   8 +-
 src/test/test_crypto.c        |  24 +--
 src/test/test_crypto_slow.c   |   2 +-
 src/test/test_dir.c           | 332 +++++++++++++++++-------------------
 src/test/test_entrynodes.c    |  56 +++---
 src/test/test_helpers.c       |   4 +-
 src/test/test_hs.c            |  88 +++++-----
 src/test/test_options.c       |   8 +-
 src/test/test_policy.c        | 239 +++++++++++++-------------
 src/test/test_pt.c            |  32 ++--
 src/test/test_routerkeys.c    |  30 ++--
 src/test/test_routerlist.c    |  28 +--
 src/test/test_shared_random.c |   8 +-
 src/test/test_socks.c         |  42 +++--
 21 files changed, 789 insertions(+), 843 deletions(-)

diff --git a/src/test/test.c b/src/test/test.c
index f775102ba..3a19f3779 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -409,11 +409,11 @@ test_circuit_timeout(void *arg)
   } while (fabs(circuit_build_times_cdf(&initial, timeout0) -
                 circuit_build_times_cdf(&initial, timeout1)) > 0.02);
 
-  tt_assert(estimate.total_build_times <= CBT_NCIRCUITS_TO_OBSERVE);
+  tt_int_op(estimate.total_build_times, OP_LE, CBT_NCIRCUITS_TO_OBSERVE);
 
   circuit_build_times_update_state(&estimate, state);
   circuit_build_times_free_timeouts(&final);
-  tt_assert(circuit_build_times_parse_state(&final, state) == 0);
+  tt_int_op(circuit_build_times_parse_state(&final, state), OP_EQ, 0);
 
   circuit_build_times_update_alpha(&final);
   timeout2 = circuit_build_times_calculate_timeout(&final,
@@ -491,7 +491,7 @@ test_circuit_timeout(void *arg)
       }
     }
 
-    tt_assert(estimate.liveness.after_firsthop_idx == 0);
+    tt_int_op(estimate.liveness.after_firsthop_idx, OP_EQ, 0);
     tt_assert(final.liveness.after_firsthop_idx ==
                 CBT_DEFAULT_MAX_RECENT_TIMEOUT_COUNT-1);
 
@@ -571,20 +571,15 @@ test_rend_fns(void *arg)
     intro->intro_key = crypto_pk_dup_key(pk2);
     smartlist_add(generated->intro_nodes, intro);
   }
-  tt_assert(rend_encode_v2_descriptors(descs, generated, now, 0,
-                                         REND_NO_AUTH, NULL, NULL) > 0);
-  tt_assert(rend_compute_v2_desc_id(computed_desc_id, service_id_base32,
-                                      NULL, now, 0) == 0);
+  tt_int_op(rend_encode_v2_descriptors(descs, generated, now, 0, REND_NO_AUTH, NULL, NULL),
+            OP_GT, 0);
+  tt_int_op(rend_compute_v2_desc_id(computed_desc_id, service_id_base32, NULL, now, 0),
+            OP_EQ, 0);
   tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
              smartlist_get(descs, 0))->desc_id, OP_EQ,
             computed_desc_id, DIGEST_LEN);
-  tt_assert(rend_parse_v2_service_descriptor(&parsed, parsed_desc_id,
-                                             &intro_points_encrypted,
-                                             &intro_points_size,
-                                             &encoded_size,
-                                              &next_desc,
-                             ((rend_encoded_v2_service_descriptor_t *)
-                                 smartlist_get(descs, 0))->desc_str, 1) == 0);
+  tt_int_op(rend_parse_v2_service_descriptor(&parsed, parsed_desc_id, &intro_points_encrypted, &intro_points_size, &encoded_size, &next_desc, ((rend_encoded_v2_service_descriptor_t *)smartlist_get(descs, 0))->desc_str, 1),
+            OP_EQ, 0);
   tt_assert(parsed);
   tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
          smartlist_get(descs, 0))->desc_id,OP_EQ, parsed_desc_id, DIGEST_LEN);
diff --git a/src/test/test_addr.c b/src/test/test_addr.c
index 2f591bdfe..53d1c754b 100644
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@ -451,10 +451,10 @@ test_addr_ip6_helpers(void *arg)
                     "::ffff:6.0.0.0"); /* XXXX wrong. */
   tor_addr_parse_mask_ports("[::ffff:2.3.4.5]", 0, &t1, NULL, NULL, NULL);
   tor_addr_parse_mask_ports("2.3.4.5", 0, &t2, NULL, NULL, NULL);
-  tt_assert(tor_addr_compare(&t1, &t2, CMP_SEMANTIC) == 0);
+  tt_int_op(tor_addr_compare(&t1, &t2, CMP_SEMANTIC), OP_EQ, 0);
   tor_addr_parse_mask_ports("[::ffff:2.3.4.4]", 0, &t1, NULL, NULL, NULL);
   tor_addr_parse_mask_ports("2.3.4.5", 0, &t2, NULL, NULL, NULL);
-  tt_assert(tor_addr_compare(&t1, &t2, CMP_SEMANTIC) < 0);
+  tt_int_op(tor_addr_compare(&t1, &t2, CMP_SEMANTIC), OP_LT, 0);
 
   /* test compare_masked */
   test_addr_compare_masked("ffff::", OP_EQ, "ffff::0", 128);
@@ -637,7 +637,7 @@ test_addr_ip6_helpers(void *arg)
   /* Try some long addresses. */
   r=tor_addr_parse_mask_ports("[ffff:1111:1111:1111:1111:1111:1111:1111]",
                               0, &t1, NULL, NULL, NULL);
-  tt_assert(r == AF_INET6);
+  tt_int_op(r, OP_EQ, AF_INET6);
   r=tor_addr_parse_mask_ports("[ffff:1111:1111:1111:1111:1111:1111:11111]",
                               0, &t1, NULL, NULL, NULL);
   tt_int_op(r, OP_EQ, -1);
@@ -686,38 +686,38 @@ test_addr_ip6_helpers(void *arg)
   tt_int_op(r, OP_EQ, -1);
   r=tor_addr_parse_mask_ports("*6",0,&t1, &mask, NULL, NULL);
   tt_int_op(r, OP_EQ, -1);
-  tt_assert(r == -1);
+  tt_int_op(r, OP_EQ, -1);
   /* Try a mask with a wildcard. */
   r=tor_addr_parse_mask_ports("*/16",0,&t1, &mask, NULL, NULL);
-  tt_assert(r == -1);
+  tt_int_op(r, OP_EQ, -1);
   r=tor_addr_parse_mask_ports("*4/16",TAPMP_EXTENDED_STAR,
                               &t1, &mask, NULL, NULL);
-  tt_assert(r == -1);
+  tt_int_op(r, OP_EQ, -1);
   r=tor_addr_parse_mask_ports("*6/30",TAPMP_EXTENDED_STAR,
                               &t1, &mask, NULL, NULL);
-  tt_assert(r == -1);
+  tt_int_op(r, OP_EQ, -1);
   /* Basic mask tests*/
   r=tor_addr_parse_mask_ports("1.1.2.2/31",0,&t1, &mask, NULL, NULL);
-  tt_assert(r == AF_INET);
+  tt_int_op(r, OP_EQ, AF_INET);
   tt_int_op(mask,OP_EQ,31);
   tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
   tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0x01010202);
   r=tor_addr_parse_mask_ports("3.4.16.032:1-2",0,&t1, &mask, &port1, &port2);
-  tt_assert(r == AF_INET);
+  tt_int_op(r, OP_EQ, AF_INET);
   tt_int_op(mask,OP_EQ,32);
   tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
   tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0x03041020);
-  tt_assert(port1 == 1);
-  tt_assert(port2 == 2);
+  tt_uint_op(port1, OP_EQ, 1);
+  tt_uint_op(port2, OP_EQ, 2);
   r=tor_addr_parse_mask_ports("1.1.2.3/255.255.128.0",0,&t1, &mask,NULL,NULL);
-  tt_assert(r == AF_INET);
+  tt_int_op(r, OP_EQ, AF_INET);
   tt_int_op(mask,OP_EQ,17);
   tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
   tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0x01010203);
   r=tor_addr_parse_mask_ports("[efef::]/112",0,&t1, &mask, &port1, &port2);
-  tt_assert(r == AF_INET6);
-  tt_assert(port1 == 1);
-  tt_assert(port2 == 65535);
+  tt_int_op(r, OP_EQ, AF_INET6);
+  tt_uint_op(port1, OP_EQ, 1);
+  tt_uint_op(port2, OP_EQ, 65535);
   /* Try regular wildcard behavior without TAPMP_EXTENDED_STAR */
   r=tor_addr_parse_mask_ports("*:80-443",0,&t1,&mask,&port1,&port2);
   tt_int_op(r,OP_EQ,AF_INET); /* Old users of this always get inet */
@@ -752,9 +752,9 @@ test_addr_ip6_helpers(void *arg)
   tt_int_op(port2,OP_EQ,65535);
 
   /* make sure inet address lengths >= max */
-  tt_assert(INET_NTOA_BUF_LEN >= sizeof("255.255.255.255"));
-  tt_assert(TOR_ADDR_BUF_LEN >=
-              sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"));
+  tt_int_op(INET_NTOA_BUF_LEN, OP_GE, sizeof("255.255.255.255"));
+  tt_int_op(TOR_ADDR_BUF_LEN, OP_GE,
+            sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"));
 
   tt_assert(sizeof(tor_addr_t) >= sizeof(struct in6_addr));
 
diff --git a/src/test/test_address.c b/src/test/test_address.c
index 6dd65942b..a2a89c9a1 100644
--- a/src/test/test_address.c
+++ b/src/test/test_address.c
@@ -224,7 +224,7 @@ test_address_ifaddrs_to_smartlist(void *arg)
    smartlist = ifaddrs_to_smartlist(ifa, AF_UNSPEC);
 
    tt_assert(smartlist);
-   tt_assert(smartlist_len(smartlist) == 3);
+   tt_int_op(smartlist_len(smartlist), OP_EQ, 3);
 
    sockaddr_to_check = tor_malloc(sizeof(struct sockaddr_in6));
 
@@ -384,7 +384,7 @@ test_address_ip_adapter_addresses_to_smartlist(void *arg)
   result = ip_adapter_addresses_to_smartlist(addrs1);
 
   tt_assert(result);
-  tt_assert(smartlist_len(result) == 3);
+  tt_int_op(smartlist_len(result), OP_EQ, 3);
 
   tor_addr = smartlist_get(result,0);
 
@@ -730,7 +730,7 @@ test_address_udp_socket_trick_blackbox(void *arg)
   retval = get_interface_address6_via_udp_socket_hack(LOG_DEBUG,
                                                       AF_INET+AF_INET6,&addr4);
 
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   done:
   return;
@@ -935,10 +935,10 @@ test_address_get_if_addrs_internal_fail(void *arg)
   tt_int_op(smartlist_len(results2),OP_EQ,0);
 
   rv = get_interface_address6(LOG_ERR, AF_INET6, &ipv6_addr);
-  tt_assert(rv == -1);
+  tt_int_op(rv, OP_EQ, -1);
 
   rv = get_interface_address(LOG_ERR, &ipv4h_addr);
-  tt_assert(rv == -1);
+  tt_int_op(rv, OP_EQ, -1);
 
  done:
   UNMOCK(get_interface_addresses_raw);
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index 908b94f89..d1c8b6a02 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -1780,7 +1780,7 @@ test_channel_id_map(void *arg)
   ed25519_public_key_t ed_zero;
   memset(&ed_zero, 0, sizeof(ed_zero));
 
-  tt_assert(sizeof(rsa_id[0]) == DIGEST_LEN); // Do I remember C?
+  tt_int_op(DIGEST_LEN, OP_EQ, sizeof(rsa_id[0])); // Do I remember C?
 
   for (i = 0; i < N_CHAN; ++i) {
     crypto_rand(rsa_id[i], DIGEST_LEN);
diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c
index 447c59847..8b74a47a4 100644
--- a/src/test/test_channeltls.c
+++ b/src/test/test_channeltls.c
@@ -274,7 +274,7 @@ tlschan_connection_or_connect_mock(const tor_addr_t *addr,
   (void) ed_id; // XXXX Not yet used.
 
   tt_assert(addr != NULL);
-  tt_assert(port != 0);
+  tt_uint_op(port, OP_NE, 0);
   tt_assert(digest != NULL);
   tt_assert(tlschan != NULL);
 
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 0c92efc7a..f7a286bc4 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -658,84 +658,84 @@ test_config_parse_transport_plugin_line(void *arg)
 
   /* Bad transport lines - too short */
   r = parse_transport_line(options, "bad", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options, "bad", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options, "bad bad", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options, "bad bad", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
 
   /* Test transport list parsing */
   r = parse_transport_line(options,
       "transport_1 exec /usr/bin/fake-transport", 1, 0);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   r = parse_transport_line(options,
    "transport_1 exec /usr/bin/fake-transport", 1, 1);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   r = parse_transport_line(options,
       "transport_1,transport_2 exec /usr/bin/fake-transport", 1, 0);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   r = parse_transport_line(options,
       "transport_1,transport_2 exec /usr/bin/fake-transport", 1, 1);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   /* Bad transport identifiers */
   r = parse_transport_line(options,
       "transport_* exec /usr/bin/fake-transport", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options,
       "transport_* exec /usr/bin/fake-transport", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
 
   /* Check SOCKS cases for client transport */
   r = parse_transport_line(options,
       "transport_1 socks4 1.2.3.4:567", 1, 0);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   r = parse_transport_line(options,
       "transport_1 socks5 1.2.3.4:567", 1, 0);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   /* Proxy case for server transport */
   r = parse_transport_line(options,
       "transport_1 proxy 1.2.3.4:567", 1, 1);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   /* Multiple-transport error exit */
   r = parse_transport_line(options,
       "transport_1,transport_2 socks5 1.2.3.4:567", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options,
       "transport_1,transport_2 proxy 1.2.3.4:567", 1, 1);
   /* No port error exit */
   r = parse_transport_line(options,
       "transport_1 socks5 1.2.3.4", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options,
      "transport_1 proxy 1.2.3.4", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   /* Unparsable address error exit */
   r = parse_transport_line(options,
       "transport_1 socks5 1.2.3:6x7", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options,
       "transport_1 proxy 1.2.3:6x7", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
 
   /* "Strange {Client|Server}TransportPlugin field" error exit */
   r = parse_transport_line(options,
       "transport_1 foo bar", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options,
       "transport_1 foo bar", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
 
   /* No sandbox mode error exit */
   tmp = options->Sandbox;
   options->Sandbox = 1;
   r = parse_transport_line(options,
       "transport_1 exec /usr/bin/fake-transport", 1, 0);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   r = parse_transport_line(options,
       "transport_1 exec /usr/bin/fake-transport", 1, 1);
-  tt_assert(r < 0);
+  tt_int_op(r, OP_LT, 0);
   options->Sandbox = tmp;
 
   /*
@@ -747,7 +747,7 @@ test_config_parse_transport_plugin_line(void *arg)
     pt_kickstart_proxy_mock_call_count;
   r = parse_transport_line(options,
       "transport_1 exec /usr/bin/fake-transport", 0, 1);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_assert(pt_kickstart_proxy_mock_call_count ==
       old_pt_kickstart_proxy_mock_call_count + 1);
   UNMOCK(pt_kickstart_proxy);
@@ -755,7 +755,7 @@ test_config_parse_transport_plugin_line(void *arg)
   /* This one hits a log line in the !validate_only case only */
   r = parse_transport_line(options,
       "transport_1 proxy 1.2.3.4:567", 0, 1);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
 
   /* Check mocked client transport cases */
   MOCK(pt_kickstart_proxy, pt_kickstart_proxy_mock);
@@ -773,7 +773,7 @@ test_config_parse_transport_plugin_line(void *arg)
   r = parse_transport_line(options,
       "transport_1 exec /usr/bin/fake-transport", 0, 0);
   /* Should have succeeded */
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   /* transport_is_needed() should have been called */
   tt_assert(transport_is_needed_mock_call_count ==
       old_transport_is_needed_mock_call_count + 1);
@@ -797,7 +797,7 @@ test_config_parse_transport_plugin_line(void *arg)
   r = parse_transport_line(options,
       "transport_1 exec /usr/bin/fake-transport", 0, 0);
   /* Should have succeeded */
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   /*
    * transport_is_needed() and pt_kickstart_proxy() should have been
    * called.
@@ -821,7 +821,7 @@ test_config_parse_transport_plugin_line(void *arg)
   r = parse_transport_line(options,
       "transport_1 socks5 1.2.3.4:567", 0, 0);
   /* Should have succeeded */
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   /*
    * transport_is_needed() and transport_add_from_config() should have
    * been called.
@@ -1219,7 +1219,7 @@ test_config_resolve_my_address(void *arg)
                               &method_used,&hostname_out);
 
   tt_want(resolved_addr == 0);
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   tor_free(options->Address);
   tor_free(hostname_out);
@@ -1241,7 +1241,7 @@ test_config_resolve_my_address(void *arg)
                               &method_used,&hostname_out);
 
   tt_want(n_hostname_failure == prev_n_hostname_failure + 1);
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   UNMOCK(tor_lookup_hostname);
 
@@ -1262,7 +1262,7 @@ test_config_resolve_my_address(void *arg)
                               &method_used,&hostname_out);
 
   tt_want(n_gethostname_failure == prev_n_gethostname_failure + 1);
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   UNMOCK(tor_gethostname);
   tor_free(hostname_out);
@@ -1315,7 +1315,7 @@ test_config_resolve_my_address(void *arg)
           prev_n_get_interface_address_failure + 1);
   tt_want(n_gethostname_replacement ==
           prev_n_gethostname_replacement + 1);
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   UNMOCK(get_interface_address);
   tor_free(hostname_out);
@@ -1375,7 +1375,7 @@ test_config_resolve_my_address(void *arg)
                               &method_used,&hostname_out);
 
   tt_want(n_hostname_failure == prev_n_hostname_failure + 1);
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   UNMOCK(tor_gethostname);
   UNMOCK(tor_lookup_hostname);
@@ -1421,7 +1421,7 @@ test_config_resolve_my_address(void *arg)
 
   tt_str_op(method_used,OP_EQ,"INTERFACE");
   tt_assert(!hostname_out);
-  tt_assert(retval == 0);
+  tt_int_op(retval, OP_EQ, 0);
 
   /*
    * CASE 11b:
@@ -1446,7 +1446,7 @@ test_config_resolve_my_address(void *arg)
   tt_want(n_get_interface_address6_failure ==
           prev_n_get_interface_address6_failure + 1);
 
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   UNMOCK(tor_gethostname);
   UNMOCK(tor_lookup_hostname);
@@ -1475,7 +1475,7 @@ test_config_resolve_my_address(void *arg)
                               &method_used,&hostname_out);
 
   tt_want(n_gethostname_localhost == prev_n_gethostname_localhost + 1);
-  tt_assert(retval == -1);
+  tt_int_op(retval, OP_EQ, -1);
 
   UNMOCK(tor_gethostname);
 
@@ -1510,18 +1510,18 @@ test_config_adding_trusted_dir_server(void *arg)
                               NULL, V3_DIRINFO, 1.0);
   tt_assert(ds);
   dir_server_add(ds);
-  tt_assert(get_n_authorities(V3_DIRINFO) == 1);
-  tt_assert(smartlist_len(router_get_fallback_dir_servers()) == 1);
+  tt_int_op(get_n_authorities(V3_DIRINFO), OP_EQ, 1);
+  tt_int_op(smartlist_len(router_get_fallback_dir_servers()), OP_EQ, 1);
 
   /* create a trusted ds with an IPv6 address and port */
   rv = tor_addr_port_parse(LOG_WARN, "[::1]:9061", &ipv6.addr, &ipv6.port, -1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   ds = trusted_dir_server_new("ds", "127.0.0.1", 9059, 9060, &ipv6, digest,
                               NULL, V3_DIRINFO, 1.0);
   tt_assert(ds);
   dir_server_add(ds);
-  tt_assert(get_n_authorities(V3_DIRINFO) == 2);
-  tt_assert(smartlist_len(router_get_fallback_dir_servers()) == 2);
+  tt_int_op(get_n_authorities(V3_DIRINFO), OP_EQ, 2);
+  tt_int_op(smartlist_len(router_get_fallback_dir_servers()), OP_EQ, 2);
 
  done:
   clear_dir_servers();
@@ -1543,21 +1543,21 @@ test_config_adding_fallback_dir_server(void *arg)
   routerlist_free_all();
 
   rv = tor_addr_parse(&ipv4, "127.0.0.1");
-  tt_assert(rv == AF_INET);
+  tt_int_op(rv, OP_EQ, AF_INET);
 
   /* create a trusted ds without an IPv6 address and port */
   ds = fallback_dir_server_new(&ipv4, 9059, 9060, NULL, digest, 1.0);
   tt_assert(ds);
   dir_server_add(ds);
-  tt_assert(smartlist_len(router_get_fallback_dir_servers()) == 1);
+  tt_int_op(smartlist_len(router_get_fallback_dir_servers()), OP_EQ, 1);
 
   /* create a trusted ds with an IPv6 address and port */
   rv = tor_addr_port_parse(LOG_WARN, "[::1]:9061", &ipv6.addr, &ipv6.port, -1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   ds = fallback_dir_server_new(&ipv4, 9059, 9060, &ipv6, digest, 1.0);
   tt_assert(ds);
   dir_server_add(ds);
-  tt_assert(smartlist_len(router_get_fallback_dir_servers()) == 2);
+  tt_int_op(smartlist_len(router_get_fallback_dir_servers()), OP_EQ, 2);
 
  done:
   clear_dir_servers();
@@ -1588,14 +1588,14 @@ test_config_parsing_trusted_dir_server(void *arg)
   rv = parse_dir_authority_line(TEST_DIR_AUTH_LINE_START
                                 TEST_DIR_AUTH_LINE_END,
                                 V3_DIRINFO, 1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   /* parse a trusted dir server with an IPv6 address and port */
   rv = parse_dir_authority_line(TEST_DIR_AUTH_LINE_START
                                 TEST_DIR_AUTH_IPV6_FLAG
                                 TEST_DIR_AUTH_LINE_END,
                                 V3_DIRINFO, 1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   /* Since we are only validating, there is no cleanup. */
  done:
@@ -1623,13 +1623,13 @@ test_config_parsing_fallback_dir_server(void *arg)
 
   /* parse a trusted dir server without an IPv6 address and port */
   rv = parse_dir_fallback_line(TEST_DIR_FALLBACK_LINE, 1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   /* parse a trusted dir server with an IPv6 address and port */
   rv = parse_dir_fallback_line(TEST_DIR_FALLBACK_LINE
                                TEST_DIR_FALLBACK_IPV6_FLAG,
                                1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   /* Since we are only validating, there is no cleanup. */
  done:
@@ -1649,8 +1649,8 @@ test_config_adding_default_trusted_dir_servers(void *arg)
 
   /* Assume we only have one bridge authority */
   add_default_trusted_dir_authorities(BRIDGE_DIRINFO);
-  tt_assert(get_n_authorities(BRIDGE_DIRINFO) == 1);
-  tt_assert(smartlist_len(router_get_fallback_dir_servers()) == 1);
+  tt_int_op(get_n_authorities(BRIDGE_DIRINFO), OP_EQ, 1);
+  tt_int_op(smartlist_len(router_get_fallback_dir_servers()), OP_EQ, 1);
 
   /* Assume we have eight V3 authorities */
   add_default_trusted_dir_authorities(V3_DIRINFO);
@@ -1838,7 +1838,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 1);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 1);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -1857,7 +1857,7 @@ test_config_adding_dir_servers(void *arg)
                          1 : 0)
                         );
       /* If we have no default bridge authority, something has gone wrong */
-      tt_assert(n_default_alt_bridge_authority >= 1);
+      tt_int_op(n_default_alt_bridge_authority, OP_GE, 1);
 
       /* Count v3 Authorities */
       SMARTLIST_FOREACH(fallback_servers,
@@ -1869,7 +1869,7 @@ test_config_adding_dir_servers(void *arg)
                          1 : 0)
                         );
       /* If we have no default authorities, something has gone really wrong */
-      tt_assert(n_default_alt_dir_authority >= 1);
+      tt_int_op(n_default_alt_dir_authority, OP_GE, 1);
 
       /* Calculate Fallback Directory Count */
       n_default_fallback_dir = (smartlist_len(fallback_servers) -
@@ -1879,7 +1879,7 @@ test_config_adding_dir_servers(void *arg)
        * or some authorities aren't being added as fallback directories.
        * (networkstatus_consensus_can_use_extra_fallbacks depends on all
        * authorities being fallback directories.) */
-      tt_assert(n_default_fallback_dir >= 0);
+      tt_int_op(n_default_fallback_dir, OP_GE, 0);
     }
   }
 
@@ -1920,7 +1920,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -1929,7 +1929,7 @@ test_config_adding_dir_servers(void *arg)
       /* trusted_dir_servers */
       const smartlist_t *dir_servers = router_get_trusted_dir_servers();
       /* D0, (No B1), (No A2) */
-      tt_assert(smartlist_len(dir_servers) == 1);
+      tt_int_op(smartlist_len(dir_servers), OP_EQ, 1);
 
       /* DirAuthority - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -1941,7 +1941,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 1);
+      tt_int_op(found_D0, OP_EQ, 1);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -1953,7 +1953,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -1965,14 +1965,14 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
     }
 
     {
       /* fallback_dir_servers */
       const smartlist_t *fallback_servers = router_get_fallback_dir_servers();
       /* D0, (No B1), (No A2), Custom Fallback */
-      tt_assert(smartlist_len(fallback_servers) == 2);
+      tt_int_op(smartlist_len(fallback_servers), OP_EQ, 2);
 
       /* DirAuthority - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -1984,7 +1984,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 1);
+      tt_int_op(found_D0, OP_EQ, 1);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -1996,7 +1996,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2008,7 +2008,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* Custom FallbackDir - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2020,7 +2020,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 1);
+      tt_int_op(found_non_default_fallback, OP_EQ, 1);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2032,7 +2032,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
     }
   }
 
@@ -2061,7 +2061,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we just have the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 0);
@@ -2070,7 +2070,7 @@ test_config_adding_dir_servers(void *arg)
       /* trusted_dir_servers */
       const smartlist_t *dir_servers = router_get_trusted_dir_servers();
       /* D0, (No B1), (No A2) */
-      tt_assert(smartlist_len(dir_servers) == 1);
+      tt_int_op(smartlist_len(dir_servers), OP_EQ, 1);
 
       /* DirAuthority - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -2082,7 +2082,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 1);
+      tt_int_op(found_D0, OP_EQ, 1);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2094,7 +2094,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2106,14 +2106,14 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
     }
 
     {
       /* fallback_dir_servers */
       const smartlist_t *fallback_servers = router_get_fallback_dir_servers();
       /* D0, (No B1), (No A2), (No Fallback) */
-      tt_assert(smartlist_len(fallback_servers) == 1);
+      tt_int_op(smartlist_len(fallback_servers), OP_EQ, 1);
 
       /* DirAuthority - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -2125,7 +2125,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 1);
+      tt_int_op(found_D0, OP_EQ, 1);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2137,7 +2137,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2149,7 +2149,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* (No Custom FallbackDir) - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2161,7 +2161,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 0);
+      tt_int_op(found_non_default_fallback, OP_EQ, 0);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2173,7 +2173,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
     }
   }
 
@@ -2202,7 +2202,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -2211,7 +2211,7 @@ test_config_adding_dir_servers(void *arg)
       /* trusted_dir_servers */
       const smartlist_t *dir_servers = router_get_trusted_dir_servers();
       /* (No D0), B1, A2 */
-      tt_assert(smartlist_len(dir_servers) == 2);
+      tt_int_op(smartlist_len(dir_servers), OP_EQ, 2);
 
       /* (No DirAuthority) - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -2223,7 +2223,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2235,7 +2235,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2247,14 +2247,14 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
     }
 
     {
       /* fallback_dir_servers */
       const smartlist_t *fallback_servers = router_get_fallback_dir_servers();
       /* (No D0), B1, A2, Custom Fallback */
-      tt_assert(smartlist_len(fallback_servers) == 3);
+      tt_int_op(smartlist_len(fallback_servers), OP_EQ, 3);
 
       /* (No DirAuthority) - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -2266,7 +2266,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2278,7 +2278,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2290,7 +2290,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
 
       /* Custom FallbackDir - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2302,7 +2302,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 1);
+      tt_int_op(found_non_default_fallback, OP_EQ, 1);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2314,7 +2314,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
     }
   }
 
@@ -2344,7 +2344,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 0);
@@ -2353,7 +2353,7 @@ test_config_adding_dir_servers(void *arg)
       /* trusted_dir_servers */
       const smartlist_t *dir_servers = router_get_trusted_dir_servers();
       /* (No D0), B1, A2 */
-      tt_assert(smartlist_len(dir_servers) == 2);
+      tt_int_op(smartlist_len(dir_servers), OP_EQ, 2);
 
       /* (No DirAuthority) - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -2365,7 +2365,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2377,7 +2377,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2389,14 +2389,14 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
     }
 
     {
       /* fallback_dir_servers */
       const smartlist_t *fallback_servers = router_get_fallback_dir_servers();
       /* (No D0), B1, A2, (No Fallback) */
-      tt_assert(smartlist_len(fallback_servers) == 2);
+      tt_int_op(smartlist_len(fallback_servers), OP_EQ, 2);
 
       /* (No DirAuthority) - D0 - dir_port: 60090 */
       int found_D0 = 0;
@@ -2408,7 +2408,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2420,7 +2420,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2432,7 +2432,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
 
       /* (No Custom FallbackDir) - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2444,7 +2444,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 0);
+      tt_int_op(found_non_default_fallback, OP_EQ, 0);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2456,7 +2456,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
     }
   }
 
@@ -2496,7 +2496,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -2517,7 +2517,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2529,7 +2529,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2541,7 +2541,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default v3 non-Bridge directory authorities, so let's assume that
@@ -2567,7 +2567,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2579,7 +2579,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2591,7 +2591,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* Custom FallbackDir - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2603,7 +2603,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 1);
+      tt_int_op(found_non_default_fallback, OP_EQ, 1);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2615,7 +2615,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default v3 non-Bridge directory authorities, so let's assume that
@@ -2650,7 +2650,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 1);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 1);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -2671,7 +2671,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2683,7 +2683,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2695,7 +2695,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default v3 non-Bridge directory authorities, so let's assume that
@@ -2721,7 +2721,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* AlternateBridgeAuthority - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2733,7 +2733,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 1);
+      tt_int_op(found_B1, OP_EQ, 1);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2745,7 +2745,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* (No Custom FallbackDir) - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2757,7 +2757,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 0);
+      tt_int_op(found_non_default_fallback, OP_EQ, 0);
 
       /* Default FallbackDir - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2769,7 +2769,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 1);
+      tt_int_op(found_default_fallback, OP_EQ, 1);
 
       /* There's no easy way of checking that we have included all the
        * default v3 non-Bridge directory authorities, so let's assume that
@@ -2813,7 +2813,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -2835,7 +2835,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2847,7 +2847,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2859,7 +2859,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge authorities (except for hard-coding tonga's details),
@@ -2886,7 +2886,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -2898,7 +2898,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -2910,7 +2910,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
 
       /* Custom FallbackDir - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -2922,7 +2922,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 1);
+      tt_int_op(found_non_default_fallback, OP_EQ, 1);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -2934,7 +2934,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge authorities (except for hard-coding tonga's details),
@@ -2970,7 +2970,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we just have the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 0);
@@ -2993,7 +2993,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -3005,7 +3005,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -3017,7 +3017,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge authorities (except for hard-coding tonga's details),
@@ -3044,7 +3044,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -3056,7 +3056,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* AlternateDirAuthority - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -3068,7 +3068,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 1);
+      tt_int_op(found_A2, OP_EQ, 1);
 
       /* (No Custom FallbackDir) - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -3080,7 +3080,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 0);
+      tt_int_op(found_non_default_fallback, OP_EQ, 0);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -3092,7 +3092,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge authorities (except for hard-coding tonga's details),
@@ -3136,7 +3136,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must not have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 0);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 0);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -3158,7 +3158,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -3170,7 +3170,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -3182,7 +3182,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge & V3 Directory authorities, so let's assume that
@@ -3209,7 +3209,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -3221,7 +3221,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -3233,7 +3233,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* Custom FallbackDir - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -3245,7 +3245,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 1);
+      tt_int_op(found_non_default_fallback, OP_EQ, 1);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -3257,7 +3257,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 0);
+      tt_int_op(found_default_fallback, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge & V3 Directory authorities, so let's assume that
@@ -3299,7 +3299,7 @@ test_config_adding_dir_servers(void *arg)
     /* check outcome */
 
     /* we must have added the default fallback dirs */
-    tt_assert(n_add_default_fallback_dir_servers_known_default == 1);
+    tt_int_op(n_add_default_fallback_dir_servers_known_default, OP_EQ, 1);
 
     /* we have more fallbacks than just the authorities */
     tt_assert(networkstatus_consensus_can_use_extra_fallbacks(options) == 1);
@@ -3321,7 +3321,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -3333,7 +3333,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -3345,7 +3345,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge & V3 Directory authorities, so let's assume that
@@ -3372,7 +3372,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60090 ?
                          1 : 0)
                         );
-      tt_assert(found_D0 == 0);
+      tt_int_op(found_D0, OP_EQ, 0);
 
       /* (No AlternateBridgeAuthority) - B1 - dir_port: 60091 */
       int found_B1 = 0;
@@ -3384,7 +3384,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60091 ?
                          1 : 0)
                         );
-      tt_assert(found_B1 == 0);
+      tt_int_op(found_B1, OP_EQ, 0);
 
       /* (No AlternateDirAuthority) - A2 - dir_port: 60092 */
       int found_A2 = 0;
@@ -3396,7 +3396,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60092 ?
                          1 : 0)
                         );
-      tt_assert(found_A2 == 0);
+      tt_int_op(found_A2, OP_EQ, 0);
 
       /* Custom FallbackDir - No Nickname - dir_port: 60093 */
       int found_non_default_fallback = 0;
@@ -3408,7 +3408,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60093 ?
                          1 : 0)
                         );
-      tt_assert(found_non_default_fallback == 0);
+      tt_int_op(found_non_default_fallback, OP_EQ, 0);
 
       /* (No Default FallbackDir) - No Nickname - dir_port: 60099 */
       int found_default_fallback = 0;
@@ -3420,7 +3420,7 @@ test_config_adding_dir_servers(void *arg)
                         (ds->dir_port == 60099 ?
                          1 : 0)
                         );
-      tt_assert(found_default_fallback == 1);
+      tt_int_op(found_default_fallback, OP_EQ, 1);
 
       /* There's no easy way of checking that we have included all the
        * default Bridge & V3 Directory authorities, and the default
@@ -3477,7 +3477,7 @@ test_config_default_dir_servers(void *arg)
   opts = NULL;
 
   /* assume a release will never go out with less than 7 authorities */
-  tt_assert(trusted_count >= 7);
+  tt_int_op(trusted_count, OP_GE, 7);
   /* if we disable the default fallbacks, there must not be any extra */
   tt_assert(fallback_count == trusted_count);
 
@@ -3490,7 +3490,7 @@ test_config_default_dir_servers(void *arg)
   opts = NULL;
 
   /* assume a release will never go out with less than 7 authorities */
-  tt_assert(trusted_count >= 7);
+  tt_int_op(trusted_count, OP_GE, 7);
   /* XX/teor - allow for default fallbacks to be added without breaking
    * the unit tests. Set a minimum fallback count once the list is stable. */
   tt_assert(fallback_count >= trusted_count);
@@ -3559,18 +3559,18 @@ test_config_directory_fetch(void *arg)
   options->ClientOnly = 1;
   tt_assert(server_mode(options) == 0);
   tt_assert(public_server_mode(options) == 0);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 1);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 1);
 
   /* Bridge Clients can use multiple directory mirrors for bootstrap */
   memset(options, 0, sizeof(or_options_t));
   options->UseBridges = 1;
   tt_assert(server_mode(options) == 0);
   tt_assert(public_server_mode(options) == 0);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 1);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 1);
 
   /* Bridge Relays (Bridges) must act like clients, and use multiple
    * directory mirrors for bootstrap */
@@ -3579,9 +3579,9 @@ test_config_directory_fetch(void *arg)
   options->ORPort_set = 1;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 0);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 1);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 1);
 
   /* Clients set to FetchDirInfoEarly must fetch it from the authorities,
    * but can use multiple authorities for bootstrap */
@@ -3589,9 +3589,9 @@ test_config_directory_fetch(void *arg)
   options->FetchDirInfoEarly = 1;
   tt_assert(server_mode(options) == 0);
   tt_assert(public_server_mode(options) == 0);
-  tt_assert(directory_fetches_from_authorities(options) == 1);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 1);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 1);
 
   /* OR servers only fetch the consensus from the authorities when they don't
    * know their own address, but never use multiple directories for bootstrap
@@ -3602,16 +3602,16 @@ test_config_directory_fetch(void *arg)
   mock_router_pick_published_address_result = -1;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 1);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   mock_router_pick_published_address_result = 0;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   /* Exit OR servers only fetch the consensus from the authorities when they
    * refuse unknown exits, but never use multiple directories for bootstrap
@@ -3629,17 +3629,17 @@ test_config_directory_fetch(void *arg)
   options->RefuseUnknownExits = 1;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 1);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   options->RefuseUnknownExits = 0;
   mock_router_pick_published_address_result = 0;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   /* Dir servers fetch the consensus from the authorities, unless they are not
    * advertising themselves (hibernating) or have no routerinfo or are not
@@ -3658,26 +3658,26 @@ test_config_directory_fetch(void *arg)
   mock_router_get_my_routerinfo_result = &routerinfo;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 1);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   mock_advertised_server_mode_result = 0;
   routerinfo.dir_port = 1;
   mock_router_get_my_routerinfo_result = &routerinfo;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   mock_advertised_server_mode_result = 1;
   mock_router_get_my_routerinfo_result = NULL;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   mock_advertised_server_mode_result = 1;
   routerinfo.dir_port = 0;
@@ -3685,9 +3685,9 @@ test_config_directory_fetch(void *arg)
   mock_router_get_my_routerinfo_result = &routerinfo;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 0);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
   mock_advertised_server_mode_result = 1;
   routerinfo.dir_port = 1;
@@ -3695,9 +3695,9 @@ test_config_directory_fetch(void *arg)
   mock_router_get_my_routerinfo_result = &routerinfo;
   tt_assert(server_mode(options) == 1);
   tt_assert(public_server_mode(options) == 1);
-  tt_assert(directory_fetches_from_authorities(options) == 1);
-  tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
-            == 0);
+  tt_int_op(directory_fetches_from_authorities(options), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_can_use_multiple_directories(options),
+            OP_EQ, 0);
 
  done:
   tor_free(options);
diff --git a/src/test/test_connection.c b/src/test/test_connection.c
index f2529026f..1a0bfde9f 100644
--- a/src/test/test_connection.c
+++ b/src/test/test_connection.c
@@ -70,7 +70,7 @@ test_conn_lookup_addr_helper(const char *address, int family, tor_addr_t *addr)
 
   rv = tor_addr_lookup(address, family, addr);
   /* XXXX - should we retry on transient failure? */
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(tor_addr_is_loopback(addr));
   tt_assert(tor_addr_is_v4(addr));
 
@@ -292,7 +292,7 @@ test_conn_download_status_teardown(const struct testcase_t *tc, void *arg)
 
       /* connection_free_() cleans up requested_resource */
       rv = test_conn_get_rsrc_teardown(tc, conn);
-      tt_assert(rv == 1);
+      tt_int_op(rv, OP_EQ, 1);
     }
   } SMARTLIST_FOREACH_END(conn);
 
@@ -485,7 +485,7 @@ test_conn_get_rend(void *arg)
 #define sl_is_conn_assert(sl_input, conn) \
   do {                                               \
     the_sl = (sl_input);                             \
-    tt_assert(smartlist_len((the_sl)) == 1);         \
+    tt_int_op(smartlist_len((the_sl)), OP_EQ, 1);         \
     tt_assert(smartlist_get((the_sl), 0) == (conn)); \
     smartlist_free(the_sl); the_sl = NULL;           \
   } while (0)
@@ -493,7 +493,7 @@ test_conn_get_rend(void *arg)
 #define sl_no_conn_assert(sl_input)          \
   do {                                       \
     the_sl = (sl_input);                     \
-    tt_assert(smartlist_len((the_sl)) == 0); \
+    tt_int_op(smartlist_len((the_sl)), OP_EQ, 0); \
     smartlist_free(the_sl); the_sl = NULL;   \
   } while (0)
 
@@ -539,43 +539,23 @@ test_conn_get_rsrc(void *arg)
                                                     TEST_CONN_RSRC_2,
                                                     !TEST_CONN_STATE));
 
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                    conn->base_.purpose,
-                                                    conn->requested_resource)
-            == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                    TEST_CONN_RSRC_PURPOSE,
-                                                    TEST_CONN_RSRC)
-            == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                    !conn->base_.purpose,
-                                                    "")
-            == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                    !TEST_CONN_RSRC_PURPOSE,
-                                                    TEST_CONN_RSRC_2)
-            == 0);
-
-  tt_assert(connection_dir_count_by_purpose_resource_and_state(
-                                                    conn->base_.purpose,
-                                                    conn->requested_resource,
-                                                    conn->base_.state)
-            == 1);
-  tt_assert(connection_dir_count_by_purpose_resource_and_state(
-                                                    TEST_CONN_RSRC_PURPOSE,
-                                                    TEST_CONN_RSRC,
-                                                    TEST_CONN_STATE)
-            == 1);
-  tt_assert(connection_dir_count_by_purpose_resource_and_state(
-                                                    !conn->base_.purpose,
-                                                    "",
-                                                    !conn->base_.state)
-            == 0);
-  tt_assert(connection_dir_count_by_purpose_resource_and_state(
-                                                    !TEST_CONN_RSRC_PURPOSE,
-                                                    TEST_CONN_RSRC_2,
-                                                    !TEST_CONN_STATE)
-            == 0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(conn->base_.purpose, conn->requested_resource),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(!conn->base_.purpose, ""),
+            OP_EQ, 0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(!TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC_2),
+            OP_EQ, 0);
+
+  tt_int_op(connection_dir_count_by_purpose_resource_and_state(conn->base_.purpose, conn->requested_resource, conn->base_.state),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_resource_and_state(TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC, TEST_CONN_STATE),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_resource_and_state(!conn->base_.purpose, "", !conn->base_.state),
+            OP_EQ, 0);
+  tt_int_op(connection_dir_count_by_purpose_resource_and_state(!TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC_2, !TEST_CONN_STATE),
+            OP_EQ, 0);
 
  done:
   smartlist_free(the_sl);
@@ -601,117 +581,107 @@ test_conn_download_status(void *arg)
   const char *other_res = networkstatus_get_flavor_name(other_flavor);
 
   /* no connections */
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* one connection, not downloading */
   conn = test_conn_download_status_add_a_connection(res);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* one connection, downloading but not linked (not possible on a client,
    * but possible on a relay) */
   conn->base_.state = TEST_CONN_DL_STATE;
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* one connection, downloading and linked, but not yet attached */
   ap_conn = test_conn_get_linked_connection(TO_CONN(conn),
                                             TEST_CONN_UNATTACHED_STATE);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
     /* one connection, downloading and linked and attached */
   ap_conn->state = TEST_CONN_ATTACHED_STATE;
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* one connection, linked and attached but not downloading */
   conn->base_.state = TEST_CONN_STATE;
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* two connections, both not downloading */
   conn2 = test_conn_download_status_add_a_connection(res);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 2);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 2);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* two connections, one downloading */
   conn->base_.state = TEST_CONN_DL_STATE;
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 2);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 2);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
   conn->base_.state = TEST_CONN_STATE;
 
   /* more connections, all not downloading */
   /* ignore the return value, it's free'd using the connection list */
   (void)test_conn_download_status_add_a_connection(res);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 0);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 3);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 3);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* more connections, one downloading */
   conn->base_.state = TEST_CONN_DL_STATE;
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 3);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 3);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* more connections, two downloading (should never happen, but needs
    * to be tested for completeness) */
@@ -719,38 +689,35 @@ test_conn_download_status(void *arg)
   /* ignore the return value, it's free'd using the connection list */
   (void)test_conn_get_linked_connection(TO_CONN(conn2),
                                         TEST_CONN_ATTACHED_STATE);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 3);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 3);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
   conn->base_.state = TEST_CONN_STATE;
 
   /* more connections, a different one downloading */
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 3);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                         other_res) == 0);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 3);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 0);
 
   /* a connection for the other flavor (could happen if a client is set to
    * cache directory documents), one preferred flavor downloading
    */
   conn4 = test_conn_download_status_add_a_connection(other_res);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 0);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 3);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        other_res) == 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            0);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 3);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 1);
 
   /* a connection for the other flavor (could happen if a client is set to
    * cache directory documents), both flavors downloading
@@ -759,14 +726,13 @@ test_conn_download_status(void *arg)
   /* ignore the return value, it's free'd using the connection list */
   (void)test_conn_get_linked_connection(TO_CONN(conn4),
                                         TEST_CONN_ATTACHED_STATE);
-  tt_assert(networkstatus_consensus_is_already_downloading(res) == 1);
-  tt_assert(networkstatus_consensus_is_already_downloading(other_res) == 1);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        res) == 3);
-  tt_assert(connection_dir_count_by_purpose_and_resource(
-                                                        TEST_CONN_RSRC_PURPOSE,
-                                                        other_res) == 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
+  tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
+            1);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
+            OP_EQ, 3);
+  tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
+            OP_EQ, 1);
 
  done:
   /* the teardown function removes all the connections in the global list*/;
diff --git a/src/test/test_controller.c b/src/test/test_controller.c
index 592f91a98..6005c077d 100644
--- a/src/test/test_controller.c
+++ b/src/test/test_controller.c
@@ -73,7 +73,7 @@ test_add_onion_helper_keyarg(void *arg)
   tt_assert(!key_new_alg);
   tt_assert(!key_new_blob);
   tt_assert(!err_msg);
-  tt_assert(crypto_pk_cmp_keys(pk, pk2) == 0);
+  tt_int_op(crypto_pk_cmp_keys(pk, pk2), OP_EQ, 0);
 
   /* Test loading a invalid key type. */
   tor_free(arg_str);
@@ -123,13 +123,13 @@ test_getinfo_helper_onion(void *arg)
 
   /* successfully get an empty answer */
   rt = getinfo_helper_onions(&dummy, "onions/current", &answer, &errmsg);
-  tt_assert(rt == 0);
+  tt_int_op(rt, OP_EQ, 0);
   tt_str_op(answer, OP_EQ, "");
   tor_free(answer);
 
   /* successfully get an empty answer */
   rt = getinfo_helper_onions(&dummy, "onions/detached", &answer, &errmsg);
-  tt_assert(rt == 0);
+  tt_int_op(rt, OP_EQ, 0);
   tt_str_op(answer, OP_EQ, "");
   tor_free(answer);
 
@@ -138,7 +138,7 @@ test_getinfo_helper_onion(void *arg)
   dummy.ephemeral_onion_services = smartlist_new();
   smartlist_add(dummy.ephemeral_onion_services, service_id);
   rt = getinfo_helper_onions(&dummy, "onions/current", &answer, &errmsg);
-  tt_assert(rt == 0);
+  tt_int_op(rt, OP_EQ, 0);
   tt_str_op(answer, OP_EQ, "dummy_onion_id");
 
  done:
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 7f45a0bf1..d1d92e151 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -1208,12 +1208,12 @@ test_crypto_pk(void *arg)
   tt_assert(! crypto_pk_write_private_key_to_filename(pk1,
                                                         get_fname("pkey1")));
   /* failing case for read: can't read. */
-  tt_assert(crypto_pk_read_private_key_from_filename(pk2,
-                                                   get_fname("xyzzy")) < 0);
+  tt_int_op(crypto_pk_read_private_key_from_filename(pk2, get_fname("xyzzy")),
+            OP_LT, 0);
   write_str_to_file(get_fname("xyzzy"), "foobar", 6);
   /* Failing case for read: no key. */
-  tt_assert(crypto_pk_read_private_key_from_filename(pk2,
-                                                   get_fname("xyzzy")) < 0);
+  tt_int_op(crypto_pk_read_private_key_from_filename(pk2, get_fname("xyzzy")),
+            OP_LT, 0);
   tt_assert(! crypto_pk_read_private_key_from_filename(pk2,
                                                          get_fname("pkey1")));
   tt_int_op(15,OP_EQ,
@@ -1245,7 +1245,7 @@ test_crypto_pk(void *arg)
   i = crypto_pk_asn1_encode(pk1, data1, 1024);
   tt_int_op(i, OP_GT, 0);
   pk2 = crypto_pk_asn1_decode(data1, i);
-  tt_assert(crypto_pk_cmp_keys(pk1,pk2) == 0);
+  tt_int_op(crypto_pk_cmp_keys(pk1, pk2), OP_EQ, 0);
 
   /* Try with hybrid encryption wrappers. */
   crypto_rand(data1, 1024);
@@ -1266,7 +1266,7 @@ test_crypto_pk(void *arg)
   pk2 = crypto_pk_copy_full(pk1);
   tt_assert(pk2 != NULL);
   tt_ptr_op(pk1, OP_NE, pk2);
-  tt_assert(crypto_pk_cmp_keys(pk1,pk2) == 0);
+  tt_int_op(crypto_pk_cmp_keys(pk1, pk2), OP_EQ, 0);
 
  done:
   if (pk1)
@@ -1344,7 +1344,7 @@ test_crypto_pk_base64(void *arg)
   /* Test decoding a valid key. */
   pk2 = crypto_pk_base64_decode(encoded, strlen(encoded));
   tt_assert(pk2);
-  tt_assert(crypto_pk_cmp_keys(pk1,pk2) == 0);
+  tt_int_op(crypto_pk_cmp_keys(pk1, pk2), OP_EQ, 0);
   crypto_pk_free(pk2);
 
   /* Test decoding a invalid key (not Base64). */
@@ -1495,7 +1495,7 @@ test_crypto_formats(void *arg)
   tt_mem_op(data1,OP_EQ, data3, DIGEST_LEN);
   tt_int_op(99,OP_EQ, data3[DIGEST_LEN+1]);
 
-  tt_assert(digest_from_base64(data3, "###") < 0);
+  tt_int_op(digest_from_base64(data3, "###"), OP_LT, 0);
 
   /* Encoding SHA256 */
   crypto_rand(data2, DIGEST256_LEN);
@@ -2936,17 +2936,17 @@ test_crypto_failure_modes(void *arg)
   (void)arg;
 
   rv = crypto_early_init();
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   /* Check random works */
   rv = crypto_rand_check_failure_mode_zero();
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   rv = crypto_rand_check_failure_mode_identical();
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
   rv = crypto_rand_check_failure_mode_predict();
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
  done:
   ;
diff --git a/src/test/test_crypto_slow.c b/src/test/test_crypto_slow.c
index b720d9925..b25d472a5 100644
--- a/src/test/test_crypto_slow.c
+++ b/src/test/test_crypto_slow.c
@@ -516,7 +516,7 @@ test_crypto_ed25519_fuzz_donna(void *arg)
   unsigned i;
   (void)arg;
 
-  tt_assert(sizeof(msg) == iters);
+  tt_uint_op(iters, OP_EQ, sizeof(msg));
   crypto_rand((char*) msg, sizeof(msg));
 
   /* Fuzz Ed25519-donna vs ref10, alternating the implementation used to
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 7539de8eb..fd9ffa5b8 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -275,8 +275,8 @@ test_dir_formats(void *arg)
   tt_int_op(rp1->bandwidthrate,OP_EQ, r1->bandwidthrate);
   tt_int_op(rp1->bandwidthburst,OP_EQ, r1->bandwidthburst);
   tt_int_op(rp1->bandwidthcapacity,OP_EQ, r1->bandwidthcapacity);
-  tt_assert(crypto_pk_cmp_keys(rp1->onion_pkey, pk1) == 0);
-  tt_assert(crypto_pk_cmp_keys(rp1->identity_pkey, pk2) == 0);
+  tt_int_op(crypto_pk_cmp_keys(rp1->onion_pkey, pk1), OP_EQ, 0);
+  tt_int_op(crypto_pk_cmp_keys(rp1->identity_pkey, pk2), OP_EQ, 0);
   tt_assert(rp1->supports_tunnelled_dir_requests);
   //tt_assert(rp1->exit_policy == NULL);
   tor_free(buf);
@@ -294,9 +294,8 @@ test_dir_formats(void *arg)
   strlcat(buf2, "master-key-ed25519 ", sizeof(buf2));
   {
     char k[ED25519_BASE64_LEN+1];
-    tt_assert(ed25519_public_to_base64(k,
-                                &r2->cache_info.signing_key_cert->signing_key)
-              >= 0);
+    tt_int_op(ed25519_public_to_base64(k, &r2->cache_info.signing_key_cert->signing_key),
+              OP_GE, 0);
     strlcat(buf2, k, sizeof(buf2));
     strlcat(buf2, "\n", sizeof(buf2));
   }
@@ -392,8 +391,8 @@ test_dir_formats(void *arg)
   tt_mem_op(rp2->onion_curve25519_pkey->public_key,OP_EQ,
              r2->onion_curve25519_pkey->public_key,
              CURVE25519_PUBKEY_LEN);
-  tt_assert(crypto_pk_cmp_keys(rp2->onion_pkey, pk2) == 0);
-  tt_assert(crypto_pk_cmp_keys(rp2->identity_pkey, pk1) == 0);
+  tt_int_op(crypto_pk_cmp_keys(rp2->onion_pkey, pk2), OP_EQ, 0);
+  tt_int_op(crypto_pk_cmp_keys(rp2->identity_pkey, pk1), OP_EQ, 0);
   tt_assert(rp2->supports_tunnelled_dir_requests);
 
   tt_int_op(smartlist_len(rp2->exit_policy),OP_EQ, 2);
@@ -1537,12 +1536,12 @@ test_dir_measured_bw_kb(void *arg)
   (void)arg;
   for (i = 0; strcmp(lines_fail[i], "end"); i++) {
     //fprintf(stderr, "Testing: %s\n", lines_fail[i]);
-    tt_assert(measured_bw_line_parse(&mbwl, lines_fail[i]) == -1);
+    tt_int_op(measured_bw_line_parse(&mbwl, lines_fail[i]), OP_EQ, -1);
   }
 
   for (i = 0; strcmp(lines_pass[i], "end"); i++) {
     //fprintf(stderr, "Testing: %s %d\n", lines_pass[i], TOR_ISSPACE('\n'));
-    tt_assert(measured_bw_line_parse(&mbwl, lines_pass[i]) == 0);
+    tt_int_op(measured_bw_line_parse(&mbwl, lines_pass[i]), OP_EQ, 0);
     tt_assert(mbwl.bw_kb == 1024);
     tt_assert(strcmp(mbwl.node_hex,
                 "557365204145532d32353620696e73746561642e") == 0);
@@ -1873,8 +1872,7 @@ vote_tweaks_for_v3ns(networkstatus_t *v, int voter, time_t now)
     measured_bw_line_t mbw;
     memset(mbw.node_id, 33, sizeof(mbw.node_id));
     mbw.bw_kb = 1024;
-    tt_assert(measured_bw_line_apply(&mbw,
-                v->routerstatus_list) == 1);
+    tt_int_op(measured_bw_line_apply(&mbw, v->routerstatus_list), OP_EQ, 1);
   } else if (voter == 2 || voter == 3) {
     /* Monkey around with the list a bit */
     vrs = smartlist_get(v->routerstatus_list, 2);
@@ -3162,7 +3160,7 @@ test_consensus_for_umbw(networkstatus_t *con, time_t now)
   tt_assert(con);
   tt_assert(!con->cert);
   // tt_assert(con->consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW_KB);
-  tt_assert(con->consensus_method >= 16);
+  tt_int_op(con->consensus_method, OP_GE, 16);
   tt_int_op(4,OP_EQ, smartlist_len(con->routerstatus_list));
   /* There should be four listed routers; all voters saw the same in this */
 
@@ -3427,15 +3425,17 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
    * Return values are {2, 3, 4} */
 
   /* We want 3 ("*" means match all addresses) */
-  tt_assert(routerset_contains_routerstatus(routerset_all,  rs_a, 0) == 3);
-  tt_assert(routerset_contains_routerstatus(routerset_all,  rs_b, 0) == 3);
+  tt_int_op(routerset_contains_routerstatus(routerset_all, rs_a, 0), OP_EQ, 3);
+  tt_int_op(routerset_contains_routerstatus(routerset_all, rs_b, 0), OP_EQ, 3);
 
   /* We want 4 (match id_digest [or nickname]) */
-  tt_assert(routerset_contains_routerstatus(routerset_a,    rs_a, 0) == 4);
-  tt_assert(routerset_contains_routerstatus(routerset_a,    rs_b, 0) == 0);
+  tt_int_op(routerset_contains_routerstatus(routerset_a, rs_a, 0), OP_EQ, 4);
+  tt_int_op(routerset_contains_routerstatus(routerset_a, rs_b, 0), OP_EQ, 0);
 
-  tt_assert(routerset_contains_routerstatus(routerset_none, rs_a, 0) == 0);
-  tt_assert(routerset_contains_routerstatus(routerset_none, rs_b, 0) == 0);
+  tt_int_op(routerset_contains_routerstatus(routerset_none, rs_a, 0), OP_EQ,
+            0);
+  tt_int_op(routerset_contains_routerstatus(routerset_none, rs_b, 0), OP_EQ,
+            0);
 
   /* Check that "*" sets flags on all routers: Exit
    * Check the flags aren't being confused with each other */
@@ -3447,17 +3447,17 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   mock_options->TestingDirAuthVoteExitIsStrict = 0;
 
   dirserv_set_routerstatus_testing(rs_a);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 2);
+  tt_int_op(mock_get_options_calls, OP_EQ, 2);
 
-  tt_assert(rs_a->is_exit == 1);
-  tt_assert(rs_b->is_exit == 1);
+  tt_uint_op(rs_a->is_exit, OP_EQ, 1);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 1);
   /* Be paranoid - check no other flags are set */
-  tt_assert(rs_a->is_possible_guard == 0);
-  tt_assert(rs_b->is_possible_guard == 0);
-  tt_assert(rs_a->is_hs_dir == 0);
-  tt_assert(rs_b->is_hs_dir == 0);
+  tt_uint_op(rs_a->is_possible_guard, OP_EQ, 0);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 0);
+  tt_uint_op(rs_a->is_hs_dir, OP_EQ, 0);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 0);
 
   /* Check that "*" sets flags on all routers: Guard & HSDir
    * Cover the remaining flags in one test */
@@ -3471,17 +3471,17 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   mock_options->TestingDirAuthVoteHSDirIsStrict = 0;
 
   dirserv_set_routerstatus_testing(rs_a);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 2);
+  tt_int_op(mock_get_options_calls, OP_EQ, 2);
 
-  tt_assert(rs_a->is_possible_guard == 1);
-  tt_assert(rs_b->is_possible_guard == 1);
-  tt_assert(rs_a->is_hs_dir == 1);
-  tt_assert(rs_b->is_hs_dir == 1);
+  tt_uint_op(rs_a->is_possible_guard, OP_EQ, 1);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 1);
+  tt_uint_op(rs_a->is_hs_dir, OP_EQ, 1);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 1);
   /* Be paranoid - check exit isn't set */
-  tt_assert(rs_a->is_exit == 0);
-  tt_assert(rs_b->is_exit == 0);
+  tt_uint_op(rs_a->is_exit, OP_EQ, 0);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 0);
 
   /* Check routerset A sets all flags on router A,
    * but leaves router B unmodified */
@@ -3497,16 +3497,16 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   mock_options->TestingDirAuthVoteHSDirIsStrict = 0;
 
   dirserv_set_routerstatus_testing(rs_a);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 2);
+  tt_int_op(mock_get_options_calls, OP_EQ, 2);
 
-  tt_assert(rs_a->is_exit == 1);
-  tt_assert(rs_b->is_exit == 0);
-  tt_assert(rs_a->is_possible_guard == 1);
-  tt_assert(rs_b->is_possible_guard == 0);
-  tt_assert(rs_a->is_hs_dir == 1);
-  tt_assert(rs_b->is_hs_dir == 0);
+  tt_uint_op(rs_a->is_exit, OP_EQ, 1);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 0);
+  tt_uint_op(rs_a->is_possible_guard, OP_EQ, 1);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 0);
+  tt_uint_op(rs_a->is_hs_dir, OP_EQ, 1);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 0);
 
   /* Check routerset A unsets all flags on router B when Strict is set */
   reset_options(mock_options, &mock_get_options_calls);
@@ -3524,11 +3524,11 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   rs_b->is_hs_dir = 1;
 
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
 
-  tt_assert(rs_b->is_exit == 0);
-  tt_assert(rs_b->is_possible_guard == 0);
-  tt_assert(rs_b->is_hs_dir == 0);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 0);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 0);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 0);
 
   /* Check routerset A doesn't modify flags on router B without Strict set */
   reset_options(mock_options, &mock_get_options_calls);
@@ -3546,11 +3546,11 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   rs_b->is_hs_dir = 1;
 
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
 
-  tt_assert(rs_b->is_exit == 1);
-  tt_assert(rs_b->is_possible_guard == 1);
-  tt_assert(rs_b->is_hs_dir == 1);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 1);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 1);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 1);
 
   /* Check the empty routerset zeroes all flags
    * on routers A & B with Strict set */
@@ -3569,11 +3569,11 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   rs_b->is_hs_dir = 1;
 
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
 
-  tt_assert(rs_b->is_exit == 0);
-  tt_assert(rs_b->is_possible_guard == 0);
-  tt_assert(rs_b->is_hs_dir == 0);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 0);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 0);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 0);
 
   /* Check the empty routerset doesn't modify any flags
    * on A or B without Strict set */
@@ -3593,16 +3593,16 @@ test_dir_dirserv_set_routerstatus_testing(void *arg)
   rs_b->is_hs_dir = 1;
 
   dirserv_set_routerstatus_testing(rs_a);
-  tt_assert(mock_get_options_calls == 1);
+  tt_int_op(mock_get_options_calls, OP_EQ, 1);
   dirserv_set_routerstatus_testing(rs_b);
-  tt_assert(mock_get_options_calls == 2);
+  tt_int_op(mock_get_options_calls, OP_EQ, 2);
 
-  tt_assert(rs_a->is_exit == 0);
-  tt_assert(rs_a->is_possible_guard == 0);
-  tt_assert(rs_a->is_hs_dir == 0);
-  tt_assert(rs_b->is_exit == 1);
-  tt_assert(rs_b->is_possible_guard == 1);
-  tt_assert(rs_b->is_hs_dir == 1);
+  tt_uint_op(rs_a->is_exit, OP_EQ, 0);
+  tt_uint_op(rs_a->is_possible_guard, OP_EQ, 0);
+  tt_uint_op(rs_a->is_hs_dir, OP_EQ, 0);
+  tt_uint_op(rs_b->is_exit, OP_EQ, 1);
+  tt_uint_op(rs_b->is_possible_guard, OP_EQ, 1);
+  tt_uint_op(rs_b->is_hs_dir, OP_EQ, 1);
 
  done:
   tor_free(mock_options);
@@ -4259,9 +4259,9 @@ test_dir_download_status_increment(void *arg)
             >= current_time + no_delay);
   tt_assert(download_status_get_next_attempt_at(&dls_failure)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* regression test for 17750: initial delay */
   mock_options->TestingClientDownloadSchedule = schedule;
@@ -4272,9 +4272,9 @@ test_dir_download_status_increment(void *arg)
             >= current_time + delay0);
   tt_assert(download_status_get_next_attempt_at(&dls_failure)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* regression test for 17750: exponential, no initial delay */
   mock_options->TestingClientDownloadSchedule = schedule_no_initial_delay;
@@ -4285,9 +4285,9 @@ test_dir_download_status_increment(void *arg)
             >= current_time + no_delay);
   tt_assert(download_status_get_next_attempt_at(&dls_exp)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_exp) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_exp) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_exp), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_exp), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* regression test for 17750: exponential, initial delay */
   mock_options->TestingClientDownloadSchedule = schedule;
@@ -4298,9 +4298,9 @@ test_dir_download_status_increment(void *arg)
             >= current_time + delay0);
   tt_assert(download_status_get_next_attempt_at(&dls_exp)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_exp) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_exp) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_exp), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_exp), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that a failure reset works */
   mock_get_options_calls = 0;
@@ -4311,48 +4311,41 @@ test_dir_download_status_increment(void *arg)
             >= current_time + delay0);
   tt_assert(download_status_get_next_attempt_at(&dls_failure)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* avoid timing inconsistencies */
   dls_failure.next_attempt_at = current_time + delay0;
 
   /* check that a reset schedule becomes ready at the right time */
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay0 - 1,
-                                     1) == 0);
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay0,
-                                     1) == 1);
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay0 + 1,
-                                     1) == 1);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay0 - 1, 1),
+            OP_EQ, 0);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay0, 1),
+            OP_EQ, 1);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay0 + 1, 1),
+            OP_EQ, 1);
 
   /* Check that a failure increment works */
   mock_get_options_calls = 0;
   next_at = download_status_increment_failure(&dls_failure, 404, "test", 0,
                                               current_time);
   tt_assert(next_at == current_time + delay1);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 1);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 1);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 1);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 1);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* check that an incremented schedule becomes ready at the right time */
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay1 - 1,
-                                     1) == 0);
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay1,
-                                     1) == 1);
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay1 + 1,
-                                     1) == 1);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1 - 1, 1),
+            OP_EQ, 0);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1, 1),
+            OP_EQ, 1);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1 + 1, 1),
+            OP_EQ, 1);
 
   /* check that a schedule isn't ready if it's had too many failures */
-  tt_assert(download_status_is_ready(&dls_failure,
-                                     current_time + delay1 + 10,
-                                     0) == 0);
+  tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1 + 10, 0),
+            OP_EQ, 0);
 
   /* Check that failure increments do happen on 503 for clients, and
    * attempt increments do too. */
@@ -4362,25 +4355,25 @@ test_dir_download_status_increment(void *arg)
   tt_i64_op(next_at, OP_EQ, current_time + delay2);
   tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 2);
   tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 2);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that failure increments do happen on 503 for servers */
   mock_get_options_calls = 0;
   next_at = download_status_increment_failure(&dls_failure, 503, "test", 1,
                                               current_time);
   tt_assert(next_at == current_time + delay2);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 3);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 3);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 3);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 3);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check what happens when we run off the end of the schedule */
   mock_get_options_calls = 0;
   next_at = download_status_increment_failure(&dls_failure, 404, "test", 0,
                                               current_time);
   tt_assert(next_at == current_time + delay2);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 4);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 4);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 4);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 4);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check what happens when we hit the failure limit */
   mock_get_options_calls = 0;
@@ -4388,22 +4381,22 @@ test_dir_download_status_increment(void *arg)
   next_at = download_status_increment_failure(&dls_failure, 404, "test", 0,
                                               current_time);
   tt_assert(next_at == TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(download_status_get_n_attempts(&dls_failure)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that a failure reset doesn't reset at the limit */
   mock_get_options_calls = 0;
   download_status_reset(&dls_failure);
   tt_assert(download_status_get_next_attempt_at(&dls_failure)
             == TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(download_status_get_n_attempts(&dls_failure)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(mock_get_options_calls == 0);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(mock_get_options_calls, OP_EQ, 0);
 
   /* Check that a failure reset resets just before the limit */
   mock_get_options_calls = 0;
@@ -4416,9 +4409,9 @@ test_dir_download_status_increment(void *arg)
             >= current_time + delay0);
   tt_assert(download_status_get_next_attempt_at(&dls_failure)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that failure increments do happen on attempt-based schedules,
    * but that the retry is set at the end of time */
@@ -4426,9 +4419,9 @@ test_dir_download_status_increment(void *arg)
   next_at = download_status_increment_failure(&dls_attempt, 404, "test", 0,
                                               current_time);
   tt_assert(next_at == TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_attempt) == 1);
-  tt_assert(download_status_get_n_attempts(&dls_attempt) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ, 1);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that an attempt reset works */
   mock_get_options_calls = 0;
@@ -4439,65 +4432,58 @@ test_dir_download_status_increment(void *arg)
             >= current_time + delay0);
   tt_assert(download_status_get_next_attempt_at(&dls_attempt)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_attempt) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_attempt) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* avoid timing inconsistencies */
   dls_attempt.next_attempt_at = current_time + delay0;
 
   /* check that a reset schedule becomes ready at the right time */
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay0 - 1,
-                                     1) == 0);
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay0,
-                                     1) == 1);
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay0 + 1,
-                                     1) == 1);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay0 - 1, 1),
+            OP_EQ, 0);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay0, 1),
+            OP_EQ, 1);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay0 + 1, 1),
+            OP_EQ, 1);
 
   /* Check that an attempt increment works */
   mock_get_options_calls = 0;
   next_at = download_status_increment_attempt(&dls_attempt, "test",
                                               current_time);
   tt_assert(next_at == current_time + delay1);
-  tt_assert(download_status_get_n_failures(&dls_attempt) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_attempt) == 1);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ, 1);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* check that an incremented schedule becomes ready at the right time */
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay1 - 1,
-                                     1) == 0);
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay1,
-                                     1) == 1);
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay1 + 1,
-                                     1) == 1);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1 - 1, 1),
+            OP_EQ, 0);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1, 1),
+            OP_EQ, 1);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1 + 1, 1),
+            OP_EQ, 1);
 
   /* check that a schedule isn't ready if it's had too many attempts */
-  tt_assert(download_status_is_ready(&dls_attempt,
-                                     current_time + delay1 + 10,
-                                     0) == 0);
+  tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1 + 10, 0),
+            OP_EQ, 0);
 
   /* Check what happens when we reach then run off the end of the schedule */
   mock_get_options_calls = 0;
   next_at = download_status_increment_attempt(&dls_attempt, "test",
                                               current_time);
   tt_assert(next_at == current_time + delay2);
-  tt_assert(download_status_get_n_failures(&dls_attempt) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_attempt) == 2);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ, 2);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   mock_get_options_calls = 0;
   next_at = download_status_increment_attempt(&dls_attempt, "test",
                                               current_time);
   tt_assert(next_at == current_time + delay2);
-  tt_assert(download_status_get_n_failures(&dls_attempt) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_attempt) == 3);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ, 3);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check what happens when we hit the attempt limit */
   mock_get_options_calls = 0;
@@ -4505,22 +4491,22 @@ test_dir_download_status_increment(void *arg)
   next_at = download_status_increment_attempt(&dls_attempt, "test",
                                               current_time);
   tt_assert(next_at == TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_attempt)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(download_status_get_n_attempts(&dls_attempt)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that an attempt reset doesn't reset at the limit */
   mock_get_options_calls = 0;
   download_status_reset(&dls_attempt);
   tt_assert(download_status_get_next_attempt_at(&dls_attempt)
             == TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_attempt)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(download_status_get_n_attempts(&dls_attempt)
-            == IMPOSSIBLE_TO_DOWNLOAD);
-  tt_assert(mock_get_options_calls == 0);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ,
+            IMPOSSIBLE_TO_DOWNLOAD);
+  tt_int_op(mock_get_options_calls, OP_EQ, 0);
 
   /* Check that an attempt reset resets just before the limit */
   mock_get_options_calls = 0;
@@ -4533,9 +4519,9 @@ test_dir_download_status_increment(void *arg)
             >= current_time + delay0);
   tt_assert(download_status_get_next_attempt_at(&dls_attempt)
             != TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_attempt) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_attempt) == 0);
-  tt_assert(mock_get_options_calls >= 1);
+  tt_int_op(download_status_get_n_failures(&dls_attempt), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_attempt), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_GE, 1);
 
   /* Check that attempt increments don't happen on failure-based schedules,
    * and that the attempt is set at the end of time */
@@ -4548,9 +4534,9 @@ test_dir_download_status_increment(void *arg)
     "schedule.");
   teardown_capture_of_logs();
   tt_assert(next_at == TIME_MAX);
-  tt_assert(download_status_get_n_failures(&dls_failure) == 0);
-  tt_assert(download_status_get_n_attempts(&dls_failure) == 0);
-  tt_assert(mock_get_options_calls == 0);
+  tt_int_op(download_status_get_n_failures(&dls_failure), OP_EQ, 0);
+  tt_int_op(download_status_get_n_attempts(&dls_failure), OP_EQ, 0);
+  tt_int_op(mock_get_options_calls, OP_EQ, 0);
 
  done:
   /* the pointers in schedule are allocated on the stack */
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 1f008d93b..e63226eb7 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -595,20 +595,20 @@ test_entry_guard_parse_from_state_full(void *arg)
   MOCK(get_or_state,
        get_or_state_replacement);
 
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_assert(lines);
 
   state->Guard = lines;
 
   /* Try it first without setting the result. */
   r = entry_guards_parse_state(state, 0, &msg);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   guard_selection_t *gs_br =
     get_guard_selection_by_name("bridges", GS_TYPE_BRIDGE, 0);
   tt_assert(!gs_br);
 
   r = entry_guards_parse_state(state, 1, &msg);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   gs_br = get_guard_selection_by_name("bridges", GS_TYPE_BRIDGE, 0);
   guard_selection_t *gs_df =
     get_guard_selection_by_name("default", GS_TYPE_NORMAL, 0);
@@ -625,7 +625,7 @@ test_entry_guard_parse_from_state_full(void *arg)
 
   /* Try again; make sure it doesn't double-add the guards. */
   r = entry_guards_parse_state(state, 1, &msg);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   gs_br = get_guard_selection_by_name("bridges", GS_TYPE_BRIDGE, 0);
   gs_df = get_guard_selection_by_name("default", GS_TYPE_NORMAL, 0);
   tt_assert(gs_br);
@@ -730,7 +730,7 @@ test_entry_guard_parse_from_state_broken(void *arg)
   MOCK(get_or_state,
        get_or_state_replacement);
 
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_assert(lines);
 
   state->Guard = lines;
@@ -847,15 +847,15 @@ test_entry_guard_add_single_guard(void *arg)
   tt_i64_op(g1->sampled_on_date, OP_GE, now - 12*86400);
   tt_i64_op(g1->sampled_on_date, OP_LE, now);
   tt_str_op(g1->sampled_by_version, OP_EQ, VERSION);
-  tt_assert(g1->currently_listed == 1);
+  tt_uint_op(g1->currently_listed, OP_EQ, 1);
   tt_i64_op(g1->confirmed_on_date, OP_EQ, 0);
   tt_int_op(g1->confirmed_idx, OP_EQ, -1);
   tt_int_op(g1->last_tried_to_connect, OP_EQ, 0);
   tt_uint_op(g1->is_reachable, OP_EQ, GUARD_REACHABLE_MAYBE);
   tt_i64_op(g1->failing_since, OP_EQ, 0);
-  tt_assert(g1->is_filtered_guard == 1);
-  tt_assert(g1->is_usable_filtered_guard == 1);
-  tt_assert(g1->is_primary == 0);
+  tt_uint_op(g1->is_filtered_guard, OP_EQ, 1);
+  tt_uint_op(g1->is_usable_filtered_guard, OP_EQ, 1);
+  tt_uint_op(g1->is_primary, OP_EQ, 0);
   tt_assert(g1->extra_state_fields == NULL);
 
   /* Make sure it got added. */
@@ -886,16 +886,16 @@ test_entry_guard_node_filter(void *arg)
     g[i] = entry_guard_add_to_sample(gs, n[i]);
 
     // everything starts out filtered-in
-    tt_assert(g[i]->is_filtered_guard == 1);
-    tt_assert(g[i]->is_usable_filtered_guard == 1);
+    tt_uint_op(g[i]->is_filtered_guard, OP_EQ, 1);
+    tt_uint_op(g[i]->is_usable_filtered_guard, OP_EQ, 1);
   }
   tt_int_op(num_reachable_filtered_guards(gs, NULL), OP_EQ, NUM);
 
   /* Make sure refiltering doesn't hurt */
   entry_guards_update_filtered_sets(gs);
   for (i = 0; i < NUM; ++i) {
-    tt_assert(g[i]->is_filtered_guard == 1);
-    tt_assert(g[i]->is_usable_filtered_guard == 1);
+    tt_uint_op(g[i]->is_filtered_guard, OP_EQ, 1);
+    tt_uint_op(g[i]->is_usable_filtered_guard, OP_EQ, 1);
   }
   tt_int_op(num_reachable_filtered_guards(gs, NULL), OP_EQ, NUM);
 
@@ -948,8 +948,8 @@ test_entry_guard_node_filter(void *arg)
   });
   entry_guards_update_filtered_sets(gs);
   for (i = 0; i < NUM; ++i) {
-    tt_assert(g[i]->is_filtered_guard == 0);
-    tt_assert(g[i]->is_usable_filtered_guard == 0);
+    tt_uint_op(g[i]->is_filtered_guard, OP_EQ, 0);
+    tt_uint_op(g[i]->is_usable_filtered_guard, OP_EQ, 0);
   }
   tt_int_op(num_reachable_filtered_guards(gs, NULL), OP_EQ, 0);
 
@@ -1707,7 +1707,7 @@ test_entry_guard_select_for_circuit_no_confirmed(void *arg)
   tt_assert(g);
   tt_assert(g->is_primary);
   tt_int_op(g->confirmed_idx, OP_EQ, -1);
-  tt_assert(g->is_pending == 0); // primary implies non-pending.
+  tt_uint_op(g->is_pending, OP_EQ, 0); // primary implies non-pending.
   tt_uint_op(state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
   tt_i64_op(g->last_tried_to_connect, OP_EQ, approx_time());
 
@@ -1727,7 +1727,7 @@ test_entry_guard_select_for_circuit_no_confirmed(void *arg)
   tt_assert(g2);
   tt_assert(g2->is_primary);
   tt_int_op(g2->confirmed_idx, OP_EQ, -1);
-  tt_assert(g2->is_pending == 0); // primary implies non-pending.
+  tt_uint_op(g2->is_pending, OP_EQ, 0); // primary implies non-pending.
   tt_uint_op(state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
   tt_i64_op(g2->last_tried_to_connect, OP_EQ, approx_time());
 
@@ -1755,7 +1755,7 @@ test_entry_guard_select_for_circuit_no_confirmed(void *arg)
   tt_assert(g2);
   tt_assert(!g2->is_primary);
   tt_int_op(g2->confirmed_idx, OP_EQ, -1);
-  tt_assert(g2->is_pending == 1);
+  tt_uint_op(g2->is_pending, OP_EQ, 1);
   tt_uint_op(state, OP_EQ, GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD);
   tt_i64_op(g2->last_tried_to_connect, OP_EQ, approx_time());
   tt_int_op(g2->is_reachable, OP_EQ, GUARD_REACHABLE_MAYBE);
@@ -1813,7 +1813,7 @@ test_entry_guard_select_for_circuit_confirmed(void *arg)
   tt_assert(g);
   tt_assert(g->is_primary);
   tt_int_op(g->confirmed_idx, OP_EQ, 0);
-  tt_assert(g->is_pending == 0); // primary implies non-pending.
+  tt_uint_op(g->is_pending, OP_EQ, 0); // primary implies non-pending.
   tt_uint_op(state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
   tt_i64_op(g->last_tried_to_connect, OP_EQ, approx_time());
   tt_ptr_op(g, OP_EQ, smartlist_get(gs->primary_entry_guards, 0));
@@ -1913,7 +1913,7 @@ test_entry_guard_select_for_circuit_highlevel_primary(void *arg)
   int r = entry_guard_pick_for_circuit(gs, GUARD_USAGE_TRAFFIC, NULL,
                                        &node, &guard);
 
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_assert(node);
   tt_assert(guard);
   tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
@@ -1945,7 +1945,7 @@ test_entry_guard_select_for_circuit_highlevel_primary(void *arg)
   update_approx_time(start+35);
   r = entry_guard_pick_for_circuit(gs, GUARD_USAGE_TRAFFIC, NULL,
                                    &node, &guard);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_assert(node);
   tt_assert(guard);
   tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
@@ -1981,7 +1981,7 @@ test_entry_guard_select_for_circuit_highlevel_primary(void *arg)
   update_approx_time(start+60);
   r = entry_guard_pick_for_circuit(gs, GUARD_USAGE_TRAFFIC, NULL,
                                    &node, &guard);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_assert(node);
   tt_assert(guard);
   tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
@@ -2036,7 +2036,7 @@ test_entry_guard_select_for_circuit_highlevel_confirm_other(void *arg)
                                      &node, &guard);
     tt_assert(node);
     tt_assert(guard);
-    tt_assert(r == 0);
+    tt_int_op(r, OP_EQ, 0);
     tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
     entry_guard_failed(&guard);
     circuit_guard_state_free(guard);
@@ -2050,7 +2050,7 @@ test_entry_guard_select_for_circuit_highlevel_confirm_other(void *arg)
                                    &node, &guard);
   tt_assert(node);
   tt_assert(guard);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   entry_guard_t *g = entry_guard_handle_get(guard->guard);
   tt_assert(g);
   tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD);
@@ -2102,7 +2102,7 @@ test_entry_guard_select_for_circuit_highlevel_primary_retry(void *arg)
                                      &node, &guard);
     tt_assert(node);
     tt_assert(guard);
-    tt_assert(r == 0);
+    tt_int_op(r, OP_EQ, 0);
     tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
     g = entry_guard_handle_get(guard->guard);
     make_guard_confirmed(gs, g);
@@ -2119,7 +2119,7 @@ test_entry_guard_select_for_circuit_highlevel_primary_retry(void *arg)
                                    &node, &guard);
   tt_assert(node);
   tt_assert(guard);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD);
   g = entry_guard_handle_get(guard->guard);
   tt_int_op(g->is_primary, OP_EQ, 0);
@@ -2145,7 +2145,7 @@ test_entry_guard_select_for_circuit_highlevel_primary_retry(void *arg)
   /* Have a circuit to a primary guard succeed. */
   r = entry_guard_pick_for_circuit(gs, GUARD_USAGE_TRAFFIC, NULL,
                                    &node, &guard2);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_int_op(guard2->state, OP_EQ, GUARD_CIRC_STATE_USABLE_ON_COMPLETION);
   u = entry_guard_succeeded(&guard2);
   tt_assert(u == GUARD_USABLE_NOW);
@@ -2194,7 +2194,7 @@ test_entry_guard_select_and_cancel(void *arg)
                                    &node, &guard);
   tt_assert(node);
   tt_assert(guard);
-  tt_assert(r == 0);
+  tt_int_op(r, OP_EQ, 0);
   tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD);
   g = entry_guard_handle_get(guard->guard);
   tt_int_op(g->is_primary, OP_EQ, 0);
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index e98d9f354..4c0580cff 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -189,7 +189,7 @@ mock_connection_connect_sockaddr(connection_t *conn,
   /* We really should call tor_libevent_initialize() here. Because we don't,
    * we are relying on other parts of the code not checking if the_event_base
    * (and therefore event->ev_base) is NULL.  */
-  tt_assert(connection_add_connecting(conn) == 0);
+  tt_int_op(connection_add_connecting(conn), OP_EQ, 0);
 
  done:
   /* Fake "connected" status */
@@ -222,7 +222,7 @@ test_conn_get_connection(uint8_t state, uint8_t type, uint8_t purpose)
   mock_connection_connect_sockaddr_called = 0;
   in_progress = connection_connect(conn, TEST_CONN_ADDRESS_PORT, &addr,
                                    TEST_CONN_PORT, &socket_err);
-  tt_assert(mock_connection_connect_sockaddr_called == 1);
+  tt_int_op(mock_connection_connect_sockaddr_called, OP_EQ, 1);
   tt_assert(!socket_err);
   tt_assert(in_progress == 0 || in_progress == 1);
 
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index fbafe9bf8..719ca94cb 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -671,14 +671,14 @@ test_single_onion_poisoning(void *arg)
    * The data directory is required for the lockfile, which is used when
    * loading keys. */
   ret = check_private_dir(mock_options->DataDirectory, CPD_CREATE, NULL);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   if (create_dir_mask & CREATE_HS_DIR1) {
     ret = check_private_dir(dir1, CPD_CREATE, NULL);
-    tt_assert(ret == 0);
+    tt_int_op(ret, OP_EQ, 0);
   }
   if (create_dir_mask & CREATE_HS_DIR2) {
     ret = check_private_dir(dir2, CPD_CREATE, NULL);
-    tt_assert(ret == 0);
+    tt_int_op(ret, OP_EQ, 0);
   }
 
   service_1->directory = dir1;
@@ -705,17 +705,17 @@ test_single_onion_poisoning(void *arg)
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Either way, no problem. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Add the first service */
   ret = hs_check_service_private_dir(mock_options->User, service_1->directory,
@@ -728,75 +728,75 @@ test_single_onion_poisoning(void *arg)
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Either way, no problem. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Poison! Poison! Poison!
    * This can only be done in HiddenServiceSingleHopMode. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_poison_new_single_onion_dir(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   /* Poisoning twice is a no-op. */
   ret = rend_service_poison_new_single_onion_dir(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Poisoned service directories, but no previous keys, no problem! */
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Either way, no problem. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Now add some keys, and we'll have a problem. */
   ret = rend_service_load_all_keys(services);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Poisoned service directories with previous keys are not allowed. */
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret < 0);
+  tt_int_op(ret, OP_LT, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* But they are allowed if we're in non-anonymous mode. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Re-poisoning directories with existing keys is a no-op, because
    * directories with existing keys are ignored. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_poison_new_single_onion_dir(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   /* And it keeps the poison. */
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Now add the second service: it has no key and no poison file */
   ret = hs_check_service_private_dir(mock_options->User, service_2->directory,
@@ -808,77 +808,77 @@ test_single_onion_poisoning(void *arg)
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret < 0);
+  tt_int_op(ret, OP_LT, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* But ok to add in non-anonymous mode. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Now remove the poisoning from the first service, and we have the opposite
    * problem. */
   poison_path = rend_service_sos_poison_path(service_1);
   tt_assert(poison_path);
   ret = unlink(poison_path);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Unpoisoned service directories with previous keys are ok, as are empty
    * directories. */
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* But the existing unpoisoned key is not ok in non-anonymous mode, even if
    * there is an empty service. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret < 0);
+  tt_int_op(ret, OP_LT, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Poisoning directories with existing keys is a no-op, because directories
    * with existing keys are ignored. But the new directory should poison. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_poison_new_single_onion_dir(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_poison_new_single_onion_dir(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   /* And the old directory remains unpoisoned. */
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret < 0);
+  tt_int_op(ret, OP_LT, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* And the new directory should be ignored, because it has no key. */
   mock_options->HiddenServiceSingleHopMode = 0;
   mock_options->HiddenServiceNonAnonymousMode = 0;
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Re-poisoning directories without existing keys is a no-op. */
   mock_options->HiddenServiceSingleHopMode = 1;
   mock_options->HiddenServiceNonAnonymousMode = 1;
   ret = rend_service_poison_new_single_onion_dir(service_1, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = rend_service_poison_new_single_onion_dir(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   /* And the old directory remains unpoisoned. */
   ret = rend_service_verify_single_onion_poison(service_1, mock_options);
-  tt_assert(ret < 0);
+  tt_int_op(ret, OP_LT, 0);
   ret = rend_service_verify_single_onion_poison(service_2, mock_options);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
  done:
   /* The test harness deletes the directories at exit */
diff --git a/src/test/test_options.c b/src/test/test_options.c
index ad735b72a..4ce477ee5 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -430,24 +430,24 @@ get_options_test_data(const char *conf)
   result->opt->ConnectionPadding = -1; // default must be "auto"
 
   rv = config_get_lines(conf, &cl, 1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   rv = config_assign(&options_format, result->opt, cl, 0, &msg);
   if (msg) {
     /* Display the parse error message by comparing it with an empty string */
     tt_str_op(msg, OP_EQ, "");
   }
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   config_free_lines(cl);
   result->opt->LogTimeGranularity = 1;
   result->opt->TokenBucketRefillInterval = 1;
   rv = config_get_lines(TEST_OPTIONS_OLD_VALUES, &cl, 1);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   rv = config_assign(&options_format, result->def_opt, cl, 0, &msg);
   if (msg) {
     /* Display the parse error message by comparing it with an empty string */
     tt_str_op(msg, OP_EQ, "");
   }
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
 
  done:
   config_free_lines(cl);
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 1b2fac432..9d3f660c2 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -1148,7 +1148,7 @@ test_policies_reject_exit_address(void *arg)
   /* test that IPv4 addresses are rejected on an IPv4-only exit */
   policies_parse_exit_policy_reject_private(&policy, 0, ipv4_list, 0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 1);
+  tt_int_op(smartlist_len(policy), OP_EQ, 1);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_addr));
   addr_policy_list_free(policy);
   policy = NULL;
@@ -1163,7 +1163,7 @@ test_policies_reject_exit_address(void *arg)
   /* test that only IPv4 addresses are rejected on an IPv4-only exit */
   policies_parse_exit_policy_reject_private(&policy, 0, both_list, 0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 1);
+  tt_int_op(smartlist_len(policy), OP_EQ, 1);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_addr));
   addr_policy_list_free(policy);
   policy = NULL;
@@ -1171,7 +1171,7 @@ test_policies_reject_exit_address(void *arg)
   /* Test that lists with duplicate entries produce the same results */
   policies_parse_exit_policy_reject_private(&policy, 0, dupl_list, 0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 1);
+  tt_int_op(smartlist_len(policy), OP_EQ, 1);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_addr));
   addr_policy_list_free(policy);
   policy = NULL;
@@ -1181,7 +1181,7 @@ test_policies_reject_exit_address(void *arg)
   /* test that IPv4 addresses are rejected on an IPv4/IPv6 exit */
   policies_parse_exit_policy_reject_private(&policy, 1, ipv4_list, 0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 1);
+  tt_int_op(smartlist_len(policy), OP_EQ, 1);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_addr));
   addr_policy_list_free(policy);
   policy = NULL;
@@ -1189,7 +1189,7 @@ test_policies_reject_exit_address(void *arg)
   /* test that IPv6 addresses are rejected on an IPv4/IPv6 exit */
   policies_parse_exit_policy_reject_private(&policy, 1, ipv6_list,  0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 1);
+  tt_int_op(smartlist_len(policy), OP_EQ, 1);
   tt_assert(test_policy_has_address_helper(policy, &ipv6_addr));
   addr_policy_list_free(policy);
   policy = NULL;
@@ -1197,7 +1197,7 @@ test_policies_reject_exit_address(void *arg)
   /* test that IPv4 and IPv6 addresses are rejected on an IPv4/IPv6 exit */
   policies_parse_exit_policy_reject_private(&policy, 1, both_list,  0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 2);
+  tt_int_op(smartlist_len(policy), OP_EQ, 2);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_addr));
   tt_assert(test_policy_has_address_helper(policy, &ipv6_addr));
   addr_policy_list_free(policy);
@@ -1206,7 +1206,7 @@ test_policies_reject_exit_address(void *arg)
   /* Test that lists with duplicate entries produce the same results */
   policies_parse_exit_policy_reject_private(&policy, 1, dupl_list,  0, 0);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 2);
+  tt_int_op(smartlist_len(policy), OP_EQ, 2);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_addr));
   tt_assert(test_policy_has_address_helper(policy, &ipv6_addr));
   addr_policy_list_free(policy);
@@ -1258,7 +1258,7 @@ test_policies_reject_port_address(void *arg)
    * with IPv6 addresses on IPv4-only exits) */
   policies_parse_exit_policy_reject_private(&policy, 0, NULL, 0, 1);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 1);
+  tt_int_op(smartlist_len(policy), OP_EQ, 1);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_port->addr));
   addr_policy_list_free(policy);
   policy = NULL;
@@ -1266,7 +1266,7 @@ test_policies_reject_port_address(void *arg)
   /* test that IPv4 and IPv6 ports are rejected on an IPv4/IPv6 exit */
   policies_parse_exit_policy_reject_private(&policy, 1, NULL, 0, 1);
   tt_assert(policy);
-  tt_assert(smartlist_len(policy) == 2);
+  tt_int_op(smartlist_len(policy), OP_EQ, 2);
   tt_assert(test_policy_has_address_helper(policy, &ipv4_port->addr));
   tt_assert(test_policy_has_address_helper(policy, &ipv6_port->addr));
   addr_policy_list_free(policy);
@@ -1528,14 +1528,14 @@ test_policies_getinfo_helper_policies(void *arg)
   memset(&mock_my_routerinfo, 0, sizeof(mock_my_routerinfo));
 
   rv = getinfo_helper_policies(NULL, "exit-policy/default", &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) > 0);
   tor_free(answer);
 
   rv = getinfo_helper_policies(NULL, "exit-policy/reject-private/default",
                                &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) > 0);
   tor_free(answer);
@@ -1550,14 +1550,14 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/reject-private/relay",
                                &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) == 0);
   tor_free(answer);
 
   rv = getinfo_helper_policies(NULL, "exit-policy/ipv4", &answer,
                                &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   ipv4_len = strlen(answer);
   tt_assert(ipv4_len == 0 || ipv4_len == strlen(DEFAULT_POLICY_STRING));
@@ -1566,7 +1566,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/ipv6", &answer,
                                &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   ipv6_len = strlen(answer);
   tt_assert(ipv6_len == 0 || ipv6_len == strlen(DEFAULT_POLICY_STRING));
@@ -1575,7 +1575,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/full", &answer,
                                &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   /* It's either empty or it's the default */
   tt_assert(strlen(answer) == 0 || !strcasecmp(answer, DEFAULT_POLICY_STRING));
@@ -1599,7 +1599,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/reject-private/relay",
                                &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) > 0);
   tor_free(answer);
@@ -1609,7 +1609,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/reject-private/relay",
                                &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) > 0);
   tor_free(answer);
@@ -1619,7 +1619,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/reject-private/relay",
                                &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) > 0);
   tor_free(answer);
@@ -1629,14 +1629,14 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/reject-private/relay",
                                &answer, &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) == 0);
   tor_free(answer);
 
   rv = getinfo_helper_policies(NULL, "exit-policy/ipv4", &answer,
                                &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   ipv4_len = strlen(answer);
   tt_assert(ipv4_len > 0);
@@ -1644,7 +1644,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/ipv6", &answer,
                                &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   ipv6_len = strlen(answer);
   tt_assert(ipv6_len > 0);
@@ -1652,7 +1652,7 @@ test_policies_getinfo_helper_policies(void *arg)
 
   rv = getinfo_helper_policies(NULL, "exit-policy/full", &answer,
                                &errmsg);
-  tt_assert(rv == 0);
+  tt_int_op(rv, OP_EQ, 0);
   tt_assert(answer != NULL);
   tt_assert(strlen(answer) > 0);
   tt_assert(strlen(answer) == ipv4_len + ipv6_len + 1);
@@ -1746,34 +1746,34 @@ test_policies_fascist_firewall_allows_address(void *arg)
   mock_options.ClientUseIPv6 = 1;
   mock_options.UseBridges = 0;
 
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* Preferring IPv4 */
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 0),
+            OP_EQ, 0);
 
   /* Preferring IPv6 */
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 1)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 1)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 1)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 1)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 1),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 1),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 1),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 1),
+            OP_EQ, 0);
 
   /* Test the function's address matching with UseBridges on */
   memset(&mock_options, 0, sizeof(or_options_t));
@@ -1781,46 +1781,46 @@ test_policies_fascist_firewall_allows_address(void *arg)
   mock_options.ClientUseIPv6 = 1;
   mock_options.UseBridges = 1;
 
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* Preferring IPv4 */
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 0),
+            OP_EQ, 0);
 
   /* Preferring IPv6 */
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 1)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 1)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 1)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 1)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 1, 1),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 1, 1),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 1, 1),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 1, 1),
+            OP_EQ, 0);
 
   /* bridge clients always use IPv6, regardless of ClientUseIPv6 */
   mock_options.ClientUseIPv4 = 1;
   mock_options.ClientUseIPv6 = 0;
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* Test the function's address matching with IPv4 on */
   memset(&mock_options, 0, sizeof(or_options_t));
@@ -1828,14 +1828,14 @@ test_policies_fascist_firewall_allows_address(void *arg)
   mock_options.ClientUseIPv6 = 0;
   mock_options.UseBridges = 0;
 
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* Test the function's address matching with IPv6 on */
   memset(&mock_options, 0, sizeof(or_options_t));
@@ -1843,14 +1843,14 @@ test_policies_fascist_firewall_allows_address(void *arg)
   mock_options.ClientUseIPv6 = 1;
   mock_options.UseBridges = 0;
 
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* Test the function's address matching with ClientUseIPv4 0.
    * This means "use IPv6" regardless of the other settings. */
@@ -1859,14 +1859,14 @@ test_policies_fascist_firewall_allows_address(void *arg)
   mock_options.ClientUseIPv6 = 0;
   mock_options.UseBridges = 0;
 
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&r_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* Test the function's address matching for unusual inputs */
   memset(&mock_options, 0, sizeof(or_options_t));
@@ -1875,27 +1875,28 @@ test_policies_fascist_firewall_allows_address(void *arg)
   mock_options.UseBridges = 1;
 
   /* NULL and tor_addr_is_null addresses are rejected */
-  tt_assert(fascist_firewall_allows_address(NULL, port, policy, 0, 0) == 0);
-  tt_assert(fascist_firewall_allows_address(&n_ipv4_addr, port, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&n_ipv6_addr, port, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(NULL, port, policy, 0, 0), OP_EQ,
+            0);
+  tt_int_op(fascist_firewall_allows_address(&n_ipv4_addr, port, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&n_ipv6_addr, port, policy, 0, 0),
+            OP_EQ, 0);
 
   /* zero ports are rejected */
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, 0, policy, 0, 0)
-            == 0);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, 0, policy, 0, 0)
-            == 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, 0, policy, 0, 0),
+            OP_EQ, 0);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, 0, policy, 0, 0),
+            OP_EQ, 0);
 
   /* NULL and empty policies accept everything */
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, NULL, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, NULL, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv4_addr, port, e_policy, 0, 0)
-            == 1);
-  tt_assert(fascist_firewall_allows_address(&ipv6_addr, port, e_policy, 0, 0)
-            == 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, NULL, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, NULL, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv4_addr, port, e_policy, 0, 0),
+            OP_EQ, 1);
+  tt_int_op(fascist_firewall_allows_address(&ipv6_addr, port, e_policy, 0, 0),
+            OP_EQ, 1);
 
  done:
   addr_policy_free(item);
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index 79b03171b..7ab2462fd 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -40,34 +40,34 @@ test_pt_parsing(void *arg)
 
   /* incomplete cmethod */
   strlcpy(line,"CMETHOD trebuchet",sizeof(line));
-  tt_assert(parse_cmethod_line(line, mp) < 0);
+  tt_int_op(parse_cmethod_line(line, mp), OP_LT, 0);
 
   reset_mp(mp);
 
   /* wrong proxy type */
   strlcpy(line,"CMETHOD trebuchet dog 127.0.0.1:1999",sizeof(line));
-  tt_assert(parse_cmethod_line(line, mp) < 0);
+  tt_int_op(parse_cmethod_line(line, mp), OP_LT, 0);
 
   reset_mp(mp);
 
   /* wrong addrport */
   strlcpy(line,"CMETHOD trebuchet socks4 abcd",sizeof(line));
-  tt_assert(parse_cmethod_line(line, mp) < 0);
+  tt_int_op(parse_cmethod_line(line, mp), OP_LT, 0);
 
   reset_mp(mp);
 
   /* correct line */
   strlcpy(line,"CMETHOD trebuchet socks5 127.0.0.1:1999",sizeof(line));
-  tt_assert(parse_cmethod_line(line, mp) == 0);
-  tt_assert(smartlist_len(mp->transports) == 1);
+  tt_int_op(parse_cmethod_line(line, mp), OP_EQ, 0);
+  tt_int_op(smartlist_len(mp->transports), OP_EQ, 1);
   transport = smartlist_get(mp->transports, 0);
   /* test registered address of transport */
   tor_addr_parse(&test_addr, "127.0.0.1");
   tt_assert(tor_addr_eq(&test_addr, &transport->addr));
   /* test registered port of transport */
-  tt_assert(transport->port == 1999);
+  tt_uint_op(transport->port, OP_EQ, 1999);
   /* test registered SOCKS version of transport */
-  tt_assert(transport->socks_version == PROXY_SOCKS5);
+  tt_int_op(transport->socks_version, OP_EQ, PROXY_SOCKS5);
   /* test registered name of transport */
   tt_str_op(transport->name,OP_EQ, "trebuchet");
 
@@ -75,26 +75,26 @@ test_pt_parsing(void *arg)
 
   /* incomplete smethod */
   strlcpy(line,"SMETHOD trebuchet",sizeof(line));
-  tt_assert(parse_smethod_line(line, mp) < 0);
+  tt_int_op(parse_smethod_line(line, mp), OP_LT, 0);
 
   reset_mp(mp);
 
   /* wrong addr type */
   strlcpy(line,"SMETHOD trebuchet abcd",sizeof(line));
-  tt_assert(parse_smethod_line(line, mp) < 0);
+  tt_int_op(parse_smethod_line(line, mp), OP_LT, 0);
 
   reset_mp(mp);
 
   /* cowwect */
   strlcpy(line,"SMETHOD trebuchy 127.0.0.2:2999",sizeof(line));
-  tt_assert(parse_smethod_line(line, mp) == 0);
-  tt_assert(smartlist_len(mp->transports) == 1);
+  tt_int_op(parse_smethod_line(line, mp), OP_EQ, 0);
+  tt_int_op(smartlist_len(mp->transports), OP_EQ, 1);
   transport = smartlist_get(mp->transports, 0);
   /* test registered address of transport */
   tor_addr_parse(&test_addr, "127.0.0.2");
   tt_assert(tor_addr_eq(&test_addr, &transport->addr));
   /* test registered port of transport */
-  tt_assert(transport->port == 2999);
+  tt_uint_op(transport->port, OP_EQ, 2999);
   /* test registered name of transport */
   tt_str_op(transport->name,OP_EQ, "trebuchy");
 
@@ -104,7 +104,7 @@ test_pt_parsing(void *arg)
   strlcpy(line,"SMETHOD trebuchet 127.0.0.1:9999 "
           "ARGS:counterweight=3,sling=snappy",
           sizeof(line));
-  tt_assert(parse_smethod_line(line, mp) == 0);
+  tt_int_op(parse_smethod_line(line, mp), OP_EQ, 0);
   tt_int_op(1, OP_EQ, smartlist_len(mp->transports));
   {
     const transport_t *transport_ = smartlist_get(mp->transports, 0);
@@ -119,15 +119,15 @@ test_pt_parsing(void *arg)
 
   /* unsupported version */
   strlcpy(line,"VERSION 666",sizeof(line));
-  tt_assert(parse_version(line, mp) < 0);
+  tt_int_op(parse_version(line, mp), OP_LT, 0);
 
   /* incomplete VERSION */
   strlcpy(line,"VERSION ",sizeof(line));
-  tt_assert(parse_version(line, mp) < 0);
+  tt_int_op(parse_version(line, mp), OP_LT, 0);
 
   /* correct VERSION */
   strlcpy(line,"VERSION 1",sizeof(line));
-  tt_assert(parse_version(line, mp) == 0);
+  tt_int_op(parse_version(line, mp), OP_EQ, 0);
 
  done:
   reset_mp(mp);
diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c
index 5a0924430..3024b8c66 100644
--- a/src/test/test_routerkeys.c
+++ b/src/test/test_routerkeys.c
@@ -101,10 +101,10 @@ test_routerkeys_ed_certs(void *args)
     cert[i] = tor_cert_create(&kp1, 5, &kp2.pubkey, now, 10000, flags);
     tt_assert(cert[i]);
 
-    tt_assert(cert[i]->sig_bad == 0);
-    tt_assert(cert[i]->sig_ok == 1);
-    tt_assert(cert[i]->cert_expired == 0);
-    tt_assert(cert[i]->cert_valid == 1);
+    tt_uint_op(cert[i]->sig_bad, OP_EQ, 0);
+    tt_uint_op(cert[i]->sig_ok, OP_EQ, 1);
+    tt_uint_op(cert[i]->cert_expired, OP_EQ, 0);
+    tt_uint_op(cert[i]->cert_valid, OP_EQ, 1);
     tt_int_op(cert[i]->cert_type, OP_EQ, 5);
     tt_mem_op(cert[i]->signed_key.pubkey, OP_EQ, &kp2.pubkey.pubkey, 32);
     tt_mem_op(cert[i]->signing_key.pubkey, OP_EQ, &kp1.pubkey.pubkey, 32);
@@ -120,26 +120,26 @@ test_routerkeys_ed_certs(void *args)
     tt_int_op(cert[i]->encoded_len, OP_EQ, parsed_cert[i]->encoded_len);
     tt_mem_op(cert[i]->encoded, OP_EQ, parsed_cert[i]->encoded,
               cert[i]->encoded_len);
-    tt_assert(parsed_cert[i]->sig_bad == 0);
-    tt_assert(parsed_cert[i]->sig_ok == 0);
-    tt_assert(parsed_cert[i]->cert_expired == 0);
-    tt_assert(parsed_cert[i]->cert_valid == 0);
+    tt_uint_op(parsed_cert[i]->sig_bad, OP_EQ, 0);
+    tt_uint_op(parsed_cert[i]->sig_ok, OP_EQ, 0);
+    tt_uint_op(parsed_cert[i]->cert_expired, OP_EQ, 0);
+    tt_uint_op(parsed_cert[i]->cert_valid, OP_EQ, 0);
 
     /* Expired */
     tt_int_op(tor_cert_checksig(parsed_cert[i], &kp1.pubkey, now + 30000),
               OP_LT, 0);
-    tt_assert(parsed_cert[i]->cert_expired == 1);
+    tt_uint_op(parsed_cert[i]->cert_expired, OP_EQ, 1);
     parsed_cert[i]->cert_expired = 0;
 
     /* Wrong key */
     tt_int_op(tor_cert_checksig(parsed_cert[i], &kp2.pubkey, now), OP_LT, 0);
-    tt_assert(parsed_cert[i]->sig_bad== 1);
+    tt_uint_op(parsed_cert[i]->sig_bad, OP_EQ, 1);
     parsed_cert[i]->sig_bad = 0;
 
     /* Missing key */
     int ok = tor_cert_checksig(parsed_cert[i], NULL, now);
     tt_int_op(ok < 0, OP_EQ, i == 0);
-    tt_assert(parsed_cert[i]->sig_bad == 0);
+    tt_uint_op(parsed_cert[i]->sig_bad, OP_EQ, 0);
     tt_assert(parsed_cert[i]->sig_ok == (i != 0));
     tt_assert(parsed_cert[i]->cert_valid == (i != 0));
     parsed_cert[i]->sig_bad = 0;
@@ -148,10 +148,10 @@ test_routerkeys_ed_certs(void *args)
 
     /* Right key */
     tt_int_op(tor_cert_checksig(parsed_cert[i], &kp1.pubkey, now), OP_EQ, 0);
-    tt_assert(parsed_cert[i]->sig_bad == 0);
-    tt_assert(parsed_cert[i]->sig_ok == 1);
-    tt_assert(parsed_cert[i]->cert_expired == 0);
-    tt_assert(parsed_cert[i]->cert_valid == 1);
+    tt_uint_op(parsed_cert[i]->sig_bad, OP_EQ, 0);
+    tt_uint_op(parsed_cert[i]->sig_ok, OP_EQ, 1);
+    tt_uint_op(parsed_cert[i]->cert_expired, OP_EQ, 0);
+    tt_uint_op(parsed_cert[i]->cert_valid, OP_EQ, 1);
   }
 
   /* Now try some junky certs. */
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 20ee5b414..1455e4f9d 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -449,27 +449,27 @@ test_routerlist_router_is_already_dir_fetching(void *arg)
 
   /* Test that we never get 1 from a NULL connection */
   mocked_connection = NULL;
-  tt_assert(router_is_already_dir_fetching(&test_ap, 1, 1) == 0);
-  tt_assert(router_is_already_dir_fetching(&test_ap, 1, 0) == 0);
-  tt_assert(router_is_already_dir_fetching(&test_ap, 0, 1) == 0);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 1, 1), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 1, 0), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 0, 1), OP_EQ, 0);
   /* We always expect 0 in these cases */
-  tt_assert(router_is_already_dir_fetching(&test_ap, 0, 0) == 0);
-  tt_assert(router_is_already_dir_fetching(NULL, 1, 1) == 0);
-  tt_assert(router_is_already_dir_fetching(&null_addr_ap, 1, 1) == 0);
-  tt_assert(router_is_already_dir_fetching(&zero_port_ap, 1, 1) == 0);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 0, 0), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(NULL, 1, 1), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(&null_addr_ap, 1, 1), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(&zero_port_ap, 1, 1), OP_EQ, 0);
 
   /* Test that we get 1 with a connection in the appropriate circumstances */
   mocked_connection = connection_new(CONN_TYPE_DIR, AF_INET);
-  tt_assert(router_is_already_dir_fetching(&test_ap, 1, 1) == 1);
-  tt_assert(router_is_already_dir_fetching(&test_ap, 1, 0) == 1);
-  tt_assert(router_is_already_dir_fetching(&test_ap, 0, 1) == 1);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 1, 1), OP_EQ, 1);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 1, 0), OP_EQ, 1);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 0, 1), OP_EQ, 1);
 
   /* Test that we get 0 even with a connection in the appropriate
    * circumstances */
-  tt_assert(router_is_already_dir_fetching(&test_ap, 0, 0) == 0);
-  tt_assert(router_is_already_dir_fetching(NULL, 1, 1) == 0);
-  tt_assert(router_is_already_dir_fetching(&null_addr_ap, 1, 1) == 0);
-  tt_assert(router_is_already_dir_fetching(&zero_port_ap, 1, 1) == 0);
+  tt_int_op(router_is_already_dir_fetching(&test_ap, 0, 0), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(NULL, 1, 1), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(&null_addr_ap, 1, 1), OP_EQ, 0);
+  tt_int_op(router_is_already_dir_fetching(&zero_port_ap, 1, 1), OP_EQ, 0);
 
  done:
   /* If a connection is never set up, connection_free chokes on it. */
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 2b49d107c..774bb2fa7 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -743,7 +743,7 @@ test_state_load_from_disk(void *arg)
 
   /* First try with a nonexistent path. */
   ret = disk_state_load_from_disk_impl("NONEXISTENTNONEXISTENT");
-  tt_assert(ret == -ENOENT);
+  tt_int_op(ret, OP_EQ, -ENOENT);
 
   /* Now create a mock state directory and state file */
 #ifdef _WIN32
@@ -751,9 +751,9 @@ test_state_load_from_disk(void *arg)
 #else
   ret = mkdir(dir, 0700);
 #endif
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
   ret = write_str_to_file(sr_state_path, sr_state_str, 0);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Try to load the directory itself. Should fail. */
   ret = disk_state_load_from_disk_impl(dir);
@@ -765,7 +765,7 @@ test_state_load_from_disk(void *arg)
 
   /* Now try to load the correct file! */
   ret = disk_state_load_from_disk_impl(sr_state_path);
-  tt_assert(ret == 0);
+  tt_int_op(ret, OP_EQ, 0);
 
   /* Check the content of the state */
   /* XXX check more deeply!!! */
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index 94b94640c..bc83c3899 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -61,8 +61,8 @@ test_socks_4_unsupported_commands(void *ptr)
 
   /* SOCKS 4 Send BIND [02] to IP address 2.2.2.2:4369 */
   ADD_DATA(buf, "\x04\x02\x11\x11\x02\x02\x02\x02\x00");
-  tt_assert(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
-                                   get_options()->SafeSocks) == -1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, -1);
   tt_int_op(4,OP_EQ, socks->socks_version);
   tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
 
@@ -80,8 +80,8 @@ test_socks_4_supported_commands(void *ptr)
 
   /* SOCKS 4 Send CONNECT [01] to IP address 2.2.2.2:4370 */
   ADD_DATA(buf, "\x04\x01\x11\x12\x02\x02\x02\x03\x00");
-  tt_assert(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
-                                   get_options()->SafeSocks) == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, 1);
   tt_int_op(4,OP_EQ, socks->socks_version);
   tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
   tt_int_op(SOCKS_COMMAND_CONNECT,OP_EQ, socks->command);
@@ -95,8 +95,8 @@ test_socks_4_supported_commands(void *ptr)
 
   /* SOCKS 4 Send CONNECT [01] to IP address 2.2.2.2:4369 with userid*/
   ADD_DATA(buf, "\x04\x01\x11\x12\x02\x02\x02\x04me\x00");
-  tt_assert(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
-                                   get_options()->SafeSocks) == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, 1);
   tt_int_op(4,OP_EQ, socks->socks_version);
   tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
   tt_int_op(SOCKS_COMMAND_CONNECT,OP_EQ, socks->command);
@@ -112,8 +112,8 @@ test_socks_4_supported_commands(void *ptr)
 
   /* SOCKS 4a Send RESOLVE [F0] request for torproject.org */
   ADD_DATA(buf, "\x04\xF0\x01\x01\x00\x00\x00\x02me\x00torproject.org\x00");
-  tt_assert(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
-                                   get_options()->SafeSocks) == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, 1);
   tt_int_op(4,OP_EQ, socks->socks_version);
   tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
   tt_str_op("torproject.org",OP_EQ, socks->address);
@@ -218,8 +218,8 @@ test_socks_5_supported_commands(void *ptr)
   /* SOCKS 5 Send RESOLVE [F0] request for torproject.org:4369 */
   ADD_DATA(buf, "\x05\x01\x00");
   ADD_DATA(buf, "\x05\xF0\x00\x03\x0Etorproject.org\x01\x02");
-  tt_assert(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
-                                   get_options()->SafeSocks) == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, 1);
   tt_int_op(5,OP_EQ, socks->socks_version);
   tt_int_op(2,OP_EQ, socks->replylen);
   tt_int_op(5,OP_EQ, socks->reply[0]);
@@ -236,8 +236,8 @@ test_socks_5_supported_commands(void *ptr)
   ADD_DATA(buf, "\x05\xF0\x00\x03\x07");
   ADD_DATA(buf, "8.8.8.8");
   ADD_DATA(buf, "\x11\x11");
-  tt_assert(fetch_from_buf_socks(buf,socks,get_options()->TestSocks,1)
-            == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, 1),
+            OP_EQ, 1);
 
   tt_str_op("8.8.8.8", OP_EQ, socks->address);
   tt_int_op(4369, OP_EQ, socks->port);
@@ -253,8 +253,8 @@ test_socks_5_supported_commands(void *ptr)
   ADD_DATA(buf, "\x05\xF0\x00\x03\x27");
   ADD_DATA(buf, "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
   ADD_DATA(buf, "\x01\x02");
-  tt_assert(fetch_from_buf_socks(buf,socks,get_options()->TestSocks,1)
-            == -1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, 1),
+            OP_EQ, -1);
 
   tt_str_op("2001:0db8:85a3:0000:0000:8a2e:0370:7334", OP_EQ, socks->address);
   tt_int_op(258, OP_EQ, socks->port);
@@ -266,8 +266,8 @@ test_socks_5_supported_commands(void *ptr)
   /* SOCKS 5 Send RESOLVE_PTR [F1] for IP address 2.2.2.5 */
   ADD_DATA(buf, "\x05\x01\x00");
   ADD_DATA(buf, "\x05\xF1\x00\x01\x02\x02\x02\x05\x01\x03");
-  tt_assert(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
-                                   get_options()->SafeSocks) == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, 1);
   tt_int_op(5,OP_EQ, socks->socks_version);
   tt_int_op(2,OP_EQ, socks->replylen);
   tt_int_op(5,OP_EQ, socks->reply[0]);
@@ -378,9 +378,8 @@ test_socks_5_authenticate_with_data(void *ptr)
   /* SOCKS 5 Send username/password */
   /* SOCKS 5 Send CONNECT [01] to IP address 2.2.2.2:4369 */
   ADD_DATA(buf, "\x01\x02me\x03you\x05\x01\x00\x01\x02\x02\x02\x02\x11\x11");
-  tt_assert(fetch_from_buf_socks(buf, socks,
-                                   get_options()->TestSocks,
-                                   get_options()->SafeSocks) == 1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, 1);
   tt_int_op(5,OP_EQ, socks->socks_version);
   tt_int_op(2,OP_EQ, socks->replylen);
   tt_int_op(1,OP_EQ, socks->reply[0]);
@@ -406,9 +405,8 @@ test_socks_5_auth_before_negotiation(void *ptr)
 
   /* SOCKS 5 Send username/password */
   ADD_DATA(buf, "\x01\x02me\x02me");
-  tt_assert(fetch_from_buf_socks(buf, socks,
-                                   get_options()->TestSocks,
-                                   get_options()->SafeSocks) == -1);
+  tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
+            OP_EQ, -1);
   tt_int_op(0,OP_EQ, socks->socks_version);
   tt_int_op(0,OP_EQ, socks->replylen);
   tt_int_op(0,OP_EQ, socks->reply[0]);





More information about the tor-commits mailing list