mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32448 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e94b16ae4e
commit
0d6ac39d8b
1 changed files with 5 additions and 5 deletions
|
@ -8,6 +8,7 @@ int main()
|
|||
|
||||
NSNumberFormatter *fmt;
|
||||
NSNumber *num;
|
||||
NSString *error;
|
||||
|
||||
[NSNumberFormatter
|
||||
setDefaultFormatterBehavior: NSNumberFormatterBehavior10_0];
|
||||
|
@ -27,12 +28,11 @@ int main()
|
|||
|
||||
[fmt setAllowsFloats: NO];
|
||||
num = [[[NSNumber alloc] initWithFloat: 1234.567] autorelease];
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @"1,235",
|
||||
"round up for fractional part >0.5")
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @"1,234.57",
|
||||
"-setAllowsFloats: does not effect rounding")
|
||||
|
||||
num = [[[NSNumber alloc] initWithFloat: 1234.432] autorelease];
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @"1,234",
|
||||
"round down for fractional part <0.5")
|
||||
PASS(NO == [fmt getObjectValue: &num forString: @"1234.567"
|
||||
errorDescription: 0], "float input is disallowed")
|
||||
|
||||
[fmt setFormat: @"__000000"];
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @" 001234",
|
||||
|
|
Loading…
Reference in a new issue