Files
MonsterCards/iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualIgnoringCase.m
Tom Hicks c3031fbc39 Adds cocoapods for libraries.
Adds OCMockito and OCHamcrest libs.
2020-09-05 22:06:51 -07:00

46 lines
964 B
Objective-C

// OCHamcrest by Jon Reid, https://qualitycoding.org/
// Copyright 2019 hamcrest.org. See LICENSE.txt
#import "HCIsEqualIgnoringCase.h"
#import "HCRequireNonNilObject.h"
@interface HCIsEqualIgnoringCase ()
@property (nonatomic, copy, readonly) NSString *string;
@end
@implementation HCIsEqualIgnoringCase
- (instancetype)initWithString:(NSString *)string
{
HCRequireNonNilObject(string);
self = [super init];
if (self)
_string = [string copy];
return self;
}
- (BOOL)matches:(nullable id)item
{
if (![item isKindOfClass:[NSString class]])
return NO;
return [self.string caseInsensitiveCompare:item] == NSOrderedSame;
}
- (void)describeTo:(id <HCDescription>)description
{
[[description appendDescriptionOf:self.string]
appendText:@" ignoring case"];
}
@end
id HC_equalToIgnoringCase(NSString *expectedString)
{
return [[HCIsEqualIgnoringCase alloc] initWithString:expectedString];
}