Sha256: 94f99f369cfb076b798b8012df74cf755cdfcac62f23c31d03754e7c24b8c060
Contents?: true
Size: 642 Bytes
Versions: 3
Compression:
Stored size: 642 Bytes
Contents
require 'test_helper' class ChessTest < Minitest::Test TestHelper.pgns('checkmate').each do |file| name = File.basename(file, '.pgn') win = file.include?('white') ? 'white' : 'black' define_method :"test_#{win}_checkmate_#{name}" do pgn = Chess::Pgn.new(file) game = Chess::Game.new(pgn.moves) assert(game.board.checkmate?) if file.include?('white_won') assert_equal('1-0', game.result) assert_equal(:black, game.active_player) elsif file.include?('black_won') assert_equal('0-1', game.result) assert_equal(:white, game.active_player) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chess-0.4.0 | test/test_checkmate.rb |
chess-0.3.6 | test/test_checkmate.rb |
chess-0.3.5 | test/test_checkmate.rb |