// 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 a list of nested matchers, in order. */ @interface HCIsCollectionContainingInOrder : HCDiagnosingMatcher - (instancetype)initWithMatchers:(NSArray> *)itemMatchers NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @end FOUNDATION_EXPORT id HC_containsIn(NSArray *itemMatchers); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher for collections that matches when each item in the examined * collection satisfies the corresponding matcher in the specified list of 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. For a positive match, the examined collection must be of the same * length as the specified list of matchers. * * Examples
*
assertThat(\@[\@"foo", \@"bar"], containsIn(\@[equalTo(\@"foo"), equalTo(\@"bar")]))
*
assertThat(\@[\@"foo", \@"bar"], containsIn(\@[\@"foo", \@"bar"]))
* * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_containsIn instead.) */ static inline id containsIn(NSArray *itemMatchers) { return HC_containsIn(itemMatchers); } #endif FOUNDATION_EXPORT id HC_contains(id itemMatchers, ...) NS_REQUIRES_NIL_TERMINATION; #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher for collections that matches when each item in the examined * collection satisfies the corresponding matcher in the specified list of 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. For a positive match, the examined collection must be of the same * length as the specified list of matchers. * * Examples
*
assertThat(\@[\@"foo", \@"bar"], contains(equalTo(\@"foo"), equalTo(\@"bar"), nil))
*
assertThat(\@[\@"foo", \@"bar"], contains(\@"foo", \@"bar", nil))
* * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_contains instead.) */ #define contains(itemMatchers...) HC_contains(itemMatchers) #endif NS_ASSUME_NONNULL_END