15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <string.h>
#import "OFAutoreleasePool.h"
#import "OFDictionary.h"
#import "OFString.h"
#import "OFExceptions.h"
#define TESTS 10
int
main()
{
int i = 0;
OFDictionary *dict = [OFMutableDictionary dictionaryWithHashSize: 16];
|
|
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <string.h>
#import "OFAutoreleasePool.h"
#import "OFDictionary.h"
#import "OFString.h"
#import "OFExceptions.h"
#define TESTS 12
int
main()
{
int i = 0;
OFDictionary *dict = [OFMutableDictionary dictionaryWithHashSize: 16];
|
112
113
114
115
116
117
118
119
120
121
122
123
|
[dict release];
dict = [OFDictionary dictionaryWithKey: @"foo"
andObject: @"bar"];
if (![[dict get: @"foo"] isEqual: @"bar"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
printf("\033[1;32mTests successful: %d/%d\033[0m\n", i, TESTS);
return 0;
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
[dict release];
dict = [OFDictionary dictionaryWithKey: @"foo"
andObject: @"bar"];
if (![[dict get: @"foo"] isEqual: @"bar"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
[dict release];
dict = [OFDictionary
dictionaryWithKeys: [OFArray arrayWithObjects: @"k1", @"k2", nil]
andObjects: [OFArray arrayWithObjects: @"o1", @"o2", nil]];
if (![[dict get: @"k1"] isEqual: @"o1"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
if (![[dict get: @"k2"] isEqual: @"o2"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
printf("\033[1;32mTests successful: %d/%d\033[0m\n", i, TESTS);
return 0;
}
|