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

plan 2;
my $initial-fen = 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1';

my $actions = FEN::Actions.new;
my $match = FEN::Grammar.parse($initial-fen, actions => $actions);
ok $match, "Successfully parsed FEN";

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

say "\nMatrix print \n";
sink FEN::Utils::to-matrix($result.ranks).map: *.say;
say "\nUnicoded matrix print \n";
sink 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;


