mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
19 lines
616 B
Mathematica
19 lines
616 B
Mathematica
|
#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;
|
||
|
}
|