mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 08:40:44 +00:00
add test for removing all the objects in an array.
cleanup other tests a bit
This commit is contained in:
parent
ae95e859d6
commit
ddcff45b89
1 changed files with 21 additions and 4 deletions
|
@ -11,10 +11,12 @@ int main()
|
|||
val2 = @"A Goodbye";
|
||||
val3 = @"Testing all strings";
|
||||
|
||||
vals1 = [[NSMutableArray arrayWithObject:val1] retain];
|
||||
[vals1 addObject:val2];
|
||||
vals2 = [[vals1 arrayByAddingObject:val2] retain];
|
||||
vals3 = [[vals1 arrayByAddingObject:val3] retain];
|
||||
vals1 = [[NSMutableArray arrayWithObject: val1] retain];
|
||||
[vals1 addObject: val2];
|
||||
vals2 = AUTORELEASE([vals1 mutableCopy]);
|
||||
[vals2 addObject: val2];
|
||||
vals3 = AUTORELEASE([vals2 mutableCopy]);
|
||||
[vals3 addObject: val3];
|
||||
|
||||
obj = [NSMutableArray new];
|
||||
arr = obj;
|
||||
|
@ -97,6 +99,21 @@ int main()
|
|||
"-sortedArrayUsingSelector: seems ok");
|
||||
|
||||
}
|
||||
{
|
||||
NSMutableArray *ma = [NSMutableArray new];
|
||||
NSString *s[5] = { @"1",@"2",@"3",@"4",@"5" };
|
||||
NSUInteger before;
|
||||
NSUInteger after;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
[ma addObject: s[i]];
|
||||
}
|
||||
before = [ma count];
|
||||
[ma removeObjectsInArray: ma];
|
||||
after = [ma count];
|
||||
[ma release];
|
||||
PASS(5 == before && 0 == after, "-removeObjectsInArray: works for self")
|
||||
}
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue