Overview
Comment: | Add tests for generic OFArray / OFMutableArray
These are usually not used, as OFArray_adjacent and |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7fec2ef57e6b1f33870614a0532dd2e5 |
User & Date: | js on 2017-05-01 13:37:26 |
Other Links: | manifest | tags |
Context
2017-05-01
| ||
13:51 | Add tests for generic OF(Mutable)Dictionary check-in: cfd54bd090 user: js tags: trunk | |
13:37 | Add tests for generic OFArray / OFMutableArray check-in: 7fec2ef57e user: js tags: trunk | |
13:26 | Prepare OFArrayTests for different array classes check-in: d36735bfd9 user: js tags: trunk | |
Changes
Modified src/OFMutableArray_adjacent.m from [6ee14e3c8a] to [55b87bb47c].
︙ | |||
231 232 233 234 235 236 237 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | - + | - (void)removeObjectsInRange: (of_range_t)range { id *objects = [_array items], *copy; size_t count = [_array count]; if (range.length > SIZE_MAX - range.location || |
︙ |
Modified tests/OFArrayTests.m from [15bc3461c3] to [c99073b249].
︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 29 30 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - | static OFString *module = nil; static OFString *c_ary[] = { @"Foo", @"Bar", @"Baz" }; @interface SimpleArray: OFArray { OFMutableArray *_array; } @end @interface SimpleMutableArray: OFMutableArray { OFMutableArray *_array; } @end @implementation SimpleArray - init { self = [super init]; @try { _array = [[OFMutableArray alloc] init]; } @catch (id e) { [self release]; @throw e; } return self; } - initWithObject: (id)object arguments: (va_list)arguments { self = [super init]; @try { _array = [[OFMutableArray alloc] initWithObject: object arguments: arguments]; } @catch (id e) { [self release]; @throw e; } return self; } - initWithObjects: (id const*)objects count: (size_t)count { self = [super init]; @try { _array = [[OFMutableArray alloc] initWithObjects: objects count: count]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_array release]; [super dealloc]; } - (id)objectAtIndex: (size_t)index { return [_array objectAtIndex: index]; } - (size_t)count { return [_array count]; } @end @implementation SimpleMutableArray + (void)initialize { if (self == [SimpleMutableArray class]) [self inheritMethodsFromClass: [SimpleArray class]]; } - (void)insertObject: (id)object atIndex: (size_t)index { [_array insertObject: object atIndex: index]; } - (void)replaceObjectAtIndex: (size_t)index withObject: (id)object { [_array replaceObjectAtIndex: index withObject: object]; } - (void)removeObjectAtIndex: (size_t)index { [_array removeObjectAtIndex: index]; } @end @implementation TestsAppDelegate (OFArrayTests) - (void)arrayTestsWithClass: (Class)arrayClass mutableClass: (Class)mutableArrayClass { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFArray *a[3]; OFMutableArray *m[2]; OFEnumerator *enumerator; id obj; bool ok; size_t i; |
︙ | |||
347 348 349 350 351 352 353 354 355 356 357 | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | + + + + + | [OFURL URLWithString: @"http://qux.quxqux:1234/"], nil]]) [pool drain]; } - (void)arrayTests { module = @"OFArray"; [self arrayTestsWithClass: [SimpleArray class] mutableClass: [SimpleMutableArray class]]; module = @"OFArray_adjacent"; [self arrayTestsWithClass: [OFArray class] mutableClass: [OFMutableArray class]]; } @end |