1 //---------------------------------------------------------------------------------------
3 // Copyright (c) 2009-2010 by Mulle Kybernetik. See License file for details.
4 //---------------------------------------------------------------------------------------
6 #import <objc/runtime.h>
7 #import <OCMock/OCMArg.h>
8 #import <OCMock/OCMConstraint.h>
9 #import "OCMPassByRefSetter.h"
10 #import "OCMConstraint.h"
12 @implementation OCMArg
16 return [OCMAnyConstraint constraint];
21 return (void *)0x01234567;
26 return [OCMIsNilConstraint constraint];
31 return [OCMIsNotNilConstraint constraint];
34 + (id)isNotEqual:(id)value
36 OCMIsNotEqualConstraint *constraint = [OCMIsNotEqualConstraint constraint];
37 constraint->testValue = value;
41 + (id)checkWithSelector:(SEL)selector onObject:(id)anObject
43 return [OCMConstraint constraintWithSelector:selector onObject:anObject];
46 #if NS_BLOCKS_AVAILABLE
48 + (id)checkWithBlock:(BOOL (^)(id))block
50 return [[[OCMBlockConstraint alloc] initWithConstraintBlock:block] autorelease];
55 + (id *)setTo:(id)value
57 return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease];
60 + (id)resolveSpecialValues:(NSValue *)value
62 const char *type = [value objCType];
65 void *pointer = [value pointerValue];
66 if(pointer == (void *)0x01234567)
68 if((pointer != NULL) && (object_getClass((id)pointer) == [OCMPassByRefSetter class]))