20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif
#define NUM_TESTS 60
#define SUCCESS \
printf("\r\033[1;%dmTests successful: " ZD "/%d\033[0m", \
(i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS); \
fflush(stdout);
#define FAIL \
printf("\r\033[K\033[1;31mTest " ZD "/%d failed!\033[m\n", \
i + 1, NUM_TESTS); \
|
|
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif
#define NUM_TESTS 62
#define SUCCESS \
printf("\r\033[1;%dmTests successful: " ZD "/%d\033[0m", \
(i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS); \
fflush(stdout);
#define FAIL \
printf("\r\033[K\033[1;31mTest " ZD "/%d failed!\033[m\n", \
i + 1, NUM_TESTS); \
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
CHECK([[a objectAtIndex: j++] isEqual: @"foo"])
CHECK([[a objectAtIndex: j++] isEqual: @"bar"])
CHECK([[a objectAtIndex: j++] isEqual: @""])
CHECK([[a objectAtIndex: j++] isEqual: @"baz"])
CHECK([[a objectAtIndex: j++] isEqual: @""])
CHECK([[a objectAtIndex: j++] isEqual: @""])
/* URL encoding tests */
CHECK([[@"foo\"ba'_~$" stringByURLEncoding]
isEqual: @"foo%22ba%27_~%24"])
CHECK([[@"foo%20bar%22+%24" stringByURLDecoding]
isEqual: @"foo bar\" $"])
CHECK_EXCEPT([@"foo%bar" stringByURLDecoding],
OFInvalidEncodingException)
|
>
>
>
>
>
>
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
CHECK([[a objectAtIndex: j++] isEqual: @"foo"])
CHECK([[a objectAtIndex: j++] isEqual: @"bar"])
CHECK([[a objectAtIndex: j++] isEqual: @""])
CHECK([[a objectAtIndex: j++] isEqual: @"baz"])
CHECK([[a objectAtIndex: j++] isEqual: @""])
CHECK([[a objectAtIndex: j++] isEqual: @""])
/* Hash tests */
CHECK([[@"asdfoobar" md5Hash]
isEqual: @"184dce2ec49b5422c7cfd8728864db4c"]);
CHECK([[@"asdfoobar" sha1Hash]
isEqual: @"f5f81ac0a8b5cbfdc4585ec1ad32e7b3a12b9b49"]);
/* URL encoding tests */
CHECK([[@"foo\"ba'_~$" stringByURLEncoding]
isEqual: @"foo%22ba%27_~%24"])
CHECK([[@"foo%20bar%22+%24" stringByURLDecoding]
isEqual: @"foo bar\" $"])
CHECK_EXCEPT([@"foo%bar" stringByURLDecoding],
OFInvalidEncodingException)
|