ObjFW  Diff

Differences From Artifact [b0a9478f37]:

To Artifact [3c7c95496c]:

  • File tests/OFStringTests.m — part of check-in [c5e7dd679b] at 2013-09-17 16:12:37 on branch trunk — Work around Android bugs.

    Includes:
    * Check environ against NULL before using it, since Android sets it to
    NULL.
    * Cast st_size of struct stat to off_t. Android uses long long for
    st_size as its off_t is only 32 bit, but st_size should be off_t
    according to POSIX.
    * Android's strtod() does not accept 0x, as specified by C99. Thus,
    the test is disabled if __ANDROID__ is defined. (user: js, size: 24162) [annotate] [blame] [check-ins using]


375
376
377
378
379
380
381

382
383




384
385
386
387
388
389
390
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395







+


+
+
+
+







	 */
	TEST(@"-[floatValue]",
	    [@"\t-0.25 " floatValue] == -0.25 &&
	    [@"\r-INFINITY\n" floatValue] == -INFINITY &&
	    isnan([@"   NAN\t\t" floatValue]))

	TEST(@"-[doubleValue]",
#ifndef __ANDROID__
	    [@"\t-0x1.FFFFFFFFFFFFFP-1020 " doubleValue] ==
	    -0x1.FFFFFFFFFFFFFP-1020 &&
#else
	    /* strtod() does not accept 0x on Android */
	    [@"\t-0.123456789 " doubleValue] == -0.123456789 &&
#endif
	    [@"\r-INFINITY\n" doubleValue] == -INFINITY &&
	    isnan([@"   NAN\t\t" doubleValue]))

	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #1",
	    OFInvalidFormatException, [@"abc" decimalValue])
	EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #2",
	    OFInvalidFormatException, [@"0a" decimalValue])