2 /* Copyright © 2010 by Andrew Moore */
3 /* Licensing information appears at the end of this file. */
5 error_reporting(E_ALL
);
6 require_once 'PHPUnit/Framework.php';
7 require_once dirname(__FILE__
) . '/../library/classes/NumberToText.class.php';
9 class NumberToTextTest
extends PHPUnit_Framework_TestCase
13 * @dataProvider test_cases
15 public function testConvert( $numeral, $text )
17 $ntt = new NumberToText( $numeral );
18 $this->assertEquals( $text, $ntt->convert(), "'$numeral' converts to '$text'" );
21 public static function test_cases() {
23 return array( array( 0, 'zero'),
25 array( 14000, 'fourteen thousand'),
27 array( 99, 'ninety-nine'),
28 array( 100, 'one hundred'),
29 array( 1000, 'one thousand'),
30 array( 1111, 'one thousand one hundred eleven'),
36 This file is free software: you can redistribute it and/or modify it under the
37 terms of the GNU General Public License as publish by the Free Software
40 This file is distributed in the hope that it will be useful, but WITHOUT ANY
41 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
42 PARTICULAR PURPOSE. See the GNU Gneral Public License for more details.
44 You should have received a copy of the GNU General Public Licence along with
45 this file. If not see <http://www.gnu.org/licenses/>.