PNGradientView/Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.m
2016-01-12 12:54:32 +01:00

25 lines
692 B
Objective-C

#import "EXPMatchers+equal.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beIdenticalTo, (void *expected)) {
match(^BOOL{
if(actual == expected) {
return YES;
} else if([actual isKindOfClass:[NSValue class]] && EXPIsValuePointer((NSValue *)actual)) {
if([(NSValue *)actual pointerValue] == expected) {
return YES;
}
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: <%p>, got: <%p>", expected, actual];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: not <%p>, got: <%p>", expected, actual];
});
}
EXPMatcherImplementationEnd