mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-01 20:40:53 +00:00
Richard: I'm unsure about three of these, which were fixes in memset() calls in: - NSConcreteMapTable.m - NSConcreteHashTable.m - Additions/NSData+GNUstepBase.m Please can you check them? I think they are intended to zero the entire object (rather than the first word), but the lack of comments makes me unsure. Most changes were just tweaks to variable types. I've also removed some dead code from NSInvocation. This was small group of things that were marked for internal use only, but not actually referenced in the code anywhere. Other improvements: - NSArray / NSDictionary fixed up to use the 10.7 (ARC-friendly) prototypes. - getObjects:andKeys: implemented for NSDictionary (10.5 method) - NSPointerArray and NSHashTable now properly support weak objects. - Tests for weak objects in collections. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33621 72102866-910b-0410-8b05-ffd578937521
18 lines
616 B
Objective-C
18 lines
616 B
Objective-C
#import "ObjectTesting.h"
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSHashTable.h>
|
|
|
|
int main()
|
|
{
|
|
[NSAutoreleasePool new];
|
|
NSHashTable *ht = [NSHashTable hashTableWithWeakObjects];
|
|
id obj = [NSObject new];
|
|
[ht addObject: obj];
|
|
PASS([ht containsObject: obj], "Added object to weak hash table");
|
|
PASS(1 == [ht count], "Weak hash table contains one object");
|
|
PASS([ht containsObject: obj], "Added object to weak hash table");
|
|
[obj release];
|
|
PASS(0 == [ht count], "Weak hash table contains no objects");
|
|
PASS(0 == [[ht allObjects] count], "Weak hash table contains no objects");
|
|
return 0;
|
|
}
|