| OLD | NEW |
| 1 //------------------------------------------------------------------------------
--------- | 1 /* |
| 2 // $Id$ | 2 * Copyright (c) 2007-2015 Erik Doernenburg and contributors |
| 3 // Copyright (c) 2007-2010 by Mulle Kybernetik. See License file for details. | 3 * |
| 4 //------------------------------------------------------------------------------
--------- | 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 * not use these files except in compliance with the License. You may obtain |
| 6 * a copy of the License at |
| 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * |
| 10 * Unless required by applicable law or agreed to in writing, software |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 * License for the specific language governing permissions and limitations |
| 14 * under the License. |
| 15 */ |
| 5 | 16 |
| 6 #import <Foundation/Foundation.h> | 17 #import <Foundation/Foundation.h> |
| 7 | 18 |
| 19 @interface OCMConstraint : NSObject |
| 8 | 20 |
| 9 @interface OCMConstraint : NSObject | 21 + (instancetype)constraint; |
| 10 | |
| 11 + (id)constraint; | |
| 12 - (BOOL)evaluate:(id)value; | 22 - (BOOL)evaluate:(id)value; |
| 13 | 23 |
| 14 // if you are looking for any, isNil, etc, they have moved to OCMArg | 24 // if you are looking for any, isNil, etc, they have moved to OCMArg |
| 15 | 25 |
| 16 // try to use [OCMArg checkWith...] instead of the constraintWith... methods bel
ow | 26 // try to use [OCMArg checkWith...] instead of the constraintWith... methods bel
ow |
| 17 | 27 |
| 18 + (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; | 28 + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; |
| 19 + (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)
aValue; | 29 + (instancetype)constraintWithSelector:(SEL)aSelector |
| 20 | 30 onObject:(id)anObject |
| 31 withValue:(id)aValue; |
| 21 | 32 |
| 22 @end | 33 @end |
| 23 | 34 |
| 24 @interface OCMAnyConstraint : OCMConstraint | 35 @interface OCMAnyConstraint : OCMConstraint |
| 25 @end | 36 @end |
| 26 | 37 |
| 27 @interface OCMIsNilConstraint : OCMConstraint | 38 @interface OCMIsNilConstraint : OCMConstraint |
| 28 @end | 39 @end |
| 29 | 40 |
| 30 @interface OCMIsNotNilConstraint : OCMConstraint | 41 @interface OCMIsNotNilConstraint : OCMConstraint |
| 31 @end | 42 @end |
| 32 | 43 |
| 33 @interface OCMIsNotEqualConstraint : OCMConstraint | 44 @interface OCMIsNotEqualConstraint : OCMConstraint |
| 34 { | 45 { |
| 35 @public | 46 @public |
| 36 id testValue; | 47 id testValue; |
| 37 } | 48 } |
| 38 | 49 |
| 39 @end | 50 @end |
| 40 | 51 |
| 41 @interface OCMInvocationConstraint : OCMConstraint | 52 @interface OCMInvocationConstraint : OCMConstraint |
| 42 { | 53 { |
| 43 @public | 54 @public |
| 44 NSInvocation *invocation; | 55 NSInvocation *invocation; |
| 45 } | 56 } |
| 46 | 57 |
| 47 @end | 58 @end |
| 48 | 59 |
| 49 #if NS_BLOCKS_AVAILABLE | |
| 50 | |
| 51 @interface OCMBlockConstraint : OCMConstraint | 60 @interface OCMBlockConstraint : OCMConstraint |
| 52 { | 61 { |
| 53 BOOL (^block)(id); | 62 BOOL (^block)(id); |
| 54 } | 63 } |
| 55 | 64 |
| 56 - (id)initWithConstraintBlock:(BOOL (^)(id))block; | 65 - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block; |
| 57 | 66 |
| 58 @end | 67 @end |
| 59 | 68 |
| 60 #endif | |
| 61 | |
| 62 | 69 |
| 63 #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector on
Object:self] | 70 #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector on
Object:self] |
| 64 #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSe
lector onObject:self withValue:(aValue)] | 71 #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSe
lector onObject:self withValue:(aValue)] |
| OLD | NEW |