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 corner cases #106

Merged
merged 2 commits into from
Jan 29, 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
7 changes: 6 additions & 1 deletion largest-series-product/series_product.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ is $module->new('0123456789')->largest_product(2), 72, "largest product of 2";
is $module->new('19')->largest_product(2), 9, "largest product of 2 on a tiny number";
is $module->new('1027839564')->largest_product(3), 270, "largest product of 3";
is $module->new('52677741234314237566414902593461595376319419139427')->largest_product(6), 28350, "largest product of 6";
is $module->new('')->largest_product(0), 1, "test identity";
is $module->new('0000')->largest_product(2), 0, "test string containing only zeroes";
is $module->new('99099')->largest_product(3), 0, "test string where all products are zero";
is $module->new('')->largest_product(0), 1, "test identity with empty string";
is $module->new('123')->largest_product(0), 1, "test identity with non-empty string";

throws_ok { $module->new('')->largest_product(1) } qr/ArgumentError/, "non-zero slice length with empty string throws exception";