forked from pivotalforks/OCHamcrest
/
HCIsNot.mm
62 lines (43 loc) · 898 Bytes
/
HCIsNot.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// OCHamcrest - HCIsNot.mm
// Copyright 2009 www.hamcrest.org. See LICENSE.txt
//
// Created by: Jon Reid
//
// Inherited
#import "HCIsNot.h"
// OCHamcrest
#import "HCDescription.h"
#import "HCWrapShortcut.h"
@implementation HCIsNot
+ (HCIsNot*) isNot:(id<HCMatcher>)aMatcher
{
return [[[HCIsNot alloc] initNot:aMatcher] autorelease];
}
- (id) initNot:(id<HCMatcher>)aMatcher
{
self = [super init];
if (self != nil)
matcher = [aMatcher retain];
return self;
}
- (void) dealloc
{
[matcher release];
[super dealloc];
}
- (BOOL) matches:(id)item
{
return ![matcher matches:item];
}
- (void) describeTo:(id<HCDescription>)description
{
[[description appendText:@"not "] appendDescriptionOf:matcher];
}
@end
extern "C" {
id<HCMatcher> HC_isNot(id item)
{
return [HCIsNot isNot:HC_wrapInMatcher(item)];
}
} // extern "C"