OCHamcrest
|
Boolean logic using other matchers.
Defines | |
#define | allOf HC_allOf |
allOf(firstMatcher, ...) - Matches if all of the given matchers evaluate to YES . | |
#define | anyOf HC_anyOf |
anyOf(firstMatcher, ...) - Matches if any of the given matchers evaluate to YES . | |
#define | anything() HC_anything() |
Matches anything. | |
#define | anythingWithDescription HC_anythingWithDescription |
anythingWithDescription(description) - Matches anything. | |
#define | isNot HC_isNot |
isNot(aMatcher) - Inverts the given matcher to its logical negation. |
Boolean logic using other matchers.
allOf(firstMatcher, ...) - Matches if all of the given matchers evaluate to YES
.
firstMatcher,... | A comma-separated list of matchers ending with nil . |
The matchers are evaluated from left to right using short-circuit evaluation, so evaluation stops as soon as a matcher returns NO
.
Any argument that is not a matcher is implicitly wrapped in an equalTo matcher to check for equality.
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_allOf
instead.)
anyOf(firstMatcher, ...) - Matches if any of the given matchers evaluate to YES
.
firstMatcher,... | A comma-separated list of matchers ending with nil . |
The matchers are evaluated from left to right using short-circuit evaluation, so evaluation stops as soon as a matcher returns YES
.
Any argument that is not a matcher is implicitly wrapped in an equalTo matcher to check for equality.
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_anyOf
instead.)
#define anything | ( | ) | HC_anything() |
Matches anything.
This matcher always evaluates to YES
. Specify this in composite matchers when the value of a particular element is unimportant.
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_anything
instead.)
anythingWithDescription(description) - Matches anything.
description | A string used to describe this matcher. |
This matcher always evaluates to YES
. Specify this in collection matchers when the value of a particular element in a collection is unimportant.
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_anything
instead.)
isNot(aMatcher) - Inverts the given matcher to its logical negation.
aMatcher | The matcher to negate. |
This matcher compares the evaluated object to the negation of the given matcher. If the aMatcher argument is not a matcher, it is implicitly wrapped in an equalTo matcher to check for equality, and thus matches for inequality.
Examples:
assertThat(cheese, isNot(equalTo(smelly)))
assertThat(cheese, isNot(smelly))
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_isNot
instead.)