345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
componentsSeparatedByString: @"XX"
options: OF_STRING_SKIP_EMPTY]) &&
[a count] == 3 &&
[[a objectAtIndex: i++] isEqual: @"foo"] &&
[[a objectAtIndex: i++] isEqual: @"bar"] &&
[[a objectAtIndex: i++] isEqual: @"baz"])
#if !defined(_WIN32) && !defined(__DJGPP__)
# define EXPECTED @"foo/bar/baz"
#else
# define EXPECTED @"foo\\bar\\baz"
#endif
TEST(@"+[pathWithComponents:]",
(is = [OFString pathWithComponents: [OFArray arrayWithObjects:
@"foo", @"bar", @"baz", nil]]) &&
|
|
|
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
componentsSeparatedByString: @"XX"
options: OF_STRING_SKIP_EMPTY]) &&
[a count] == 3 &&
[[a objectAtIndex: i++] isEqual: @"foo"] &&
[[a objectAtIndex: i++] isEqual: @"bar"] &&
[[a objectAtIndex: i++] isEqual: @"baz"])
#if !defined(OF_WINDOWS) && !defined(OF_MSDOS)
# define EXPECTED @"foo/bar/baz"
#else
# define EXPECTED @"foo\\bar\\baz"
#endif
TEST(@"+[pathWithComponents:]",
(is = [OFString pathWithComponents: [OFArray arrayWithObjects:
@"foo", @"bar", @"baz", nil]]) &&
|
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
[[@"/tmp/" stringByDeletingLastPathComponent] isEqual: @"/"] &&
[[@"/tmp/foo/" stringByDeletingLastPathComponent]
isEqual: @"/tmp"] &&
[[@"foo/bar" stringByDeletingLastPathComponent] isEqual: @"foo"] &&
[[@"/" stringByDeletingLastPathComponent] isEqual: @"/"] &&
[[@"foo" stringByDeletingLastPathComponent] isEqual: @"."])
#if !defined(_WIN32) && !defined(__DJGPP__)
# define EXPECTED @"/foo./bar"
#else
# define EXPECTED @"\\foo.\\bar"
#endif
TEST(@"-[stringByDeletingPathExtension]",
[[@"foo.bar" stringByDeletingPathExtension] isEqual: @"foo"] &&
[[@"foo..bar" stringByDeletingPathExtension] isEqual: @"foo."] &&
|
|
|
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
[[@"/tmp/" stringByDeletingLastPathComponent] isEqual: @"/"] &&
[[@"/tmp/foo/" stringByDeletingLastPathComponent]
isEqual: @"/tmp"] &&
[[@"foo/bar" stringByDeletingLastPathComponent] isEqual: @"foo"] &&
[[@"/" stringByDeletingLastPathComponent] isEqual: @"/"] &&
[[@"foo" stringByDeletingLastPathComponent] isEqual: @"."])
#if !defined(OF_WINDOWS) && !defined(OF_MSDOS)
# define EXPECTED @"/foo./bar"
#else
# define EXPECTED @"\\foo.\\bar"
#endif
TEST(@"-[stringByDeletingPathExtension]",
[[@"foo.bar" stringByDeletingPathExtension] isEqual: @"foo"] &&
[[@"foo..bar" stringByDeletingPathExtension] isEqual: @"foo."] &&
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
|
* floating point numbers, thus we can use == on them.
*/
TEST(@"-[floatValue]",
[@"\t-0.25 " floatValue] == -0.25 &&
[@"\r-INFINITY\n" floatValue] == -INFINITY &&
isnan([@" NAN\t\t" floatValue]))
#if !defined(__ANDROID__) && !defined(__sun__) && !defined(__DJGPP__)
# define INPUT @"\t-0x1.FFFFFFFFFFFFFP-1020 "
# define EXPECTED -0x1.FFFFFFFFFFFFFP-1020
#else
/* Android, Solaris and DJGPP do not accept 0x for strtod() */
# if !defined(__sun__) || !defined(__i386__)
# define INPUT @"\t-0.123456789 "
# define EXPECTED -0.123456789
# else
/* Solaris' strtod() has weird rounding on x86, but not on x86_64 */
# define INPUT @"\t-0.125 "
# define EXPECTED -0.125
# endif
|
|
|
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
|
* floating point numbers, thus we can use == on them.
*/
TEST(@"-[floatValue]",
[@"\t-0.25 " floatValue] == -0.25 &&
[@"\r-INFINITY\n" floatValue] == -INFINITY &&
isnan([@" NAN\t\t" floatValue]))
#if !defined(__ANDROID__) && !defined(OF_SOLARIS) && !defined(__DJGPP__)
# define INPUT @"\t-0x1.FFFFFFFFFFFFFP-1020 "
# define EXPECTED -0x1.FFFFFFFFFFFFFP-1020
#else
/* Android, Solaris and DJGPP do not accept 0x for strtod() */
# if !defined(OF_SOLARIS) || !defined(OF_X86)
# define INPUT @"\t-0.123456789 "
# define EXPECTED -0.123456789
# else
/* Solaris' strtod() has weird rounding on x86, but not on x86_64 */
# define INPUT @"\t-0.125 "
# define EXPECTED -0.125
# endif
|