Skip to content

Instantly share code, notes, and snippets.

@kognate
Created September 27, 2013 03:29
Show Gist options
  • Save kognate/6723771 to your computer and use it in GitHub Desktop.
Save kognate/6723771 to your computer and use it in GitHub Desktop.
Great bug. I think?
#import <XCTest/XCTest.h>
@interface RadarReport_Tests : XCTestCase
@property (strong) NSMapTable *mt;
@end
@implementation RadarReport_Tests
- (void)setUp
{
self.mt = [[NSMapTable alloc] init];
[self.mt setObject:@"hello" forKey:@20];
[self.mt setObject:@"world" forKey:@"twenty"];
[self.mt setObject:@20 forKey:self.mt];
}
- (void)testWorkingCondition
{
[self.mt setObject:[NSData dataWithBytes:"one" length:3] forKey:[NSValue valueWithPoint:NSMakePoint(10, 20)]];
NSNumber *n = [self.mt objectForKey:self.mt];
XCTAssertNotNil(n, @"This should not be nil");
}
- (void) testBadCondition
{
NSNumber *n = [self.mt objectForKey:self.mt];
XCTAssertNil(n, @"But this IS nil");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment