[tor-commits] [tor/master] Replace the remaining test_n?eq_ptr calls

nickm at torproject.org nickm at torproject.org
Wed Sep 17 14:31:22 UTC 2014


commit 1146a6a1c5e194cc05944622628188c82771a3d4
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Sep 15 21:25:27 2014 -0400

    Replace the remaining test_n?eq_ptr calls
---
 src/test/test.h        |    2 --
 src/test/test_crypto.c |    8 ++++----
 src/test/test_util.c   |    6 +++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/test/test.h b/src/test/test.h
index 71cbb03..799f208 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -25,9 +25,7 @@
 #define test_assert(expr) tt_assert(expr)
 
 #define test_eq(expr1, expr2) tt_int_op((expr1), ==, (expr2))
-#define test_eq_ptr(expr1, expr2) tt_ptr_op((expr1), ==, (expr2))
 #define test_neq(expr1, expr2) tt_int_op((expr1), !=, (expr2))
-#define test_neq_ptr(expr1, expr2) tt_ptr_op((expr1), !=, (expr2))
 #define test_streq(expr1, expr2) tt_str_op((expr1), ==, (expr2))
 #define test_strneq(expr1, expr2) tt_str_op((expr1), !=, (expr2))
 
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 274a268..86ed86f 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -128,9 +128,9 @@ test_crypto_aes(void *arg)
   memset(data2, 0, 1024);
   memset(data3, 0, 1024);
   env1 = crypto_cipher_new(NULL);
-  test_neq_ptr(env1, 0);
+  tt_ptr_op(env1, !=, NULL);
   env2 = crypto_cipher_new(crypto_cipher_get_key(env1));
-  test_neq_ptr(env2, 0);
+  tt_ptr_op(env2, !=, NULL);
 
   /* Try encrypting 512 chars. */
   crypto_cipher_encrypt(env1, data2, data1, 512);
@@ -161,7 +161,7 @@ test_crypto_aes(void *arg)
 
   memset(data3, 0, 1024);
   env2 = crypto_cipher_new(crypto_cipher_get_key(env1));
-  test_neq_ptr(env2, NULL);
+  tt_ptr_op(env2, !=, NULL);
   for (j = 0; j < 1024-16; j += 17) {
     crypto_cipher_encrypt(env2, data3+j, data1+j, 17);
   }
@@ -498,7 +498,7 @@ test_crypto_pk(void)
   crypto_pk_free(pk2);
   pk2 = crypto_pk_copy_full(pk1);
   tt_assert(pk2 != NULL);
-  test_neq_ptr(pk1, pk2);
+  tt_ptr_op(pk1, !=, pk2);
   tt_assert(crypto_pk_cmp_keys(pk1,pk2) == 0);
 
  done:
diff --git a/src/test/test_util.c b/src/test/test_util.c
index b819d53..d3ac0cc 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -810,7 +810,7 @@ test_util_config_line_escaped_content(void)
   str = buf5;
 
   str = parse_config_line_from_str(str, &k, &v);
-  test_eq_ptr(str, NULL);
+  tt_ptr_op(str, ==, NULL);
   tor_free(k); tor_free(v);
 #endif
 
@@ -1199,7 +1199,7 @@ test_util_strmisc(void)
     const char *s = "abcdefghijklmnopqrstuvwxyz";
     cp_tmp = tor_strndup(s, 30);
     tt_str_op(cp_tmp,==, s); /* same string, */
-    test_neq_ptr(cp_tmp, s); /* but different pointers. */
+    tt_ptr_op(cp_tmp,!=,s); /* but different pointers. */
     tor_free(cp_tmp);
 
     cp_tmp = tor_strndup(s, 5);
@@ -1209,7 +1209,7 @@ test_util_strmisc(void)
     s = "a\0b\0c\0d\0e\0";
     cp_tmp = tor_memdup(s,10);
     tt_mem_op(cp_tmp,==, s, 10); /* same ram, */
-    test_neq_ptr(cp_tmp, s); /* but different pointers. */
+    tt_ptr_op(cp_tmp,!=,s); /* but different pointers. */
     tor_free(cp_tmp);
   }
 





More information about the tor-commits mailing list