4 class ParseNumbersTest < Test::Unit::TestCase
6 def test_straight_parsing
7 strings = { 1 => 'one',
25 150 => 'one hundred and fifty',
29 999 => 'nine hundred and ninety nine',
30 1_000 => 'one thousand',
31 1_200 => 'twelve hundred',
32 1_200 => 'one thousand two hundred',
33 17_000 => 'seventeen thousand',
34 21_473 => 'twentyone-thousand-four-hundred-and-seventy-three',
35 74_002 => 'seventy four thousand and two',
36 99_999 => 'ninety nine thousand nine hundred ninety nine',
37 100_000 => '100 thousand',
38 250_000 => 'two hundred fifty thousand',
39 1_000_000 => 'one million',
40 1_250_007 => 'one million two hundred fifty thousand and seven',
41 1_000_000_000 => 'one billion',
42 1_000_000_001 => 'one billion and one' }
44 strings.keys.sort.each do |key|
45 assert_equal key, Numerizer.numerize(strings[key]).to_i