Skip to content

Commit 0af3f73

Browse files
authored
Update NumberHelperTest.php
1 parent cdf6b22 commit 0af3f73

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/system/Helpers/NumberHelperTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,45 @@ public function testTbFormat()
101101
public function testThousands()
102102
{
103103
$this->assertSame('123 thousand', number_to_amount('123,000', 0, 'en_US'));
104+
$this->assertSame('1 thousand', number_to_amount('1000', 0, 'en_US'));
105+
$this->assertSame('999 thousand', number_to_amount('999499', 0, 'en_US'));
106+
$this->assertSame('1,000 thousand', number_to_amount('999500', 0, 'en_US'));
107+
$this->assertSame('1,000 thousand', number_to_amount('999999', 0, 'en_US'));
104108
}
105109

106110
public function testMillions()
107111
{
108112
$this->assertSame('123.4 million', number_to_amount('123,400,000', 1, 'en_US'));
113+
$this->assertSame('1 million', number_to_amount('1,000,000', 1, 'en_US'));
114+
$this->assertSame('1.5 million', number_to_amount('1,499,999', 1, 'en_US'));
115+
$this->assertSame('1.5 million', number_to_amount('1,500,000', 1, 'en_US'));
116+
$this->assertSame('1.5 million', number_to_amount('1,549,999', 1, 'en_US'));
117+
$this->assertSame('1.6 million', number_to_amount('1,550,000', 1, 'en_US'));
118+
$this->assertSame('999.5 million', number_to_amount('999,500,000', 1, 'en_US'));
119+
$this->assertSame('1,000 million', number_to_amount('999,500,000', 0, 'en_US'));
120+
$this->assertSame('1,000 million', number_to_amount('999,999,999', 1, 'en_US'));
109121
}
110122

111123
public function testBillions()
112124
{
113125
$this->assertSame('123.46 billion', number_to_amount('123,456,000,000', 2, 'en_US'));
126+
$this->assertSame('1 billion', number_to_amount('1,000,000,000', 2, 'en_US'));
127+
$this->assertSame('1,000 billion', number_to_amount('999,999,999,999', 2, 'en_US'));
114128
}
115129

116130
public function testTrillions()
117131
{
118132
$this->assertSame('123.457 trillion', number_to_amount('123,456,700,000,000', 3, 'en_US'));
133+
$this->assertSame('1 trillion', number_to_amount('1,000,000,000,000', 3, 'en_US'));
134+
$this->assertSame('1,000 trillion', number_to_amount('999,999,999,999,999', 3, 'en_US'));
119135
}
120136

121137
public function testQuadrillions()
122138
{
123139
$this->assertSame('123.5 quadrillion', number_to_amount('123,456,700,000,000,000', 1, 'en_US'));
140+
$this->assertSame('1 quadrillion', number_to_amount('1,000,000,000,000,000', 0, 'en_US'));
141+
$this->assertSame('1,000 quadrillion', number_to_amount('999,999,999,999,999,999', 0, 'en_US'));
142+
$this->assertSame('1,000 quadrillion', number_to_amount('1,000,000,000,000,000,000', 0, 'en_US'));
124143
}
125144

126145
public function testCurrencyCurrentLocale()

0 commit comments

Comments
 (0)