use Test; BEGIN { plan tests => 5; } use Book::Factorial; ok 1; # module loaded OK my $input = 4; my $correct_result = 24; # the good machine: 4! = 24 my $result = 0; my $s = 1; # testing iterative c version $result = Book::Factorial::factorial_iterative_c($input); ok $result == $correct_result; # testing recursive c version $result = Book::Factorial::factorial_recursive_c($input); ok $result == $correct_result; # testing iterative perl version $result = Book::Factorial::factorial_iterative_perl($input); ok $result == $correct_result; # testing recursive perl version $result = Book::Factorial::factorial_recursive_perl($input); ok $result == $correct_result;