Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add the appropriate amount of trailing spaces to tests

  • Loading branch information...
commit 2f14892fe682221ef041dce936e6f9e5a648a648 1 parent 73abd33
@moritz authored
Showing with 8 additions and 2 deletions.
  1. +6 −1 lib/Nonogram.pm
  2. +2 −1  t/solving.t
View
7 lib/Nonogram.pm
@@ -131,7 +131,12 @@ class Nonogram {
method solve-shift {
for <right down> -> $direction {
- my @spec = $direction eq (any <left right>) ?? @!rowspec !! @!colspec;
+ my @spec = do given $direction {
+ when 'right' { @!rowspec }
+ when 'left' { @!rowspec.reverse }
+ when 'down' { @!colspec }
+ when 'up' { @!colspec.reverse }
+ }
for @spec.kv -> $idx, @chunks is copy {
next unless @chunks;
my $expect_next = '';
View
3  t/solving.t
@@ -14,7 +14,8 @@ my $n = Nonogram.new(
lives_ok { $n.solve() }, 'can run .solve';
# note: traling spaces here must be preserved!
-my $solved = q[
+my $solved =
+q[
??????
######
## ???
Please sign in to comment.
Something went wrong with that request. Please try again.