#!perl #use Test::More tests => 1; use Test::More qw/no_plan/; BEGIN { chdir 't' if -d 't'; unshift @INC, '../lib'; use_ok( 'Number::FromWord', 'word_to_num' ); } can_ok __PACKAGE__, 'word_to_num'; my @words = ( 'three' => 3, 'fourteen' => 14, 'forty' => 40, 'forty-two' => 42, 'ninety nine' => 99, 'hundred' => 100, 'hundred and twenty' => 120, 'hundred and two' => 102, 'negative hundred and two' => -102, 'hundred ninety-nine' => 199, 'hundred nineteen' => 119, 'two hundred and three' => 203, 'twelve hundred and seventy three', => 1273, 'thousand' => 1000, 'seven hundred thirty-three thousand five hundred and twenty-nine', 733529, 'seventy three point two four five' => 73.245, 'three point seventeen' => 3.17, 'seven million' => 7000000, 'two hundred and ninety six million four hundred and twenty-two thousand five hundred and seventy eight', 296_422_578, 'two hundred and ninety six million four hundred and twenty-two thousand five hundred and seventy eight point three four seven', 296422578.347, ); while (@words) { my ( $word, $num ) = splice @words, 0, 2; is word_to_num($word), $num, "... $word should be $num"; }