Sha256: 381ebf50034554889d061310df989a15ca30f85ece457d804b6f28544afc07cf
Contents?: true
Size: 1.7 KB
Versions: 7
Compression:
Stored size: 1.7 KB
Contents
__END__ require 'test/unit' class ParseNumbersTest < Test::Unit::TestCase def test_parse strings = {1 => 'one', 5 => 'five', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 27 => 'twenty seven', 31 => 'thirty-one', 59 => 'fifty nine', 100 => 'a hundred', 100 => 'one hundred', 150 => 'one hundred and fifty', 150 => 'one fifty', 200 => 'two-hundred', 500 => '5 hundred', 999 => 'nine hundred and ninety nine', 1_000 => 'one thousand', 1_200 => 'twelve hundred', 1_200 => 'one thousand two hundred', 17_000 => 'seventeen thousand', 21_473 => 'twentyone-thousand-four-hundred-and-seventy-three', 74_002 => 'seventy four thousand and two', 99_999 => 'ninety nine thousand nine hundred ninety nine', 100_000 => '100 thousand', 250_000 => 'two hundred fifty thousand', 1_000_000 => 'one million', 1_250_007 => 'one million two hundred fifty thousand and seven', 1_000_000_000 => 'one billion', 1_000_000_001 => 'one billion and one'} strings.keys.sort.each do |key| assert_equal key, JW::NumberMagick.convert(strings[key]) end end end
Version data entries
7 entries across 7 versions & 1 rubygems