4 require 'helpers/validation_helper'
6 class TestPGN < Test::Unit::TestCase
7 include ValidationHelper
10 @game = Game.get(:chess)
11 @state = @game.state.new
13 @history = History.new(@state)
14 @writer = @game.game_writer.new
17 def test_pgn_black_wins
20 info = { :result => :black }
22 expected = <<-END_OF_PGN
27 assert_equal expected, @writer.write(info, @history)
30 def test_pgn_white_wins
32 info = { :result => :white,
33 :event => 'Oktoberfest',
34 :players => { :white => 'Doe, John',
35 :black => 'Smith, Bob' } }
37 expected = <<-END_OF_PGN
45 assert_equal expected, @writer.write(info, @history)
51 move = unpack_move(*args)
52 validate = @game.validator.new(@history.state)
54 state = @history.state.dup
56 @history.add_move(state, move)