Hamcrest matchers for C++/Qt
Hamcrest matchers for C++/Qt
This is an attempt to port the Java Hamcrest library to C++/Qt and make it usable with Qt Test.
Like the original library, this code is licensed under BSD 3-Clause License.
This code is pre-alpha quality. DO NOT USE IN PRODUCTION CODE.
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
ASSERT_THAT(QStringLiteral("myValue"), allOf(startsWith("my"), containsString("Val")));
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
ASSERT_THAT(QStringLiteral("myValue"), anyOf(startsWith("foo"), containsString("Val")));
Creates a matcher that matches if the examined QString contains the specified QString anywhere.
ASSERT_THAT(QStringLiteral("myStringOfNote"), containsString("ring"));
Creates a matcher that matches if the examined QString ends with the specified QString.
ASSERT_THAT(QStringLiteral("myStringOfNote"), endsWith("Note"));
Creates a matcher that matches when the examined object is logically equal to the specified operand
, as determined by calling the operator==() method on the examined object.
ASSERT_THAT(QStringLiteral("foo"), equalTo("foo"));
Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.
ASSERT_THAT(cheese, is(equalTo(smelly)));
Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.
ASSERT_THAT(cheese, is(_not(equalTo(smelly))));
Creates a matcher that matches if the examined QString starts with the specified QString.
ASSERT_THAT(QStringLiteral("myStringOfNote"), startsWith("my"));