75 lines
1.8 KiB
Plaintext
75 lines
1.8 KiB
Plaintext
#This file is part of SECONDO.
|
|
#
|
|
#Copyright (C) 2004-2007, University in Hagen, Faculty of Mathematics and Computer Science,
|
|
#Database Systems for New Applications.
|
|
#
|
|
#SECONDO is free software; you can redistribute it and/or modify
|
|
#it under the terms of the GNU General Public License as published by
|
|
#the Free Software Foundation; either version 2 of the License, or
|
|
#(at your option) any later version.
|
|
#
|
|
#SECONDO is distributed in the hope that it will be useful,
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
#GNU General Public License for more details.
|
|
#
|
|
#You should have received a copy of the GNU General Public License
|
|
#along with SECONDO; if not, write to the Free Software
|
|
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
|
|
|
|
# A test for the Chess Algebra
|
|
|
|
# clean up what may be left over from e.g. a segfault
|
|
delete database chesstest;
|
|
|
|
#setup chesstest ChessAlgebra
|
|
create database chesstest;
|
|
open database chesstest;
|
|
|
|
let allFiles = [ const rel(tuple([File: string]))
|
|
value (("a")("b")("c")("d")("e")("f")("g")("h")) ];
|
|
|
|
# define point constants for positions
|
|
let a1 = [ const point value (1 1) ];
|
|
let a8 = [ const point value (1 8) ];
|
|
let h1 = [ const point value (8 1) ];
|
|
let h8 = [ const point value (8 8) ];
|
|
|
|
let wjc2 = readpgn('wjc.pgn') namedtransformstream[Match] extend[No: seqnext()] consume;
|
|
|
|
#testcase chess1
|
|
#yields (int 359)
|
|
query wjc2 count;
|
|
|
|
#testcase 4rooks
|
|
#yields (int 7)
|
|
@query_4rooks;
|
|
|
|
#testcase castling
|
|
#yields (int 10)
|
|
@query_castling;
|
|
|
|
#testcase lostqueen
|
|
#yields (int 20)
|
|
@query_lostqueen;
|
|
|
|
#testcase samepos
|
|
#yields (int 5)
|
|
@query_samepos;
|
|
|
|
#testcase 4corners
|
|
#yields (int 4)
|
|
@query_4corners;
|
|
|
|
#testcase pawn promotions
|
|
#yields (int 8)
|
|
@query_pawnpro;
|
|
|
|
|
|
#teardown
|
|
close database;
|
|
delete database chesstest;
|
|
|