gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumberFormatter tests fix


From: Fred Kiefer
Subject: Re: NSNumberFormatter tests fix
Date: Fri, 04 Mar 2011 10:27:55 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11

Now this is interesting. Why is this the case and how does this code
behave on MacOSX? If it is only on GNUstep that the order in which we
use two independent operations is important, then we should rather fix
our code and not our tests.

Am 04.03.2011 09:06, schrieb Philippe Roussel:
> One of the tests in basic.m (round up for fractional part >0.5) is
> failing only because of code ordering. The appended patch fixes it.
> 
> Philippe
> 
> Index: base/NSNumberFormatter/basic.m
> ===================================================================
> --- base/NSNumberFormatter/basic.m    (revision 32445)
> +++ base/NSNumberFormatter/basic.m    (working copy)
> @@ -15,16 +15,14 @@
>                   "+[NSNumberFormatter alloc] returns a NSNumberFormatter");
>  
>    fmt = [[[NSNumberFormatter alloc] init] autorelease];
> -  num = [[[NSNumber alloc] initWithFloat: 1234.567] autorelease];
>  
> -  str = [fmt stringForObjectValue: num];
> -
> -  PASS_EQUAL(str, @"1,234.57", "default format same as Cocoa");
> -
>    num = [[[NSNumber alloc] initWithFloat: 1.01] autorelease];
>    PASS_EQUAL([fmt stringFromNumber: num], @"1.01",
>      "Handle leading zeroes in fractional part: 1.01");
>  
> +  num = [[[NSNumber alloc] initWithFloat: 1234.567] autorelease];
> +  str = [fmt stringForObjectValue: num];
> +  PASS_EQUAL(str, @"1,234.57", "default format same as Cocoa");
>  
>    [fmt setAllowsFloats: NO];
>    PASS_EQUAL([fmt stringForObjectValue: num], @"1,235",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]