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 68
#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 69
#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); \
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
CHECK_EXCEPT(s1 = [OFString stringWithCString: "\xF0\x80\x80\xC0"],
OFInvalidEncodingException)
s1 = [OFMutableString stringWithCString: "äöü€𝄞"];
CHECK([[s1 reverse] isEqual: @"𝄞€üöä"])
[s1 dealloc];
/* Format tests */
s1 = [OFMutableString stringWithFormat: @"%s: %d", "test", 123];
CHECK([s1 isEqual: @"test: 123"])
[s1 appendWithFormat: @"%02X", 15];
CHECK([s1 isEqual: @"test: 1230F"])
|
>
>
>
>
>
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
CHECK_EXCEPT(s1 = [OFString stringWithCString: "\xF0\x80\x80\xC0"],
OFInvalidEncodingException)
s1 = [OFMutableString stringWithCString: "äöü€𝄞"];
CHECK([[s1 reverse] isEqual: @"𝄞€üöä"])
[s1 dealloc];
/* ISO-8859-1 tests */
CHECK([[OFString stringWithCString: "\xE4\xF6\xFC"
encoding: OF_STRING_ENCODING_ISO_8859_1]
isEqual: @"äöü"])
/* Format tests */
s1 = [OFMutableString stringWithFormat: @"%s: %d", "test", 123];
CHECK([s1 isEqual: @"test: 123"])
[s1 appendWithFormat: @"%02X", 15];
CHECK([s1 isEqual: @"test: 1230F"])
|