#!/usr/local/bin/perl use strict; use warnings; $|++; use Test::More no_plan => 1; use_ok( 'ChessNot' ); my @tests = ( [ 'e4', "Pawn moves to (4, 5)" ], [ 'Pe4', "Pawn moves to (4, 5)" ], [ 'Be4', "Bishop moves to (4, 5)" ], [ 'Re4', "Rook moves to (4, 5)" ], [ 'Ne4', "Knight moves to (4, 5)" ], [ 'Qe4', "Queen moves to (4, 5)" ], [ 'Ke4', "King moves to (4, 5)" ], [ 'Nxe4', "Knight captures (4, 5)" ], [ 'dxe4', "Pawn (?, 4) captures (4, 5)" ], [ 'Ndxe4', "Knight (?, 4) captures (4, 5)" ], [ 'N5xe4', "Knight (5, ?) captures (4, 5)" ], [ 'Nf5xe4', "Knight (5, 6) captures (4, 5)" ], [ 'e4+', "Pawn moves to (4, 5), check" ], [ 'e4++', "Pawn moves to (4, 5), checkmate" ], [ 'dxe4++', "Pawn (?, 4) captures (4, 5), checkmate" ], ); foreach my $test (@tests) { my ($move, $expectation) = @$test; my $result = ChessNot::parse( $move ); ok( $result eq $expectation, "$move => $expectation ($result)" ); }