libs-base/Tests/base/NSHashTable/additions.m
Niels Grewe 46d97b3be0 Implement +addObjectsFromArray: on NSHashTable
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38802 72102866-910b-0410-8b05-ffd578937521
2015-07-16 07:38:14 +00:00

21 lines
647 B
Objective-C

#import "ObjectTesting.h"
#import <GNUstepBase/NSHashTable+GNUstepBase.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSAutoreleasePool.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSHashTable *obj = [[NSHashTable new] autorelease];
NSString *strA = @"a";
NSString *strB = @"b";
NSArray *a = [NSArray arrayWithObjects: strA, strB, strA, nil];
[obj addObjectsFromArray: a];
PASS([obj count] == 2, "-addObjectsFromArray: adds objects ignoring duplicates");
PASS([obj containsObject: strA] && [obj containsObject: strB], "Table contains correct objects");
[arp release]; arp = nil;
return 0;
}