diff options
author | xue <> | 2006-08-02 02:24:29 +0000 |
---|---|---|
committer | xue <> | 2006-08-02 02:24:29 +0000 |
commit | 550ba06593b467b643862d41a00ca2dd12ee704b (patch) | |
tree | 16ad8180c2f0b96454453effff89dc236469ee4f /tests/unit/I18N | |
parent | ccfa7850dc435ae9941cde18be827b3aac550f85 (diff) |
merge from 3.0 branch till 1320.
Diffstat (limited to 'tests/unit/I18N')
-rw-r--r-- | tests/unit/I18N/core/NumberFormatTest.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/unit/I18N/core/NumberFormatTest.php b/tests/unit/I18N/core/NumberFormatTest.php index af6a06ca..e136058e 100644 --- a/tests/unit/I18N/core/NumberFormatTest.php +++ b/tests/unit/I18N/core/NumberFormatTest.php @@ -12,6 +12,7 @@ class NumberFormatTest extends PHPUnit2_Framework_TestCase { $formatter = new NumberFormat(); $number = '123456789.125156'; $wanted = '123,456,789.125156'; + $this->assertEquals($wanted, $formatter->format($number)); //currency @@ -87,8 +88,7 @@ class NumberFormatTest extends PHPUnit2_Framework_TestCase { $pattern = '0000'; $wanted = '0005'; - //this should fail!!! - $this->assertNotEquals($wanted, $formatter->format($number, $pattern)); + $this->assertEquals($wanted, $formatter->format($number, $pattern)); } function testFormatWithANegativeValue() { @@ -105,7 +105,28 @@ class NumberFormatTest extends PHPUnit2_Framework_TestCase { $expected = "10E"; $this->assertEquals('10E', $formatter->format($number, 'e')); } + + function testRounding() + { + $formatter = new NumberFormat(); + + $number = 349.999; + $pattern = '#.00'; + $expected = '350.00'; + + $this->assertEquals($expected, $formatter->format($number, $pattern)); + } + function testRounding2() + { + $formatter = new NumberFormat(); + + $number = 349.99; + $pattern = '#.00'; + $expected = '349.99'; + + $this->assertEquals($expected, $formatter->format($number, $pattern)); + } } ?>
\ No newline at end of file |