mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Updated to pass on OSX
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32449 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0d6ac39d8b
commit
80f133ce16
2 changed files with 9 additions and 3 deletions
|
@ -27,6 +27,7 @@ int main()
|
|||
"Handle leading zeroes in fractional part: 1.01")
|
||||
|
||||
[fmt setAllowsFloats: NO];
|
||||
|
||||
num = [[[NSNumber alloc] initWithFloat: 1234.567] autorelease];
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @"1,234.57",
|
||||
"-setAllowsFloats: does not effect rounding")
|
||||
|
@ -34,12 +35,17 @@ int main()
|
|||
PASS(NO == [fmt getObjectValue: &num forString: @"1234.567"
|
||||
errorDescription: 0], "float input is disallowed")
|
||||
|
||||
[fmt getObjectValue: &num forString: @"1234.567" errorDescription: &error];
|
||||
PASS_EQUAL(error, @"Floating Point not allowed", "allowsFloat error")
|
||||
|
||||
[fmt setFormat: @"__000000"];
|
||||
num = [[[NSNumber alloc] initWithFloat: 1234.432] autorelease];
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @" 001234",
|
||||
"numeric and space padding OK")
|
||||
|
||||
num = [[[NSNumber alloc] initWithFloat: 1234.56] autorelease];
|
||||
[fmt setAllowsFloats: YES];
|
||||
|
||||
num = [[[NSNumber alloc] initWithFloat: 1234.56] autorelease];
|
||||
[fmt setPositiveFormat: @"$####.##c"];
|
||||
[fmt setNegativeFormat: @"-$(####.##)"];
|
||||
PASS_EQUAL([fmt stringForObjectValue: num], @"$1234.56c",
|
||||
|
|
|
@ -105,7 +105,7 @@ int main()
|
|||
[fmt setPercentSymbol: @"##"];
|
||||
|
||||
[fmt setNumberStyle: NSNumberFormatterPercentStyle];
|
||||
PASS_EQUAL([fmt stringFromNumber: num], @"-123,443%",
|
||||
PASS_EQUAL([fmt stringFromNumber: num], @"_123,443##",
|
||||
"Negative percentage correct");
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ int main()
|
|||
[fmt setNumberStyle: NSNumberFormatterNoStyle];
|
||||
|
||||
testHopeful = YES;
|
||||
PASS_EQUAL([fmt stringFromNumber: num], @"-01235",
|
||||
PASS_EQUAL([fmt stringFromNumber: num], @"_01235",
|
||||
"format string of length 1")
|
||||
testHopeful = NO;
|
||||
|
||||
|
|
Loading…
Reference in a new issue