Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (35 sloc) 1.107 kb
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "KWBeZeroMatcher.h"
#import "KWFormatter.h"
#import "KWValue.h"
@implementation KWBeZeroMatcher
#pragma mark -
#pragma mark Getting Matcher Strings
+ (NSArray *)matcherStrings {
return [NSArray arrayWithObject:@"beZero"];
}
#pragma mark -
#pragma mark Matching
- (BOOL)evaluate {
if (![self.subject respondsToSelector:@selector(boolValue)])
[NSException raise:@"KWMatcherException" format:@"subject does not respond to -numberValue"];
return [[self.subject numberValue] isEqualToNumber:[NSNumber numberWithInt:0]];
}
#pragma mark -
#pragma mark Getting Failure Messages
- (NSString *)failureMessageForShould {
return [NSString stringWithFormat:@"expected subject to be zero, got %@",
[KWFormatter formatObject:self.subject]];
}
- (NSString *)failureMessageForShouldNot {
return [NSString stringWithFormat:@"expected subject not to be zero"];
}
#pragma mark -
#pragma mark Configuring Matchers
- (void)beZero {
}
@end
Jump to Line
Something went wrong with that request. Please try again.