1
#import <Foundation/NSArray.h>
2
#import <Foundation/NSAutoreleasePool.h>
3
#import "ObjectTesting.h"
8
NSMutableArray *testObjs = [[NSMutableArray alloc] init];
10
NSAutoreleasePool *arp = [NSAutoreleasePool new];
11
test_alloc(@"NSArray");
13
PASS((obj != nil && [obj count] == 0),"can create an empty array");
15
[testObjs addObject: obj];
16
obj = [NSArray arrayWithObject:str];
17
PASS((obj != nil && [obj count] == 1), "can create an array with one element");
18
[testObjs addObject: obj];
19
test_NSObject(@"NSArray", testObjs);
20
test_NSCoding(testObjs);
21
test_NSCopying(@"NSArray",@"NSMutableArray",testObjs,YES,NO);
22
test_NSMutableCopying(@"NSArray",@"NSMutableArray",testObjs);
24
obj = [NSArray arrayWithContentsOfFile: @"test.plist"];
25
PASS((obj != nil && [obj count] > 0),"can create an array from file");
27
/* The apple foundation is arguably buggy in that it seems to create a
28
* mutable array ... we currently copy that
30
PASS([obj isKindOfClass: [NSMutableArray class]] == YES,"array mutable");
31
PASS_RUNS([obj addObject: @"x"],"can add to array");
33
PASS([obj isKindOfClass: [NSMutableArray class]] == NO,"array immutable");
35
obj = [obj objectAtIndex: 0];
36
PASS([obj isKindOfClass: [NSMutableArray class]] == YES,"array mutable");
37
[arp release]; arp = nil;