253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
!strcmp([@"This is ä t€st…" cStringWithEncoding:
OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85"))
EXPECT_EXCEPTION(@"Conversion of Unicode to Windows-1252 #2",
OFInvalidEncodingException, [@"This is ä t€st…‼"
cStringWithEncoding: OF_STRING_ENCODING_WINDOWS_1252])
TEST(@"Lossy conversion of Unicode to ASCII",
!strcmp([@"This is a tést" lossyCStringWithEncoding:
OF_STRING_ENCODING_ASCII], "This is a t?st"))
TEST(@"Lossy conversion of Unicode to ISO-8859-1",
!strcmp([@"This is ä t€st" lossyCStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_1], "This is \xE4 t?st"))
TEST(@"Lossy conversion of Unicode to ISO-8859-15",
!strcmp([@"This is ä t€st…" lossyCStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_15], "This is \xE4 t\xA4st?"))
TEST(@"Lossy conversion of Unicode to Windows-1252",
!strcmp([@"This is ä t€st…‼" lossyCStringWithEncoding:
OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85?"))
TEST(@"+[stringWithFormat:]",
[(s[0] = [OFMutableString stringWithFormat: @"%@:%d", @"test", 123])
isEqual: @"test:123"])
TEST(@"-[appendFormat:]",
R(([s[0] appendFormat: @"%02X", 15])) &&
[s[0] isEqual: @"test:1230F"])
|
>
>
>
>
>
>
>
>
>
>
>
>
|
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
!strcmp([@"This is ä t€st…" cStringWithEncoding:
OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85"))
EXPECT_EXCEPTION(@"Conversion of Unicode to Windows-1252 #2",
OFInvalidEncodingException, [@"This is ä t€st…‼"
cStringWithEncoding: OF_STRING_ENCODING_WINDOWS_1252])
TEST(@"Conversion of Unicode to Codepage 437 #1",
!strcmp([@"Tést strîng ░▒▓" cStringWithEncoding:
OF_STRING_ENCODING_CODEPAGE_437], "T\x82st str\x8Cng \xB0\xB1\xB2"))
EXPECT_EXCEPTION(@"Conversion of Unicode to Codepage 437 #2",
OFInvalidEncodingException, [@"T€st strîng ░▒▓"
cStringWithEncoding: OF_STRING_ENCODING_CODEPAGE_437])
TEST(@"Lossy conversion of Unicode to ASCII",
!strcmp([@"This is a tést" lossyCStringWithEncoding:
OF_STRING_ENCODING_ASCII], "This is a t?st"))
TEST(@"Lossy conversion of Unicode to ISO-8859-1",
!strcmp([@"This is ä t€st" lossyCStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_1], "This is \xE4 t?st"))
TEST(@"Lossy conversion of Unicode to ISO-8859-15",
!strcmp([@"This is ä t€st…" lossyCStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_15], "This is \xE4 t\xA4st?"))
TEST(@"Lossy conversion of Unicode to Windows-1252",
!strcmp([@"This is ä t€st…‼" lossyCStringWithEncoding:
OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85?"))
TEST(@"Lossy conversion of Unicode to Codepage 437",
!strcmp([@"T€st strîng ░▒▓" lossyCStringWithEncoding:
OF_STRING_ENCODING_CODEPAGE_437], "T?st str\x8Cng \xB0\xB1\xB2"))
TEST(@"+[stringWithFormat:]",
[(s[0] = [OFMutableString stringWithFormat: @"%@:%d", @"test", 123])
isEqual: @"test:123"])
TEST(@"-[appendFormat:]",
R(([s[0] appendFormat: @"%02X", 15])) &&
[s[0] isEqual: @"test:1230F"])
|