### ----------------------------------------------------
### -- FEN::Grammar
### -- Licenses: Artistic-2.0
### -- Authors: 
### -- File: t/00-parsing-fen.rakutest
### ----------------------------------------------------
use lib 'lib';
use Test;
use FEN::Grammar;
use FEN::Actions;
use FEN::Utils;

plan 5;

use-ok "FEN::Grammar";
use-ok "FEN::Actions";
use-ok "FEN::Utils";


my $fen = 'r1bk3r/p2pBpNp/n4n2/1p1NP2P/6P1/3P4/P1P1K3/q5b1';
my $actions = FEN::Actions.new;
my $match = FEN::Grammar.parse($fen, actions => $actions);
ok $match, "Successfully parsed FEN";

my $result = $match.made;
ok $result.ranks, "Successfully created ranks list";

say "\nASCII Matrix print \n";
FEN::Utils::to-matrix($result.ranks).map: *.say;
say "\nUnicoded matrix print \n";
FEN::Utils::to-unicoded-matrix($result.ranks).map: *.say;

say "\n----------------------------------\n";
$result.show-state;
say "----------------------------------";

say "\nPosition set:\n";
say $result.position-set;

done-testing;


