mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-04 22:00:50 +00:00
with something that doesn't do a very good job of optimising autorelease operations away. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33644 72102866-910b-0410-8b05-ffd578937521
20 lines
676 B
Objective-C
20 lines
676 B
Objective-C
#import "ObjectTesting.h"
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSHashTable.h>
|
|
|
|
int main()
|
|
{
|
|
[NSAutoreleasePool new];
|
|
id pool = [NSAutoreleasePool new];
|
|
NSHashTable *ht = [[NSHashTable hashTableWithWeakObjects] retain];
|
|
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];
|
|
[pool drain];
|
|
PASS(0 == [ht count], "Weak hash table contains no objects");
|
|
PASS(0 == [[ht allObjects] count], "Weak hash table contains no objects");
|
|
return 0;
|
|
}
|