Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8d4cb7be0f
Fetching contributors…

Cannot retrieve contributors at this time

file 37 lines (32 sloc) 0.633 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
use v6;
use Test;
plan *;

BEGIN { @*INC.push('lib') }

use Nonogram;

my $n = Nonogram.new(
    colspec => ([], [9], [9], [2, 2], [2, 2], [4], [4], []),
    rowspec => ([], [4], [6], [2, 2], [2, 2], [6], [4], [2], [2], [2], []),
);

lives_ok { $n.solve() }, 'can run .solve';

my $solved = q[
11111111|
12222111|
12222221|
12211221|
12211221|
12222221|
12222111|
12211111|
12211111|
12211111|
11111111|];
for $solved.trim.split("\n").kv -> $j, $line {
    my $i = 0;
    for $line.comb -> $c {
        if $c eq any <1 2> {
            is $n.field-rows[$j][$i], $c, "($j, $i) is '$c'";
        }
        $i++;
    }
}
done_testing;
Something went wrong with that request. Please try again.