summaryrefslogtreecommitdiff
path: root/tests-clar/clar_libgit2.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-13 16:30:21 -0700
committerRussell Belfer <rb@github.com>2013-09-17 09:31:46 -0700
commit13f36ffb9e1c4fb70b44a477d716873fecfc0407 (patch)
treee5071f42071b085e90e77ffdaeb1304e19f8d0e1 /tests-clar/clar_libgit2.h
parentfa9cc14880cb50ea626c4bb0fcf1b68acdd73186 (diff)
downloadlibgit2-13f36ffb9e1c4fb70b44a477d716873fecfc0407.tar.gz
Add clar helpers for testing file equality
These are a couple of new clar helpers for testing that a file has expected contents that I extracted from the checkout code. Actually wrote this as part of an abandoned earlier attempt at a new filters API, but it will be useful now for some of the tests I'm going to write.
Diffstat (limited to 'tests-clar/clar_libgit2.h')
-rw-r--r--tests-clar/clar_libgit2.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h
index 8dcfdee48..76299e4e3 100644
--- a/tests-clar/clar_libgit2.h
+++ b/tests-clar/clar_libgit2.h
@@ -46,6 +46,20 @@ GIT_INLINE(void) clar__assert_in_range(
#define cl_assert_in_range(L,V,H) \
clar__assert_in_range((L),(V),(H),__FILE__,__LINE__,"Range check: " #V " in [" #L "," #H "]", 1)
+#define cl_assert_equal_file(DATA,SIZE,PATH) \
+ clar__assert_equal_file(DATA,SIZE,0,PATH,__FILE__,__LINE__)
+
+#define cl_assert_equal_file_ignore_cr(DATA,SIZE,PATH) \
+ clar__assert_equal_file(DATA,SIZE,1,PATH,__FILE__,__LINE__)
+
+void clar__assert_equal_file(
+ const char *expected_data,
+ size_t expected_size,
+ int ignore_cr,
+ const char *path,
+ const char *file,
+ size_t line);
+
/*
* Some utility macros for building long strings
*/