1 //--------------------------------------------------------------------------------------- 2 // $Id$ 3 // Copyright (c) 2007-2010 by Mulle Kybernetik. See License file for details. 4 //--------------------------------------------------------------------------------------- 5 6 #import <Foundation/Foundation.h> 7 8 9 @interface OCMConstraint : NSObject 10 11 + (id)constraint; 12 - (BOOL)evaluate:(id)value; 13 14 // if you are looking for any, isNil, etc, they have moved to OCMArg 15 16 // try to use [OCMArg checkWith...] instead of the constraintWith... methods below 17 18 + (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; 19 + (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; 20 21 22 @end 23 24 @interface OCMAnyConstraint : OCMConstraint 25 @end 26 27 @interface OCMIsNilConstraint : OCMConstraint 28 @end 29 30 @interface OCMIsNotNilConstraint : OCMConstraint 31 @end 32 33 @interface OCMIsNotEqualConstraint : OCMConstraint 34 { 35 @public 36 id testValue; 37 } 38 39 @end 40 41 @interface OCMInvocationConstraint : OCMConstraint 42 { 43 @public 44 NSInvocation *invocation; 45 } 46 47 @end 48 49 #if NS_BLOCKS_AVAILABLE 50 51 @interface OCMBlockConstraint : OCMConstraint 52 { 53 BOOL (^block)(id); 54 } 55 56 - (id)initWithConstraintBlock:(BOOL (^)(id))block; 57 58 @end 59 60 #endif 61 62 63 #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] 64 #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] 65