1#import <Foundation/NSNotification.h> 2#import <Foundation/NSAutoreleasePool.h> 3#import "ObjectTesting.h" 4 5@implementation NSNotification (Testing) 6- (BOOL) isEqualForTestcase: (id)other 7{ 8 if (NO == [other isKindOfClass: [NSNotification class]]) 9 return NO; 10 if ([self name] != [other name] 11 && NO == [[self name] isEqual: [other name]]) 12 return NO; 13 if ([self object] != [other object] 14 && NO == [[self object] isEqual: [other object]]) 15 return NO; 16 if ([self userInfo] != [other userInfo] 17 && NO == [[self userInfo] isEqual: [other userInfo]]) 18 return NO; 19 return YES; 20} 21@end 22 23int main() 24{ 25 NSNotification *obj; 26 NSMutableArray *testObjs = [[NSMutableArray alloc] init]; 27 NSAutoreleasePool *arp = [NSAutoreleasePool new]; 28 29 test_alloc(@"NSNotification"); 30 obj = [NSNotification new]; 31 [testObjs addObject: obj]; 32 test_NSObject(@"NSNotification", testObjs); 33 test_NSCoding(testObjs); 34 test_keyed_NSCoding(testObjs); 35 test_NSCopying(@"NSNotification",@"NSNotification",testObjs,NO,NO); 36 37 [arp release]; arp = nil; 38 return 0; 39} 40