lx_chess_cr/spec/lx_chess/move_set_spec.cr

19 lines
541 B
Crystal
Raw Permalink Normal View History

2021-09-10 05:59:31 +02:00
require "../spec_helper"
require "../../src/lx_chess/board"
require "../../src/lx_chess/piece"
require "../../src/lx_chess/move_set"
describe LxChess::MoveSet do
describe "#add_vector" do
it "generates moves to the right" do
game = LxChess::Game.new
piece = LxChess::Piece.from_fen('R')
game.board["a1"] = piece
move_set = LxChess::MoveSet.new(piece, game.board)
move_set.add_vector(x: 1, y: 0, limit: 3)
move_set.moves.size.should eq(3)
move_set.moves.should eq([1, 2, 3])
end
end
end