-
Notifications
You must be signed in to change notification settings - Fork 534
Open
Description
Hi, the CHECK_EQUAL supports this pattern when I want to compare two objects:
CHECK_EQUAL(lhs, ==, rhs);But for some user-defined objects, which are without relationship operators, I had to write a function or a lambda to compare them (I cannot modify these classes to add relationship operators, they belong to a shared library in my workplace), e.g.
bool isEqual(const Obj& lhs, const Obj& rhs) {
// do real comparison
return ...;
}
CHECK_TRUE(COMPARE(lhs, rhs));But it cannot be invoked in macro CHECK_COMPARE, e.g. CHECK_COMPARE(lhs, compare, rhs), or it would be expanded as the following, that's not expected.
bool success = (lhs)compare(rhs);Then I think CHECK_COMPARE could provide a version to accept the callable objects, it might be expanded as following:
bool success = (compare)((lhs), (rhs));Will you consider to add something like this? Thank You~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels