mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Make base do unintuitive and stupid things in the name of Apple compatibility (hopefully Apple will fix their implementation in 10.7.something...).
Fix some tests. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33687 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6dfb591252
commit
682c9beb5b
6 changed files with 34 additions and 76 deletions
|
@ -1,27 +0,0 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSMapTable.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
[NSAutoreleasePool new];
|
||||
id pool = [NSAutoreleasePool new];
|
||||
NSMapTable *map = [[NSMapTable mapTableWithStrongToWeakObjects] retain];
|
||||
NSMapTable *map2 = [[NSMapTable mapTableWithWeakToStrongObjects] retain];
|
||||
id obj = [NSObject new];
|
||||
|
||||
[map setObject: obj forKey: @"1"];
|
||||
[map2 setObject: @"1" forKey: obj];
|
||||
PASS(obj == [map objectForKey: @"1"], "Value stored in weak-value map");
|
||||
PASS(nil != [map2 objectForKey: obj], "Value stored in weak-key map");
|
||||
[pool drain];
|
||||
[obj release];
|
||||
PASS(nil == [map objectForKey: @"1"], "Value removed from weak-value map");
|
||||
NSEnumerator *enumerator = [map2 keyEnumerator];
|
||||
NSUInteger count = 0;
|
||||
while ([enumerator nextObject] != nil) { count++; }
|
||||
PASS(count == 0, "Value removed from weak-key map");
|
||||
PASS(0 == [map count], "Weak-value map reports correct count");
|
||||
PASS(0 == [map2 count], "Weak-key map reports correct count");
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue