Differences From Artifact [f3e8ef8a53]:
- File tests/OFListTests.m — part of check-in [813c00ccf0] at 2013-01-09 22:24:47 on branch trunk — Update copyright. (user: js, size: 4145) [annotate] [blame] [check-ins using]
To Artifact [a1285e945c]:
- File
tests/OFListTests.m
— part of check-in
[c5ef582958]
at
2013-03-04 17:20:15
on branch trunk
— Replace BOOL with bool.
The only places where BOOL is left are those where they are required by
the ABI. (user: js, size: 4139) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
36 37 38 39 40 41 42 | { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFList *list; OFEnumerator *enumerator; of_list_object_t *loe; OFString *obj; size_t i; | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFList *list; OFEnumerator *enumerator; of_list_object_t *loe; OFString *obj; size_t i; bool ok; TEST(@"+[list]", (list = [OFList list])) TEST(@"-[appendObject:]", [list appendObject: strings[0]] && [list appendObject: strings[1]] && [list appendObject: strings[2]]) TEST(@"-[firstListObject]", |
︙ | ︙ | |||
75 76 77 78 79 80 81 | [list insertObject: strings[2] afterListObject: [list firstListObject]->next] && [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[count]", [list count] == 3) TEST(@"-[containsObject:]", | | | | | | | | | | | | | | | 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 | [list insertObject: strings[2] afterListObject: [list firstListObject]->next] && [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[count]", [list count] == 3) TEST(@"-[containsObject:]", [list containsObject: strings[1]] && ![list containsObject: @"nonexistant"]) TEST(@"-[containsObjectIdenticalTo:]", [list containsObjectIdenticalTo: strings[1]] && ![list containsObjectIdenticalTo: [OFString stringWithString: strings[1]]]) TEST(@"-[copy]", (list = [[list copy] autorelease]) && [[list firstListObject]->object isEqual: strings[0]] && [[list firstListObject]->next->object isEqual: strings[1]] && [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[isEqual:]", [list isEqual: [[list copy] autorelease]]) TEST(@"-[description]", [[list description] isEqual: @"[\n\tFoo,\n\tBar,\n\tBaz\n]"]) TEST(@"-[objectEnumerator]", (enumerator = [list objectEnumerator])) loe = [list firstListObject]; i = 0; ok = true; while ((obj = [enumerator nextObject]) != nil) { if (![obj isEqual: loe->object]) ok = false; loe = loe->next; i++; } if ([list count] != i) ok = false; TEST(@"OFEnumerator's -[nextObject]", ok); [enumerator reset]; [list removeListObject: [list firstListObject]]; EXPECT_EXCEPTION(@"Detection of mutation during enumeration", OFEnumerationMutationException, [enumerator nextObject]) [list prependObject: strings[0]]; #ifdef OF_HAVE_FAST_ENUMERATION loe = [list firstListObject]; i = 0; ok = true; for (OFString *obj in list) { if (![obj isEqual: loe->object]) ok = false; loe = loe->next; i++; } if ([list count] != i) ok = false; TEST(@"Fast Enumeration", ok) ok = false; @try { for (OFString *obj in list) [list removeListObject: [list lastListObject]]; } @catch (OFEnumerationMutationException *e) { ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok) #endif [pool drain]; } @end |