libs-gsweb/Tests/gsweb/GSWDictionary/general.m
David Wetzel a8eccb4273 * GSWDatabase/WODisplayGroup.m
fix format string and NSArray / NSMutableArray bugs
    * GSWeb/GNUmakefile
    * GSWeb/GSWApplication.h
    * GSWeb/GSWApplication.m
      replace GSWMultiKeyDictionary with GSWDictionary
    * GSWeb/GSWDefaultAdaptor.m
      limit _workerThreadCountMax to 16 for now
    * GSWeb/GSWDeployedBundle.*, GSWResourceManager.*
      replace GSWMultiKeyDictionary with GSWDictionary
    * GSWeb/GSWDictionary
      new class using NSMutableDictionary internally.
    * GSWeb/GSWImageInfo.m
      fix leak
    * GSWeb/GSWRequest.m
      fix leak
    * GSWeb/GSWUtils.m
      fix leak
    * GSWeb/GSWWOCompatibility.h
      remove GSWMultiKeyDictionary
    * GSWeb/GSWWorkerThread.m
      some cleanups but still does not run in MT on FreeBSD.
    * GSWeb/NSString+Trimming.m
      fix leaks
    * Tests/gsweb/GNUmakefile.postamble
    * Tests/gsweb/GNUmakefile.super
    * Tests/gsweb/GSWDictionary/TestInfo
    * Tests/gsweb/GSWDictionary/general.m
      new files
2017-12-25 00:25:03 -05:00

55 lines
1.5 KiB
Objective-C
Executable file

#include <Foundation/Foundation.h>
#include <WebObjects/GSWDictionary.h>
#include <objc/runtime.h>
#include "Testing.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
// Class gswDictClass0 = [GSWDictionary class];
Class gswDictClass = NSClassFromString(@"GSWDictionary");
id dict = [gswDictClass new];
PASS(dict != nil, "GSWDictionary dictionary created");
PASS([dict count] == 0, "count is 0");
NSString * helloString = @"Hello";
[dict setObject:helloString
forKeys:@"Hello.wo",@"DE", nil];
PASS([dict count] == 1, "count is 1 after adding one object");
id myObj = [dict objectForKeyArray:@[@"Hello.wo",@"DE"]];
PASS([myObj isEqualTo:helloString], "objectForKeyArray works");
myObj = [dict objectForKeyArray:@[@"Hello.wo",@"FR"]];
PASS(myObj == nil, "objectForKeyArray does not find non-existing rows");
[dict removeObjectForKeyArray:@[@"Hello.wo",@"FR"]];
PASS([dict count] == 1, "count is still 1 after trying to remove one object for non-existing key");
[dict removeObjectForKeyArray:@[@"Hello.wo",@"DE"]];
PASS([dict count] == 0, "count is 0 after removing object using removeObjectForKeyArray:");
[dict setObject:helloString
forKeys:@"Hello.wo",@"IT",@"DK", nil];
[dict removeObjectForKeys:@"Hello.wo",@"IT",@"DK", nil];
PASS([dict count] == 0, "count is 0 after removing object using removeObjectForKeys:");
//NSLog(@"%@",dict);
[arp release]; arp = nil;
return 0;
}