50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
s[1] = [OFMutableString string];
s[2] = [[s[0] copy] autorelease];
TEST(@"-[isEqual:]", [s[0] isEqual: s[2]] &&
![s[0] isEqual: [[[OFObject alloc] init] autorelease]])
TEST(@"-[compare:]", [s[0] compare: s[2]] == OF_ORDERED_SAME &&
[s[0] compare: @""] != OF_ORDERED_SAME)
TEST(@"-[hash] is the same if -[isEqual:] is YES",
[s[0] hash] == [s[2] hash])
TEST(@"-[appendString:] and -[appendCString:]",
[s[1] appendCString: "1𝄞"] && [s[1] appendString: @"3"] &&
[[s[0] appendString: s[1]] isEqual: @"täs€1𝄞3"])
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
s[1] = [OFMutableString string];
s[2] = [[s[0] copy] autorelease];
TEST(@"-[isEqual:]", [s[0] isEqual: s[2]] &&
![s[0] isEqual: [[[OFObject alloc] init] autorelease]])
TEST(@"-[compare:]", [s[0] compare: s[2]] == OF_ORDERED_SAME &&
[s[0] compare: @""] != OF_ORDERED_SAME &&
[@"" compare: @"a"] == OF_ORDERED_ASCENDING &&
[@"a" compare: @"b"] == OF_ORDERED_ASCENDING &&
[@"cd" compare: @"bc"] == OF_ORDERED_DESCENDING &&
[@"ä" compare: @"ö"] == OF_ORDERED_ASCENDING &&
[@"€" compare: @"ß"] == OF_ORDERED_DESCENDING &&
[@"aa" compare: @"z"] == OF_ORDERED_ASCENDING)
TEST(@"-[caseInsensitiveCompare:]",
[@"a" caseInsensitiveCompare: @"A"] == OF_ORDERED_SAME &&
[@"Ä" caseInsensitiveCompare: @"ä"] == OF_ORDERED_SAME &&
[@"я" caseInsensitiveCompare: @"Я"] == OF_ORDERED_SAME &&
[@"€" caseInsensitiveCompare: @"ß"] == OF_ORDERED_DESCENDING &&
[@"ß" caseInsensitiveCompare: @"→"] == OF_ORDERED_ASCENDING &&
[@"AA" caseInsensitiveCompare: @"z"] == OF_ORDERED_ASCENDING)
TEST(@"-[hash] is the same if -[isEqual:] is YES",
[s[0] hash] == [s[2] hash])
TEST(@"-[appendString:] and -[appendCString:]",
[s[1] appendCString: "1𝄞"] && [s[1] appendString: @"3"] &&
[[s[0] appendString: s[1]] isEqual: @"täs€1𝄞3"])
|