// OCHamcrest by Jon Reid, https://qualitycoding.org/ // Copyright 2019 hamcrest.org. See LICENSE.txt #import NS_ASSUME_NONNULL_BEGIN /*! * @abstract Matches if every item in a collection satisfies any of the nested matchers. */ @interface HCIsCollectionOnlyContaining : HCEvery @end FOUNDATION_EXPORT id HC_onlyContainsIn(NSArray *itemMatchers); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher for collections that matches when each item of the examined * collection satisfies any of the specified matchers. * @param itemMatchers An array of matchers. Any element that is not a matcher is implicitly wrapped * in an equalTo matcher to check for equality. * @discussion This matcher works on any collection that conforms to the NSFastEnumeration protocol, * performing a single pass. Any matcher may match multiple elements. * * Example
*
assertThat(\@[\@"Jon", \@"John", \@"Bob"], onlyContainsIn(\@[startsWith(\@"Jo"), startsWith(\@("Bo")]))
* * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_onlyContainsIn instead. */ static inline id onlyContainsIn(NSArray *itemMatchers) { return HC_onlyContainsIn(itemMatchers); } #endif FOUNDATION_EXPORT id HC_onlyContains(id itemMatchers, ...) NS_REQUIRES_NIL_TERMINATION; #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher for collections that matches when each item of the examined * collection satisfies any of the specified matchers. * @param itemMatchers... A comma-separated list of matchers ending with nil. * Any argument that is not a matcher is implicitly wrapped in an equalTo matcher to check for * equality. * @discussion This matcher works on any collection that conforms to the NSFastEnumeration protocol, * performing a single pass. Any matcher may match multiple elements. * * Example
*
assertThat(\@[\@"Jon", \@"John", \@"Bob"], onlyContains(startsWith(\@"Jo"), startsWith(\@("Bo"), nil))
* * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_onlyContains instead. */ #define onlyContains(itemMatchers...) HC_onlyContains(itemMatchers) #endif NS_ASSUME_NONNULL_END