// // HOMNSArrayTests.m // HigherOrderMessaging // // Created by Ofri Wolfus on 08/10/06. // Copyright 2006 Ofri Wolfus. All rights reserved. // #import "HOMNSArrayTests.h" @implementation HOMNSArrayTests - (id)init { if ((self = [super init])) { int i; smallArray = [[NSArray alloc] initWithObjects:@"a", @"b", @"abc", nil]; largeArray = [[NSMutableArray alloc] init]; largeArrayResult = [[NSMutableArray alloc] init]; for (i = 0; i < 10000; i++) [(NSMutableArray *)largeArray addObject:[NSString stringWithFormat:@"%d", i]]; } return self; } - (void)dealloc { [smallArray release]; smallArray = nil; [largeArray release]; largeArray = nil; [largeArrayResult release]; largeArrayResult = nil; [super dealloc]; } // Instead of copying this in every subclass, we do it here - (BOOL)verifyResult:(NSArray *)arr ofTest:(SEL)sel { NSString *name = NSStringFromSelector(sel); if ([name hasPrefix:@"testLargeArray"]) DPTestAssert([arr isEqualToArray:largeArrayResult], @"The resulting array doesn't match the expected result. Result = %@", arr); return [super verifyResult:arr ofTest:sel]; } @end