~ubuntu-branches/debian/sid/gnome-chess/sid

« back to all changes in this revision

Viewing changes to src/test-chess-game.vala

  • Committer: Package Import Robot
  • Author(s): Luca Falavigna, Jeremy Bicha, Jackson Doak, Luca Falavigna
  • Date: 2014-07-15 21:50:20 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140715215020-rhk7hmpjf5xlntb9
Tags: 1:3.12.3-1
* Team upload.

[ Jeremy Bicha ]
* debian/control.in:
  - Depend on hoichess and demote other chess engines to Suggests
    per upstream recommendation (LP: #138570)
  - Bump minimum intoltool and vala
  - Drop sqlite dependency
* debian/gnome-chess.install:
  - AI configuration file moved to /etc/chess-engines.conf

[ Jackson Doak ]
* New upstream release (3.12.3)

[ Luca Falavigna ]
* debian/control.in:
  - Bump Standards-Version to 3.9.5.
  - Refresh build-dependencies required minimum versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
2
 *
 
3
 * Copyright (C) 2010-2013 Robert Ancell
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify it under
 
6
 * the terms of the GNU General Public License as published by the Free Software
 
7
 * Foundation, either version 2 of the License, or (at your option) any later
 
8
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 
9
 * license.
 
10
 */
 
11
 
1
12
class GlChess
2
13
{
3
14
    static int test_count = 0;
37
48
        var move_result = state.get_result (out move_rule);
38
49
        if (move_result != result || move_rule != rule)
39
50
        {
40
 
            stderr.printf ("%d. FAIL %s + %s has result %d not %d\n", test_count, fen, move, move_result, result);
 
51
            stderr.printf ("%d. FAIL %s + %s has result %s not %s\n", test_count, fen, move, move_result.to_string (), result.to_string ());
41
52
            failure_count++;
42
53
            return;
43
54
        }
128
139
 
129
140
        /* Not checkmate (piece can be moved to intercept) */
130
141
        test_good_move ("k7/7r/8/8/8/8/1R6/1R6 w - - 0 1", "Ra1+",
131
 
                        "k7/7r/8/8/8/8/1R6/R7 b - - 1 1");
 
142
                        "k7/7r/8/8/8/8/1R6/R7 b - - 1 1", ChessResult.IN_PROGRESS);
132
143
 
133
144
        /* Stalemate */
134
145
        test_good_move ("k7/8/7R/8/8/8/8/1R6 w - - 0 1", "Rh7",
143
154
                        "k7/7K/8/8/8/8/8/7N b - - 0 1", ChessResult.DRAW, ChessRule.INSUFFICIENT_MATERIAL);
144
155
        /* Sufficient if a knight on each side */
145
156
        test_good_move("k7/7p/7K/8/8/8/8/6Nn w - - 0 1", "Kxh7",
146
 
                       "k7/7K/8/8/8/8/8/6Nn b - - 0 1");
 
157
                       "k7/7K/8/8/8/8/8/6Nn b - - 0 1", ChessResult.IN_PROGRESS);
147
158
        /* A bishop would suffice as well */
148
159
        test_good_move("k7/7p/7K/8/8/8/8/6Nb w - - 0 1", "Kxh7",
149
 
                       "k7/7K/8/8/8/8/8/6Nb b - - 0 1");
 
160
                       "k7/7K/8/8/8/8/8/6Nb b - - 0 1", ChessResult.IN_PROGRESS);
150
161
 
151
162
        /* Insufficient material - King and n same-color bishops vs. King and n same-color bishops */
152
163
        test_good_move("k2b1b1b/6bp/7K/4B1B1/8/8/8/8 w - - 0 1", "Kxh7",