mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
import testsuite
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32187 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
734c214892
commit
0e02133729
374 changed files with 20864 additions and 0 deletions
20
Tests/base/NSMapTable/basic.m
Normal file
20
Tests/base/NSMapTable/basic.m
Normal file
|
@ -0,0 +1,20 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSMapTable.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSMapTable *testObj;
|
||||
|
||||
testObj = [[NSMapTable new] autorelease];
|
||||
[testObj setObject: @"hello" forKey: @"there"];
|
||||
test_alloc(@"NSMapTable");
|
||||
test_NSObject(@"NSMapTable", [NSArray arrayWithObject: testObj]);
|
||||
test_NSCopying(@"NSMapTable",@"NSMapTable",
|
||||
[NSArray arrayWithObject: testObj], NO, YES);
|
||||
// test_NSCoding([NSArray arrayWithObject: testObj]);
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
36
Tests/base/NSMapTable/create.m
Normal file
36
Tests/base/NSMapTable/create.m
Normal file
|
@ -0,0 +1,36 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSMapTable.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSString *val1, *val2, *val3;
|
||||
NSMapTable *obj, *old;
|
||||
id vals[3];
|
||||
|
||||
val1 = @"Hello";
|
||||
val2 = @"Goodbye";
|
||||
val3 = @"Testing";
|
||||
|
||||
vals[0] = val1;
|
||||
vals[1] = val2;
|
||||
vals[2] = val3;
|
||||
|
||||
obj = [[NSMapTable new] autorelease];
|
||||
PASS(obj != nil
|
||||
&& [obj isKindOfClass:[NSMapTable class]]
|
||||
&& [obj count] == 0,
|
||||
"+new creates an empty hash table");
|
||||
|
||||
[obj setObject: val1 forKey: @"Key1"];
|
||||
PASS([obj count] == 1, "-setObject:forKey increments count");
|
||||
[obj setObject: nil forKey: @"Key2"];
|
||||
PASS([obj count] == 2, "-setObject:forKey: works with nil value");
|
||||
TEST_EXCEPTION([obj setObject: val1 forKey: nil];,
|
||||
NSInvalidArgumentException, YES, "-setObject:forKey: raises with nil key");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
||||
|
10
Tests/base/NSMapTable/general.m
Normal file
10
Tests/base/NSMapTable/general.m
Normal file
|
@ -0,0 +1,10 @@
|
|||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import "ObjectTesting.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue