30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-
+
-
+
|
#endif
static OFString *module = nil;
static OFString *whitespace[] = {
@" \r \t\n\t \tasd \t \t\t\r\n",
@" \t\t \t\t \t \t"
};
static of_unichar_t ucstr[] = {
static OFUnichar ucstr[] = {
0xFEFF, 'f', 0xF6, 0xF6, 'b', 0xE4, 'r', 0x1F03A, 0
};
static of_unichar_t sucstr[] = {
static OFUnichar sucstr[] = {
0xFFFE0000, 0x66000000, 0xF6000000, 0xF6000000, 0x62000000, 0xE4000000,
0x72000000, 0x3AF00100, 0
};
static uint16_t utf16str[] = {
0xFEFF, 'f', 0xF6, 0xF6, 'b', 0xE4, 'r', 0xD83C, 0xDC3A, 0
};
static uint16_t sutf16str[] = {
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
|
mutableClass: (Class)mutableStringClass
{
void *pool = objc_autoreleasePoolPush();
OFMutableString *s[3];
OFString *is;
OFArray *a;
size_t i;
const of_unichar_t *ua;
const OFUnichar *ua;
const uint16_t *u16a;
OFCharacterSet *cs;
EntityHandler *h;
#ifdef OF_HAVE_BLOCKS
__block int j;
__block bool ok;
#endif
#define C(s) ((OFString *)[stringClass stringWithString: s])
s[0] = [mutableStringClass stringWithString: @"täs€"];
s[1] = [mutableStringClass 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 &&
[C(@"") compare: @"a"] == OF_ORDERED_ASCENDING &&
[C(@"a") compare: @"b"] == OF_ORDERED_ASCENDING &&
[C(@"cd") compare: @"bc"] == OF_ORDERED_DESCENDING &&
[C(@"ä") compare: @"ö"] == OF_ORDERED_ASCENDING &&
[C(@"€") compare: @"ß"] == OF_ORDERED_DESCENDING &&
[C(@"aa") compare: @"z"] == OF_ORDERED_ASCENDING)
TEST(@"-[compare:]", [s[0] compare: s[2]] == OFOrderedSame &&
[s[0] compare: @""] != OFOrderedSame &&
[C(@"") compare: @"a"] == OFOrderedAscending &&
[C(@"a") compare: @"b"] == OFOrderedAscending &&
[C(@"cd") compare: @"bc"] == OFOrderedDescending &&
[C(@"ä") compare: @"ö"] == OFOrderedAscending &&
[C(@"€") compare: @"ß"] == OFOrderedDescending &&
[C(@"aa") compare: @"z"] == OFOrderedAscending)
#ifdef OF_HAVE_UNICODE_TABLES
TEST(@"-[caseInsensitiveCompare:]",
[C(@"a") caseInsensitiveCompare: @"A"] == OF_ORDERED_SAME &&
[C(@"Ä") caseInsensitiveCompare: @"ä"] == OF_ORDERED_SAME &&
[C(@"я") caseInsensitiveCompare: @"Я"] == OF_ORDERED_SAME &&
[C(@"€") caseInsensitiveCompare: @"ß"] == OF_ORDERED_DESCENDING &&
[C(@"ß") caseInsensitiveCompare: @"→"] == OF_ORDERED_ASCENDING &&
[C(@"AA") caseInsensitiveCompare: @"z"] == OF_ORDERED_ASCENDING &&
[C(@"a") caseInsensitiveCompare: @"A"] == OFOrderedSame &&
[C(@"Ä") caseInsensitiveCompare: @"ä"] == OFOrderedSame &&
[C(@"я") caseInsensitiveCompare: @"Я"] == OFOrderedSame &&
[C(@"€") caseInsensitiveCompare: @"ß"] == OFOrderedDescending &&
[C(@"ß") caseInsensitiveCompare: @"→"] == OFOrderedAscending &&
[C(@"AA") caseInsensitiveCompare: @"z"] == OFOrderedAscending &&
[[stringClass stringWithUTF8String: "ABC"] caseInsensitiveCompare:
[stringClass stringWithUTF8String: "AbD"]] ==
[C(@"abc") compare: @"abd"])
#else
TEST(@"-[caseInsensitiveCompare:]",
[C(@"a") caseInsensitiveCompare: @"A"] == OF_ORDERED_SAME &&
[C(@"AA") caseInsensitiveCompare: @"z"] == OF_ORDERED_ASCENDING &&
[C(@"a") caseInsensitiveCompare: @"A"] == OFOrderedSame &&
[C(@"AA") caseInsensitiveCompare: @"z"] == OFOrderedAscending &&
[[stringClass stringWithUTF8String: "ABC"] caseInsensitiveCompare:
[stringClass stringWithUTF8String: "AbD"]] ==
[C(@"abc") compare: @"abd"])
#endif
TEST(@"-[hash] is the same if -[isEqual:] is true",
s[0].hash == s[2].hash)
|
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
|
[is isEqual: @"fööbär🀺"] &&
(is = [stringClass stringWithUTF32String: sucstr]) &&
[is isEqual: @"fööbär🀺"])
#ifdef OF_HAVE_FILES
TEST(@"+[stringWithContentsOfFile:encoding]", (is = [stringClass
stringWithContentsOfFile: @"testfile.txt"
encoding: OF_STRING_ENCODING_ISO_8859_1]) &&
encoding: OFStringEncodingISO8859_1]) &&
[is isEqual: @"testäöü"])
TEST(@"+[stringWithContentsOfURL:encoding]", (is = [stringClass
stringWithContentsOfURL: [OFURL fileURLWithPath: @"testfile.txt"]
encoding: OF_STRING_ENCODING_ISO_8859_1]) &&
encoding: OFStringEncodingISO8859_1]) &&
[is isEqual: @"testäöü"])
#endif
TEST(@"-[appendUTFString:length:]",
R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux" length: 6]) &&
[s[0] isEqual: @"foobar"])
EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #1",
OFInvalidEncodingException,
[stringClass stringWithUTF8String: "\xE0\x80"])
EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #2",
OFInvalidEncodingException,
[stringClass stringWithUTF8String: "\xF0\x80\x80\xC0"])
TEST(@"Conversion of ISO 8859-1 to Unicode",
[[stringClass stringWithCString: "\xE4\xF6\xFC"
encoding: OF_STRING_ENCODING_ISO_8859_1]
encoding: OFStringEncodingISO8859_1]
isEqual: @"äöü"])
#ifdef HAVE_ISO_8859_15
TEST(@"Conversion of ISO 8859-15 to Unicode",
[[stringClass stringWithCString: "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE"
encoding: OF_STRING_ENCODING_ISO_8859_15]
encoding: OFStringEncodingISO8859_15]
isEqual: @"€ŠšŽžŒœŸ"])
#endif
#ifdef HAVE_WINDOWS_1252
TEST(@"Conversion of Windows 1252 to Unicode",
[[stringClass stringWithCString: "\x80\x82\x83\x84\x85\x86\x87\x88"
"\x89\x8A\x8B\x8C\x8E\x91\x92\x93"
"\x94\x95\x96\x97\x98\x99\x9A\x9B"
"\x9C\x9E\x9F"
encoding: OF_STRING_ENCODING_WINDOWS_1252]
encoding: OFStringEncodingWindows1252]
isEqual: @"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ"])
#endif
#ifdef HAVE_CODEPAGE_437
TEST(@"Conversion of Codepage 437 to Unicode",
[[stringClass stringWithCString: "\xB0\xB1\xB2\xDB"
encoding: OF_STRING_ENCODING_CODEPAGE_437]
encoding: OFStringEncodingCodepage437]
isEqual: @"░▒▓█"])
#endif
TEST(@"Conversion of Unicode to ASCII #1",
!strcmp([C(@"This is a test") cStringWithEncoding:
OF_STRING_ENCODING_ASCII], "This is a test"))
OFStringEncodingASCII], "This is a test"))
EXPECT_EXCEPTION(@"Conversion of Unicode to ASCII #2",
OFInvalidEncodingException,
[C(@"This is a tést")
cStringWithEncoding: OF_STRING_ENCODING_ASCII])
cStringWithEncoding: OFStringEncodingASCII])
TEST(@"Conversion of Unicode to ISO-8859-1 #1",
!strcmp([C(@"This is ä test") cStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_1], "This is \xE4 test"))
OFStringEncodingISO8859_1], "This is \xE4 test"))
EXPECT_EXCEPTION(@"Conversion of Unicode to ISO-8859-1 #2",
OFInvalidEncodingException,
[C(@"This is ä t€st") cStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_1])
OFStringEncodingISO8859_1])
#ifdef HAVE_ISO_8859_15
TEST(@"Conversion of Unicode to ISO-8859-15 #1",
!strcmp([C(@"This is ä t€st") cStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_15], "This is \xE4 t\xA4st"))
OFStringEncodingISO8859_15], "This is \xE4 t\xA4st"))
EXPECT_EXCEPTION(@"Conversion of Unicode to ISO-8859-15 #2",
OFInvalidEncodingException,
[C(@"This is ä t€st…") cStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_15])
OFStringEncodingISO8859_15])
#endif
#ifdef HAVE_WINDOWS_1252
TEST(@"Conversion of Unicode to Windows-1252 #1",
!strcmp([C(@"This is ä t€st…") cStringWithEncoding:
OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85"))
OFStringEncodingWindows1252], "This is \xE4 t\x80st\x85"))
EXPECT_EXCEPTION(@"Conversion of Unicode to Windows-1252 #2",
OFInvalidEncodingException, [C(@"This is ä t€st…‼")
cStringWithEncoding: OF_STRING_ENCODING_WINDOWS_1252])
cStringWithEncoding: OFStringEncodingWindows1252])
#endif
#ifdef HAVE_CODEPAGE_437
TEST(@"Conversion of Unicode to Codepage 437 #1",
!strcmp([C(@"Tést strîng ░▒▓") cStringWithEncoding:
OF_STRING_ENCODING_CODEPAGE_437], "T\x82st str\x8Cng \xB0\xB1\xB2"))
OFStringEncodingCodepage437], "T\x82st str\x8Cng \xB0\xB1\xB2"))
EXPECT_EXCEPTION(@"Conversion of Unicode to Codepage 437 #2",
OFInvalidEncodingException, [C(@"T€st strîng ░▒▓")
cStringWithEncoding: OF_STRING_ENCODING_CODEPAGE_437])
cStringWithEncoding: OFStringEncodingCodepage437])
#endif
TEST(@"Lossy conversion of Unicode to ASCII",
!strcmp([C(@"This is a tést") lossyCStringWithEncoding:
OF_STRING_ENCODING_ASCII], "This is a t?st"))
OFStringEncodingASCII], "This is a t?st"))
TEST(@"Lossy conversion of Unicode to ISO-8859-1",
!strcmp([C(@"This is ä t€st") lossyCStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_1], "This is \xE4 t?st"))
OFStringEncodingISO8859_1], "This is \xE4 t?st"))
#ifdef HAVE_ISO_8859_15
TEST(@"Lossy conversion of Unicode to ISO-8859-15",
!strcmp([C(@"This is ä t€st…") lossyCStringWithEncoding:
OF_STRING_ENCODING_ISO_8859_15], "This is \xE4 t\xA4st?"))
OFStringEncodingISO8859_15], "This is \xE4 t\xA4st?"))
#endif
#ifdef HAVE_WINDOWS_1252
TEST(@"Lossy conversion of Unicode to Windows-1252",
!strcmp([C(@"This is ä t€st…‼") lossyCStringWithEncoding:
OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85?"))
OFStringEncodingWindows1252], "This is \xE4 t\x80st\x85?"))
#endif
#ifdef HAVE_CODEPAGE_437
TEST(@"Lossy conversion of Unicode to Codepage 437",
!strcmp([C(@"T€st strîng ░▒▓") lossyCStringWithEncoding:
OF_STRING_ENCODING_CODEPAGE_437], "T?st str\x8Cng \xB0\xB1\xB2"))
OFStringEncodingCodepage437], "T?st str\x8Cng \xB0\xB1\xB2"))
#endif
TEST(@"+[stringWithFormat:]",
[(s[0] = [mutableStringClass stringWithFormat: @"%@:%d", @"test",
123])
isEqual: @"test:123"])
TEST(@"-[appendFormat:]",
R(([s[0] appendFormat: @"%02X", 15])) &&
[s[0] isEqual: @"test:1230F"])
TEST(@"-[rangeOfString:]",
[C(@"𝄞öö") rangeOfString: @"öö"].location == 1 &&
[C(@"𝄞öö") rangeOfString: @"ö"].location == 1 &&
[C(@"𝄞öö") rangeOfString: @"𝄞"].location == 0 &&
[C(@"𝄞öö") rangeOfString: @"x"].location == OF_NOT_FOUND &&
[C(@"𝄞öö") rangeOfString: @"x"].location == OFNotFound &&
[C(@"𝄞öö") rangeOfString: @"öö"
options: OF_STRING_SEARCH_BACKWARDS].location == 1 &&
options: OFStringSearchBackwards].location == 1 &&
[C(@"𝄞öö") rangeOfString: @"ö"
options: OF_STRING_SEARCH_BACKWARDS].location == 2 &&
options: OFStringSearchBackwards].location == 2 &&
[C(@"𝄞öö") rangeOfString: @"𝄞"
options: OF_STRING_SEARCH_BACKWARDS].location == 0 &&
options: OFStringSearchBackwards].location == 0 &&
[C(@"𝄞öö") rangeOfString: @"x"
options: OF_STRING_SEARCH_BACKWARDS].location == OF_NOT_FOUND)
options: OFStringSearchBackwards].location == OFNotFound)
EXPECT_EXCEPTION(
@"Detect out of range in -[rangeOfString:options:range:]",
OFOutOfRangeException,
[C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: of_range(3, 1)])
[C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: OFMakeRange(3, 1)])
cs = [OFCharacterSet characterSetWithCharactersInString: @"cđ"];
TEST(@"-[indexOfCharacterFromSet:]",
[C(@"abcđabcđe") indexOfCharacterFromSet: cs] == 2 &&
[C(@"abcđabcđë")
indexOfCharacterFromSet: cs
options: OF_STRING_SEARCH_BACKWARDS] == 7 &&
options: OFStringSearchBackwards] == 7 &&
[C(@"abcđabcđë")
indexOfCharacterFromSet: cs
options: 0
range: of_range(4, 4)] == 6 &&
range: OFMakeRange(4, 4)] == 6 &&
[C(@"abcđabcđëf")
indexOfCharacterFromSet: cs
options: 0
range: of_range(8, 2)] == OF_NOT_FOUND)
range: OFMakeRange(8, 2)] == OFNotFound)
EXPECT_EXCEPTION(
@"Detect out of range in -[indexOfCharacterFromSet:options:range:]",
OFOutOfRangeException,
[C(@"𝄞öö") indexOfCharacterFromSet: cs
options: 0
range: of_range(3, 1)])
range: OFMakeRange(3, 1)])
TEST(@"-[substringWithRange:]",
[[C(@"𝄞öö") substringWithRange: of_range(1, 1)] isEqual: @"ö"] &&
[[C(@"𝄞öö") substringWithRange: of_range(3, 0)] isEqual: @""])
[[C(@"𝄞öö") substringWithRange: OFMakeRange(1, 1)] isEqual: @"ö"] &&
[[C(@"𝄞öö") substringWithRange: OFMakeRange(3, 0)] isEqual: @""])
EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #1",
OFOutOfRangeException,
[C(@"𝄞öö") substringWithRange: of_range(2, 2)])
[C(@"𝄞öö") substringWithRange: OFMakeRange(2, 2)])
EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #2",
OFOutOfRangeException,
[C(@"𝄞öö") substringWithRange: of_range(4, 0)])
[C(@"𝄞öö") substringWithRange: OFMakeRange(4, 0)])
TEST(@"-[stringByAppendingString:]",
[[C(@"foo") stringByAppendingString: @"bar"] isEqual: @"foobar"])
TEST(@"-[stringByPrependingString:]",
[[C(@"foo") stringByPrependingString: @"bar"] isEqual: @"barfoo"])
|
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
|
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
[s[0] isEqual: @"abcde"] &&
R([s[0] setCharacter: 0x20AC atIndex: 3]) &&
[s[0] isEqual: @"abc€e"] &&
R([s[0] setCharacter: 'x' atIndex: 1]) && [s[0] isEqual: @"axc€e"])
TEST(@"-[deleteCharactersInRange:]",
(s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) &&
R([s[0] deleteCharactersInRange: of_range(1, 3)]) &&
R([s[0] deleteCharactersInRange: OFMakeRange(1, 3)]) &&
[s[0] isEqual: @"𝄞bä€"] &&
R([s[0] deleteCharactersInRange: of_range(0, 4)]) &&
R([s[0] deleteCharactersInRange: OFMakeRange(0, 4)]) &&
[s[0] isEqual: @""])
TEST(@"-[replaceCharactersInRange:withString:]",
(s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) &&
R([s[0] replaceCharactersInRange: of_range(1, 3)
R([s[0] replaceCharactersInRange: OFMakeRange(1, 3)
withString: @"äöüß"]) &&
[s[0] isEqual: @"𝄞äöüßbä€"] &&
R([s[0] replaceCharactersInRange: of_range(4, 2)
R([s[0] replaceCharactersInRange: OFMakeRange(4, 2)
withString: @"b"]) &&
[s[0] isEqual: @"𝄞äöübä€"] &&
R([s[0] replaceCharactersInRange: of_range(0, 7)
R([s[0] replaceCharactersInRange: OFMakeRange(0, 7)
withString: @""]) &&
[s[0] isEqual: @""])
EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1",
OFOutOfRangeException,
{
s[0] = [mutableStringClass stringWithString: @"𝄞öö"];
[s[0] deleteCharactersInRange: of_range(2, 2)];
[s[0] deleteCharactersInRange: OFMakeRange(2, 2)];
})
EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #2",
OFOutOfRangeException,
[s[0] deleteCharactersInRange: of_range(4, 0)])
[s[0] deleteCharactersInRange: OFMakeRange(4, 0)])
EXPECT_EXCEPTION(@"Detect OoR in "
@"-[replaceCharactersInRange:withString:] #1",
OFOutOfRangeException,
[s[0] replaceCharactersInRange: of_range(2, 2) withString: @""])
[s[0] replaceCharactersInRange: OFMakeRange(2, 2) withString: @""])
EXPECT_EXCEPTION(@"Detect OoR in "
@"-[replaceCharactersInRange:withString:] #2",
OFOutOfRangeException,
[s[0] replaceCharactersInRange: of_range(4, 0) withString: @""])
[s[0] replaceCharactersInRange: OFMakeRange(4, 0) withString: @""])
TEST(@"-[replaceOccurrencesOfString:withString:]",
(s[0] = [mutableStringClass stringWithString:
@"asd fo asd fofo asd"]) &&
R([s[0] replaceOccurrencesOfString: @"fo" withString: @"foo"]) &&
[s[0] isEqual: @"asd foo asd foofoo asd"] &&
(s[0] = [mutableStringClass stringWithString: @"XX"]) &&
R([s[0] replaceOccurrencesOfString: @"X" withString: @"XX"]) &&
[s[0] isEqual: @"XXXX"])
TEST(@"-[replaceOccurrencesOfString:withString:options:range:]",
(s[0] = [mutableStringClass stringWithString:
@"foofoobarfoobarfoo"]) &&
R([s[0] replaceOccurrencesOfString: @"oo"
withString: @"óò"
options: 0
range: of_range(2, 15)]) &&
range: OFMakeRange(2, 15)]) &&
[s[0] isEqual: @"foofóòbarfóòbarfoo"])
TEST(@"-[deleteLeadingWhitespaces]",
(s[0] = [mutableStringClass stringWithString: whitespace[0]]) &&
R([s[0] deleteLeadingWhitespaces]) &&
[s[0] isEqual: @"asd \t \t\t\r\n"] &&
(s[0] = [mutableStringClass stringWithString: whitespace[1]]) &&
|