Differences From Artifact [ba48f04406]:
- File tests/OFDictionary/OFDictionary.m — part of check-in [5413ba3c49] at 2009-05-19 16:15:31 on branch trunk — One more convenience method for OFDictionary. (user: js, size: 3408) [annotate] [blame] [check-ins using]
To Artifact [1070e23922]:
- File
tests/OFDictionary/OFDictionary.m
— part of check-in
[a29d403286]
at
2009-05-23 16:50:44
on branch trunk
— A few renames in OFArray, OFDataArray and OFDictionary.
OFArray:
* Rename - object: to - objectAtIndex:.OFDataArray:
* Rename - item: to - itemAtIndex:.OFDictionary:
* Rename - get: to - objectForKey:.
* Rename - set:to: to - setObject:forKey:.
* Rename - remove: to - removeObjectForKey:. (user: js, size: 3490) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
31 32 33 34 35 36 37 | OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *key1 = [OFString stringWithCString: "key1"]; OFString *key2 = [OFString stringWithCString: "key2"]; OFString *value1 = [OFString stringWithCString: "value1"]; OFString *value2 = [OFString stringWithCString: "value2"]; | | | | | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *key1 = [OFString stringWithCString: "key1"]; OFString *key2 = [OFString stringWithCString: "key2"]; OFString *value1 = [OFString stringWithCString: "value1"]; OFString *value2 = [OFString stringWithCString: "value2"]; [dict setObject: value1 forKey: key1]; [dict setObject: value2 forKey: key2]; [pool release]; i++; if (strcmp([[dict objectForKey: @"key1"] cString], "value1")) { printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS); return 1; } i++; if (strcmp([[dict objectForKey: key2] cString], "value2")) { printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS); return 1; } i++; if (![[iter nextObject] isEqual: @"key2"] || ![[iter nextObject] isEqual: @"value2"] || |
︙ | ︙ | |||
82 83 84 85 86 87 88 | i++; if ([iter nextObject] != nil) { printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS); return 1; } i++; | | | | | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 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 | i++; if ([iter nextObject] != nil) { printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS); return 1; } i++; if ([dict objectForKey: @"key3"] != nil) { printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS); return 1; } i++; [dict release]; dict = [OFDictionary dictionaryWithKeysAndObjects: @"foo", @"bar", @"baz", @"qux", nil]; if (![[dict objectForKey: @"foo"] isEqual: @"bar"]) { printf("\033[K\033[1;31mTest %d/%d failed!\033[m\n", i, TESTS); return 1; } i++; 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"]) { 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; } |