Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

largest-series-product: Do not test slices #108

Merged
merged 1 commit into from
Mar 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions largest-series-product/series_product.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,15 @@ use Test::Exception;

my $module = $ENV{EXERCISM} ? 'Example' : 'Series';

plan tests => 13;
plan tests => 14;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is me noticing that I forgot to update that in #106 , so I had to make up for it.


ok -e "$module.pm", "Missing $module.pm" or BAIL_OUT "You need to create file: $module.pm";

eval "use $module";
ok !$@, "Cannot load $module" or BAIL_OUT "Cannot load $module. Does it compile? Does it end with 1;?";
can_ok $module, "new" or BAIL_OUT "Missing package $module, or missing sub new()";
can_ok $module, "slices" or BAIL_OUT "Missing package $module, or missing sub slices()";
can_ok $module, "largest_product" or BAIL_OUT "Missing package $module, or missing sub largest_product()";

is_deeply
$module->new('97867564')->slices(2),
[[9, 7], [7, 8], [8, 6], [6, 7], [7, 5], [5, 6], [6, 4]],
"test slices of two" or diag explain $module->new('97867564')->slices(2);

throws_ok { $module->new('012')->slices(4) } qr/ArgumentError/, "slice length longer than digits legth throws exception";
throws_ok { $module->new('012')->largest_product(4) } qr/ArgumentError/, "slice length longer than digits legth throws exception (largest_product)";

is $module->new('0123456789')->largest_product(2), 72, "largest product of 2";
Expand Down