diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2014-07-01 14:09:01 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2014-07-01 14:40:16 -0400 |
| commit | 0cee70ebb7297f155129e0d05f5a23be82231256 (patch) | |
| tree | 6d98f55d737f4187e58f2a180ffb75f05b98bfba /tests/clar_libgit2.h | |
| parent | e1fc03c9baea9864dec90d0aef7aadcc2ff20576 (diff) | |
| download | libgit2-0cee70ebb7297f155129e0d05f5a23be82231256.tar.gz | |
Introduce cl_assert_equal_oid
Diffstat (limited to 'tests/clar_libgit2.h')
| -rw-r--r-- | tests/clar_libgit2.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/clar_libgit2.h b/tests/clar_libgit2.h index da37bd655..0744877cb 100644 --- a/tests/clar_libgit2.h +++ b/tests/clar_libgit2.h @@ -78,6 +78,24 @@ void clar__assert_equal_file( const char *file, int line); +GIT_INLINE(void) clar__assert_equal_oid( + const char *file, int line, const char *desc, + const git_oid *one, const git_oid *two) +{ + if (git_oid_cmp(one, two)) { + char err[] = "\"........................................\" != \"........................................\""; + + git_oid_fmt(&err[1], one); + git_oid_fmt(&err[47], two); + + clar__fail(file, line, desc, err, 1); + } +} + +#define cl_assert_equal_oid(one, two) \ + clar__assert_equal_oid(__FILE__, __LINE__, \ + "OID mismatch: " #one " != " #two, (one), (two)) + /* * Some utility macros for building long strings */ |
