summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-20 11:46:03 -0700
committerRussell Belfer <rb@github.com>2013-03-22 14:23:38 -0700
commit3ba01362437102501a173b9fe072a5690358baa0 (patch)
treefc6370fbf53ea0c98afe02c6f343f212e17ff9d6
parent7202ec29e9643b7262d827483d96b9e8708af543 (diff)
downloadlibgit2-3ba01362437102501a173b9fe072a5690358baa0.tar.gz
Update cl_assert_equal_sz to be nicer
This makes the size_t comparison test nicer (assuming that the values are actually not using the full length), and converts some cases that were using it for pointer comparison to use the macro that is designed for pointer comparison.
-rw-r--r--tests-clar/clar_libgit2.h2
-rw-r--r--tests-clar/network/urlparse.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h
index 321ec5f2f..667b8050a 100644
--- a/tests-clar/clar_libgit2.h
+++ b/tests-clar/clar_libgit2.h
@@ -29,7 +29,7 @@
void cl_git_report_failure(int, const char *, int, const char *);
-#define cl_assert_equal_sz(sz1,sz2) cl_assert((sz1) == (sz2))
+#define cl_assert_equal_sz(sz1,sz2) cl_assert_equal_i((int)sz1, (int)(sz2))
/*
* Some utility macros for building long strings
diff --git a/tests-clar/network/urlparse.c b/tests-clar/network/urlparse.c
index 84d0bfb88..173e57d0f 100644
--- a/tests-clar/network/urlparse.c
+++ b/tests-clar/network/urlparse.c
@@ -23,8 +23,8 @@ void test_network_urlparse__trivial(void)
"example.com/resource", "8080"));
cl_assert_equal_s(host, "example.com");
cl_assert_equal_s(port, "8080");
- cl_assert_equal_sz(user, NULL);
- cl_assert_equal_sz(pass, NULL);
+ cl_assert_equal_p(user, NULL);
+ cl_assert_equal_p(pass, NULL);
}
void test_network_urlparse__user(void)
@@ -34,7 +34,7 @@ void test_network_urlparse__user(void)
cl_assert_equal_s(host, "example.com");
cl_assert_equal_s(port, "8080");
cl_assert_equal_s(user, "user");
- cl_assert_equal_sz(pass, NULL);
+ cl_assert_equal_p(pass, NULL);
}
void test_network_urlparse__user_pass(void)
@@ -55,8 +55,8 @@ void test_network_urlparse__port(void)
"example.com:9191/resource", "8080"));
cl_assert_equal_s(host, "example.com");
cl_assert_equal_s(port, "9191");
- cl_assert_equal_sz(user, NULL);
- cl_assert_equal_sz(pass, NULL);
+ cl_assert_equal_p(user, NULL);
+ cl_assert_equal_p(pass, NULL);
}
void test_network_urlparse__user_port(void)
@@ -67,7 +67,7 @@ void test_network_urlparse__user_port(void)
cl_assert_equal_s(host, "example.com");
cl_assert_equal_s(port, "9191");
cl_assert_equal_s(user, "user");
- cl_assert_equal_sz(pass, NULL);
+ cl_assert_equal_p(pass, NULL);
}
void test_network_urlparse__user_pass_port(void)