8000 tests: add `cl_assert_equal_oidstr` helper method · russell/libgit2@fddfca3 · GitHub
[go: up one dir, main page]

Skip to content

Commit fddfca3

Browse files
committed
tests: add cl_assert_equal_oidstr helper method
1 parent cf19ddc commit fddfca3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/clar/clar_libgit2.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,27 @@ GIT_INLINE(void) clar__assert_equal_oid(
166166
}
167167
}
168168

169+
GIT_INLINE(void) clar__assert_equal_oidstr(
170+
const char *file, const char *func, int line, const char *desc,
171+
const char *one_str, const git_oid *two)
172+
{
173+
git_oid one;
174+
175+
if (git_oid__fromstr(&one, one_str, git_oid_type(two)) < 0) {
176+
clar__fail(file, func, line, desc, "could not parse oid string", 1);
177+
} else {
178+
clar__assert_equal_oid(file, func, line, desc, &one, two);
179+
}
180+
}
181+
169182
#define cl_assert_equal_oid(one, two) \
170183
clar__assert_equal_oid(__FILE__, __func__, __LINE__, \
171184
"OID mismatch: " #one " != " #two, (one), (two))
172185

186+
#define cl_assert_equal_oidstr(one_str, two) \
187+
clar__assert_equal_oidstr(__FILE__, __func__, __LINE__, \
188+
"OID mismatch: " #one_str " != " #two, (one_str), (two))
189+
173190
/*
174191
* Some utility macros for building long strings
175192
*/

0 commit comments

Comments
 (0)
0