24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
int
main()
{
int i = 0;
OFDictionary *dict = [OFMutableDictionary dictionaryWithHashSize: 16];
OFDictionary *dict2;
OFIterator *iter = [dict iterator];
of_iterator_pair_t pair[2];
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFString *key1 = [OFString stringWithCString: "key1"];
OFString *key2 = [OFString stringWithCString: "key2"];
OFString *value1 = [OFString stringWithCString: "value1"];
|
>
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
int
main()
{
int i = 0;
OFDictionary *dict = [OFMutableDictionary dictionaryWithHashSize: 16];
OFDictionary *dict2;
OFArray *keys, *objs;
OFIterator *iter = [dict iterator];
of_iterator_pair_t pair[2];
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFString *key1 = [OFString stringWithCString: "key1"];
OFString *key2 = [OFString stringWithCString: "key2"];
OFString *value1 = [OFString stringWithCString: "value1"];
|
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
|
if (![[dict objectForKey: @"baz"] isEqual: @"qux"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
[dict release];
dict = [OFDictionary dictionaryWithKey: @"foo"
andObject: @"bar"];
if (![[dict objectForKey: @"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 objectForKey: @"k1"] isEqual: @"o1"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
if (![[dict objectForKey: @"k2"] isEqual: @"o2"]) {
|
|
|
<
|
|
>
>
|
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
|
if (![[dict objectForKey: @"baz"] isEqual: @"qux"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
[dict release];
dict = [OFDictionary dictionaryWithObject: @"bar"
forKey: @"foo"];
if (![[dict objectForKey: @"foo"] isEqual: @"bar"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
[dict release];
keys = [OFArray arrayWithObjects: @"k1", @"k2", nil];
objs = [OFArray arrayWithObjects: @"o1", @"o2", nil];
dict = [OFDictionary dictionaryWithObjects: objs
forKeys: keys];
if (![[dict objectForKey: @"k1"] isEqual: @"o1"]) {
printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS);
return 1;
}
i++;
if (![[dict objectForKey: @"k2"] isEqual: @"o2"]) {
|