Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloose/hamcrest-qt
Hamcrest matchers for C++/Qt
https://github.com/cloose/hamcrest-qt
Last synced: 2 months ago
JSON representation
Hamcrest matchers for C++/Qt
- Host: GitHub
- URL: https://github.com/cloose/hamcrest-qt
- Owner: cloose
- License: bsd-3-clause
- Created: 2013-11-21T14:00:29.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-20T21:06:00.000Z (about 11 years ago)
- Last Synced: 2023-03-11T19:18:06.982Z (almost 2 years ago)
- Language: C++
- Homepage: http://cloose.github.io/Hamcrest-Qt
- Size: 645 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Hamcrest-Qt
===========[Hamcrest](http://hamcrest.org/) matchers for C++/Qt
This is an attempt to port the [Java Hamcrest](https://github.com/hamcrest/JavaHamcrest) library to C++/Qt and make it usable with [Qt Test](http://qt-project.org/doc/qt-5.1/qttestlib/qttest-index.html).
Like the original library, this code is licensed under [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause).
# EXPERIMENTAL
This code is pre-alpha quality. DO NOT USE IN PRODUCTION CODE.## Links
[Homepage](http://cloose.github.io/Hamcrest-Qt)
[API Documentation](http://cloose.github.io/Hamcrest-Qt/docs/html/index.html)## Supported Matchers
#### allOf
Creates a matcher that matches if the examined object matches **ALL** of the specified matchers.
ASSERT_THAT(QStringLiteral("myValue"), allOf(startsWith("my"), containsString("Val")));
#### anyOf
Creates a matcher that matches if the examined object matches **ANY** of the specified matchers.
ASSERT_THAT(QStringLiteral("myValue"), anyOf(startsWith("foo"), containsString("Val")));
#### containsString
Creates a matcher that matches if the examined QString contains the specified
QString anywhere.ASSERT_THAT(QStringLiteral("myStringOfNote"), containsString("ring"));
#### endsWith
Creates a matcher that matches if the examined QString ends with the specified
QString.ASSERT_THAT(QStringLiteral("myStringOfNote"), endsWith("Note"));
#### equalTo
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"));
#### is
Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.
ASSERT_THAT(cheese, is(equalTo(smelly)));
#### _not
Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.
ASSERT_THAT(cheese, is(_not(equalTo(smelly))));
#### startsWith
Creates a matcher that matches if the examined QString starts with the specified
QString.ASSERT_THAT(QStringLiteral("myStringOfNote"), startsWith("my"));