OLD | NEW |
1 //------------------------------------------------------------------------------
--------- | 1 //------------------------------------------------------------------------------
--------- |
2 // $Id: OCMockRecorder.m 68 2010-08-20 13:20:52Z erik $ | 2 // $Id$ |
3 // Copyright (c) 2004-2010 by Mulle Kybernetik. See License file for details. | 3 // Copyright (c) 2004-2011 by Mulle Kybernetik. See License file for details. |
4 //------------------------------------------------------------------------------
--------- | 4 //------------------------------------------------------------------------------
--------- |
5 | 5 |
6 #import <objc/runtime.h> | 6 #import <objc/runtime.h> |
7 #import <OCMock/OCMockRecorder.h> | 7 #import <OCMock/OCMockRecorder.h> |
8 #import <OCMock/OCMArg.h> | 8 #import <OCMock/OCMArg.h> |
9 #import <OCMock/OCMConstraint.h> | 9 #import <OCMock/OCMConstraint.h> |
10 #import "OCMPassByRefSetter.h" | 10 #import "OCMPassByRefSetter.h" |
11 #import "OCMReturnValueProvider.h" | 11 #import "OCMReturnValueProvider.h" |
12 #import "OCMBoxedReturnValueProvider.h" | 12 #import "OCMBoxedReturnValueProvider.h" |
13 #import "OCMExceptionReturnValueProvider.h" | 13 #import "OCMExceptionReturnValueProvider.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #pragma mark Checking the invocation | 130 #pragma mark Checking the invocation |
131 | 131 |
132 - (BOOL)matchesInvocation:(NSInvocation *)anInvocation | 132 - (BOOL)matchesInvocation:(NSInvocation *)anInvocation |
133 { | 133 { |
134 id recordedArg, passedArg; | 134 id recordedArg, passedArg; |
135 int i, n; | 135 int i, n; |
136 | 136 |
137 if([anInvocation selector] != [recordedInvocation selector]) | 137 if([anInvocation selector] != [recordedInvocation selector]) |
138 return NO; | 138 return NO; |
139 | 139 |
140 » n = [[recordedInvocation methodSignature] numberOfArguments]; | 140 » n = (int)[[recordedInvocation methodSignature] numberOfArguments]; |
141 for(i = 2; i < n; i++) | 141 for(i = 2; i < n; i++) |
142 { | 142 { |
143 recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i]; | 143 recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i]; |
144 passedArg = [anInvocation getArgumentAtIndexAsObject:i]; | 144 passedArg = [anInvocation getArgumentAtIndexAsObject:i]; |
145 | 145 |
146 if([recordedArg isProxy]) | 146 if([recordedArg isProxy]) |
147 { | 147 { |
148 if(![recordedArg isEqual:passedArg]) | 148 if(![recordedArg isEqual:passedArg]) |
149 return NO; | 149 return NO; |
150 continue; | 150 continue; |
(...skipping 12 matching lines...) Expand all Loading... |
163 // side effect but easier to do here than in handleInvoc
ation | 163 // side effect but easier to do here than in handleInvoc
ation |
164 *(id *)[passedArg pointerValue] = [(OCMPassByRefSetter *
)recordedArg value]; | 164 *(id *)[passedArg pointerValue] = [(OCMPassByRefSetter *
)recordedArg value]; |
165 } | 165 } |
166 else if([recordedArg conformsToProtocol:objc_getProtocol("HCMatc
her")]) | 166 else if([recordedArg conformsToProtocol:objc_getProtocol("HCMatc
her")]) |
167 { | 167 { |
168 if([recordedArg matches:passedArg] == NO) | 168 if([recordedArg matches:passedArg] == NO) |
169 return NO; | 169 return NO; |
170 } | 170 } |
171 else | 171 else |
172 { | 172 { |
173 if([recordedArg class] != [passedArg class]) | |
174 return NO; | |
175 if(([recordedArg class] == [NSNumber class]) && | 173 if(([recordedArg class] == [NSNumber class]) && |
176 ([(NSNumber*)recordedArg compare:(NSNumber*)pass
edArg] != NSOrderedSame)) | 174 ([(NSNumber*)recordedArg compare:(NSNumber*)pass
edArg] != NSOrderedSame)) |
177 return NO; | 175 return NO; |
178 if(([recordedArg isEqual:passedArg] == NO) && | 176 if(([recordedArg isEqual:passedArg] == NO) && |
179 !((recordedArg == nil) && (passedArg == nil))) | 177 !((recordedArg == nil) && (passedArg == nil))) |
180 return NO; | 178 return NO; |
181 } | 179 } |
182 } | 180 } |
183 return YES; | 181 return YES; |
184 } | 182 } |
185 | 183 |
186 | 184 |
187 | 185 |
188 | 186 |
189 @end | 187 @end |
OLD | NEW |