Files

410 lines
12 KiB
Plaintext
Raw Permalink Normal View History

2026-01-23 17:03:45 +08:00
# This file is part of SECONDO.
#
# Copyright (C) 2004, University in Hagen, Department of 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
#
# An example test spec for the Secondo TestRunner
# run it with :
#
# TestRunner -i example.test
#
# By default a temporary database directory will be created. If you
# want to use existing databases run
#
# TestRunner --no-tmp -i <file>
#
# If one of your tests (say number N ) reports an error you can run
# it directly by
#
# TestRunner -i <file> -num N
#
# this is useful for debugging
# A test specification consists of initial commands, a section of commands
# setting up the test, a sequence of test cases, and a section of commands
# cleaning up. The TestRunner uses directives to specify these sections.
# directives are specified in comment lines, all comment lines beginning with a
# directive are interpreted as commands to the TestRunner, non-comment lines are
# passed to Secondo. The possible directives are SETUP, TESTCASE, YIELDS and
# TEARDOWN (here i have written the directives in upper case to avoid confusion,
# the real directives must be written in lower case). The meanings of those
# directives are explained the following commented examples.
# before the SETUP directive one can place Secondo commands
# which may or may not suceed
delete database chesstest;
# the SETUP directive may specify the name of the test
# the SETUP directive must appear exactly once in a test spec
#setup exampletest
# if a command between the SETUP directive and the first
# TESTCASE directive fails, then the whole test has failed
# and we immediately skip to the teardown
# (the whole test does not make sense anymore if the
# SETUP has failed)
create database chesstest;
open database chesstest;
# the conventions for commands are the same as in SecondoTTYBDB
# make sure that commands are always terminated
# (either by a semicolon or by a newline)
let chess1 = [const chessgame value ((
("Event" "Test der Chessgame Klasse")
("Site" "...")
("Date" "2006.12.08")
("White" "Mirko D.")
("Black" "somebody else")
("WhiteElo" "100")
("BlackElo" "2500")
("EventDate" "2006.12.07"))
(
("Pawn" "none" "c" 2 "c" 4 FALSE "c4")
("pawn" "none" "c" 7 "c" 5 FALSE "c5")
("Pawn" "none" "d" 2 "d" 3 FALSE "d3")
("pawn" "none" "d" 7 "d" 6 FALSE "d6")
("Knight" "none" "b" 1 "c" 3 FALSE "Nc3")
("bishop" "none" "c" 8 "f" 5 FALSE "Bf5")
("Pawn" "none" "e" 2 "e" 4 FALSE "e4")
("bishop" "Pawn" "f" 5 "e" 4 FALSE "Bxe4")
("Knight" "bishop" "c" 3 "e" 4 FALSE "Nxe4")
("pawn" "none" "g" 7 "g" 6 FALSE "g6")
("Bishop" "none" "c" 1 "e" 3 FALSE "Be3")
("pawn" "none" "h" 7 "h" 5 FALSE "h5")
("Queen" "none" "d" 1 "d" 2 FALSE "Qd2")
("queen" "none" "d" 8 "d" 7 FALSE "Qd7")
("King" "none" "e" 1 "c" 1 FALSE "O-O-O")
("knight" "none" "b" 8 "a" 6 FALSE "Na6")
("Knight" "none" "g" 1 "h" 3 FALSE "Nh3")
("pawn" "none" "b" 7 "b" 6 FALSE "b6")
("Knight" "none" "e" 4 "g" 5 FALSE "Neg5")
("queen" "Knight" "d" 7 "h" 3 FALSE "Qxh3")
("Pawn" "queen" "g" 2 "h" 3 FALSE "gxh3")
("pawn" "none" "h" 5 "h" 4 FALSE "h4")
("Bishop" "pawn" "e" 3 "c" 5 FALSE "Bxc5")
("pawn" "none" "b" 6 "b" 5 FALSE "b5")
("Bishop" "pawn" "c" 5 "d" 6 FALSE "Bxd6")
("pawn" "none" "b" 5 "b" 4 FALSE "b4")
("Pawn" "none" "c" 4 "c" 5 FALSE "c5")
("pawn" "none" "b" 4 "b" 3 FALSE "b3")
("Pawn" "none" "c" 5 "c" 6 FALSE "c6")
("pawn" "none" "f" 7 "f" 6 FALSE "f6")
("Pawn" "none" "c" 6 "c" 7 FALSE "c7")
("pawn" "none" "f" 6 "f" 5 FALSE "f5")
("Pawn" "none" "c" 7 "c" 8 TRUE "c8=Q+")
))];
let chessrel1 = [const rel(tuple([name:string, game:chessgame ])) value(("hans"
((
("Event" "Test der Chessgame Klasse")
("Site" "...")
("Date" "2006.12.08")
("White" "Mirko D.")
("Black" "somebody else")
("WhiteElo" "100")
("BlackElo" "2500")
("EventDate" "2006.12.07"))
(
("Pawn" "none" "c" 2 "c" 4 FALSE "c4")
("pawn" "none" "c" 7 "c" 5 FALSE "c5")
("Pawn" "none" "d" 2 "d" 3 FALSE "d3")
("pawn" "none" "d" 7 "d" 6 FALSE "d6")
("Knight" "none" "b" 1 "c" 3 FALSE "Nc3")
("bishop" "none" "c" 8 "f" 5 FALSE "Bf5")
("Pawn" "none" "e" 2 "e" 4 FALSE "e4")
("bishop" "Pawn" "f" 5 "e" 4 FALSE "Bxe4")
("Knight" "bishop" "c" 3 "e" 4 FALSE "Nxe4")
("pawn" "none" "g" 7 "g" 6 FALSE "g6")
("Bishop" "none" "c" 1 "e" 3 FALSE "Be3")
("pawn" "none" "h" 7 "h" 5 FALSE "h5")
("Queen" "none" "d" 1 "d" 2 FALSE "Qd2")
("queen" "none" "d" 8 "d" 7 FALSE "Qd7")
("King" "none" "e" 1 "c" 1 FALSE "O-O-O")
("knight" "none" "b" 8 "a" 6 FALSE "Na6")
("Knight" "none" "g" 1 "h" 3 FALSE "Nh3")
("pawn" "none" "b" 7 "b" 6 FALSE "b6")
("Knight" "none" "e" 4 "g" 5 FALSE "Neg5")
("queen" "Knight" "d" 7 "h" 3 FALSE "Qxh3")
("Pawn" "queen" "g" 2 "h" 3 FALSE "gxh3")
("pawn" "none" "h" 5 "h" 4 FALSE "h4")
("Bishop" "pawn" "e" 3 "c" 5 FALSE "Bxc5")
("pawn" "none" "b" 6 "b" 5 FALSE "b5")
("Bishop" "pawn" "c" 5 "d" 6 FALSE "Bxd6")
("pawn" "none" "b" 5 "b" 4 FALSE "b4")
("Pawn" "none" "c" 4 "c" 5 FALSE "c5")
("pawn" "none" "b" 4 "b" 3 FALSE "b3")
("Pawn" "none" "c" 5 "c" 6 FALSE "c6")
("pawn" "none" "f" 7 "f" 6 FALSE "f6")
("Pawn" "none" "c" 6 "c" 7 FALSE "c7")
("pawn" "none" "f" 6 "f" 5 FALSE "f5")
("Pawn" "none" "c" 7 "c" 8 TRUE "c8=Q+")
))))];
let chessrel2 = [const rel(tuple([name:string, game:chessgame ])) value(("hans" ((
("Event" "Test der Chessgame Klasse")
("Site" "...")
("Date" "2006.12.08")
("White" "Mirko D.")
("Black" "somebody else")
("WhiteElo" "100")
("BlackElo" "2500")
("EventDate" "2006.12.07"))
(
("Pawn" "none" "c" 2 "c" 4 FALSE "c4")
("pawn" "none" "c" 7 "c" 5 FALSE "c5")
("Pawn" "none" "d" 2 "d" 3 FALSE "d3")
("pawn" "none" "d" 7 "d" 6 FALSE "d6")
("Knight" "none" "b" 1 "c" 3 FALSE "Nc3")
("bishop" "none" "c" 8 "f" 5 FALSE "Bf5")
("Pawn" "none" "e" 2 "e" 4 FALSE "e4")
("bishop" "Pawn" "f" 5 "e" 4 FALSE "Bxe4")
("Knight" "bishop" "c" 3 "e" 4 FALSE "Nxe4")
("pawn" "none" "g" 7 "g" 6 FALSE "g6")
("Bishop" "none" "c" 1 "e" 3 FALSE "Be3")
("pawn" "none" "h" 7 "h" 5 FALSE "h5")
("Queen" "none" "d" 1 "d" 2 FALSE "Qd2")
("queen" "none" "d" 8 "d" 7 FALSE "Qd7")
("King" "none" "e" 1 "c" 1 FALSE "O-O-O")
("knight" "none" "b" 8 "a" 6 FALSE "Na6")
("Knight" "none" "g" 1 "h" 3 FALSE "Nh3")
("pawn" "none" "b" 7 "b" 6 FALSE "b6")
("Knight" "none" "e" 4 "g" 5 FALSE "Neg5")
("queen" "Knight" "d" 7 "h" 3 FALSE "Qxh3")
("Pawn" "queen" "g" 2 "h" 3 FALSE "gxh3")
("pawn" "none" "h" 5 "h" 4 FALSE "h4")
("Bishop" "pawn" "e" 3 "c" 5 FALSE "Bxc5")
("pawn" "none" "b" 6 "b" 5 FALSE "b5")
("Bishop" "pawn" "c" 5 "d" 6 FALSE "Bxd6")
("pawn" "none" "b" 5 "b" 4 FALSE "b4")
("Pawn" "none" "c" 4 "c" 5 FALSE "c5")
("pawn" "none" "b" 4 "b" 3 FALSE "b3")
("Pawn" "none" "c" 5 "c" 6 FALSE "c6")
("pawn" "none" "f" 7 "f" 6 FALSE "f6")
("Pawn" "none" "c" 6 "c" 7 FALSE "c7")
("pawn" "none" "f" 6 "f" 5 FALSE "f5")
("Pawn" "none" "c" 7 "c" 8 TRUE "c8=Q+")
)))
("franz" ((
("Event" "Test der Chessgame Klasse")
("Site" "...")
("Date" "2006.12.08")
("White" "Mirko D.")
("Black" "somebody else")
("WhiteElo" "100")
("BlackElo" "2500")
("EventDate" "2006.12.07"))
(
("Pawn" "none" "c" 2 "c" 4 FALSE "c4")
("pawn" "none" "c" 7 "c" 5 FALSE "c5")
("Pawn" "none" "d" 2 "d" 3 FALSE "d3")
("pawn" "none" "d" 7 "d" 6 FALSE "d6")
("Knight" "none" "b" 1 "c" 3 FALSE "Nc3")
("bishop" "none" "c" 8 "f" 5 FALSE "Bf5")
("Pawn" "none" "e" 2 "e" 4 FALSE "e4")
("bishop" "Pawn" "f" 5 "e" 4 FALSE "Bxe4")
("Knight" "bishop" "c" 3 "e" 4 FALSE "Nxe4")
("pawn" "none" "g" 7 "g" 6 FALSE "g6")
("Bishop" "none" "c" 1 "e" 3 FALSE "Be3")
("pawn" "none" "h" 7 "h" 5 FALSE "h5")
("Queen" "none" "d" 1 "d" 2 FALSE "Qd2")
("queen" "none" "d" 8 "d" 7 FALSE "Qd7")
("King" "none" "e" 1 "c" 1 FALSE "O-O-O")
("knight" "none" "b" 8 "a" 6 FALSE "Na6")
("Knight" "none" "g" 1 "h" 3 FALSE "Nh3")
("pawn" "none" "b" 7 "b" 6 FALSE "b6")
("Knight" "none" "e" 4 "g" 5 FALSE "Neg5")
("queen" "Knight" "d" 7 "h" 3 FALSE "Qxh3")
("Pawn" "queen" "g" 2 "h" 3 FALSE "gxh3")
("pawn" "none" "h" 5 "h" 4 FALSE "h4")
("Bishop" "pawn" "e" 3 "c" 5 FALSE "Bxc5")
("pawn" "none" "b" 6 "b" 5 FALSE "b5")
("Bishop" "pawn" "c" 5 "d" 6 FALSE "Bxd6")
("pawn" "none" "b" 5 "b" 4 FALSE "b4")
("Pawn" "none" "c" 4 "c" 5 FALSE "c5")
("pawn" "none" "b" 4 "b" 3 FALSE "b3")
("Pawn" "none" "c" 5 "c" 6 FALSE "c6")
("pawn" "none" "f" 7 "f" 6 FALSE "f6")
("Pawn" "none" "c" 6 "c" 7 FALSE "c7")
("pawn" "none" "f" 6 "f" 5 FALSE "f5")
("Pawn" "none" "c" 7 "c" 8 TRUE "c8=Q+")
)
)
))];
let chessrel3 = [const rel(tuple([name:string, game:chessgame, game2:chessgame ])) value(("hans" ((
("Event" "Test der Chessgame Klasse")
("Site" "...")
("Date" "2006.12.08")
("White" "Mirko D.")
("Black" "somebody else")
("WhiteElo" "100")
("BlackElo" "2500")
("EventDate" "2006.12.07"))
(
("Pawn" "none" "c" 2 "c" 4 FALSE "c4")
("pawn" "none" "c" 7 "c" 5 FALSE "c5")
("Pawn" "none" "d" 2 "d" 3 FALSE "d3")
("pawn" "none" "d" 7 "d" 6 FALSE "d6")
("Knight" "none" "b" 1 "c" 3 FALSE "Nc3")
("bishop" "none" "c" 8 "f" 5 FALSE "Bf5")
("Pawn" "none" "e" 2 "e" 4 FALSE "e4")
("bishop" "Pawn" "f" 5 "e" 4 FALSE "Bxe4")
("Knight" "bishop" "c" 3 "e" 4 FALSE "Nxe4")
("pawn" "none" "g" 7 "g" 6 FALSE "g6")
("Bishop" "none" "c" 1 "e" 3 FALSE "Be3")
("pawn" "none" "h" 7 "h" 5 FALSE "h5")
("Queen" "none" "d" 1 "d" 2 FALSE "Qd2")
("queen" "none" "d" 8 "d" 7 FALSE "Qd7")
("King" "none" "e" 1 "c" 1 FALSE "O-O-O")
("knight" "none" "b" 8 "a" 6 FALSE "Na6")
("Knight" "none" "g" 1 "h" 3 FALSE "Nh3")
("pawn" "none" "b" 7 "b" 6 FALSE "b6")
("Knight" "none" "e" 4 "g" 5 FALSE "Neg5")
("queen" "Knight" "d" 7 "h" 3 FALSE "Qxh3")
("Pawn" "queen" "g" 2 "h" 3 FALSE "gxh3")
("pawn" "none" "h" 5 "h" 4 FALSE "h4")
("Bishop" "pawn" "e" 3 "c" 5 FALSE "Bxc5")
("pawn" "none" "b" 6 "b" 5 FALSE "b5")
("Bishop" "pawn" "c" 5 "d" 6 FALSE "Bxd6")
("pawn" "none" "b" 5 "b" 4 FALSE "b4")
("Pawn" "none" "c" 4 "c" 5 FALSE "c5")
("pawn" "none" "b" 4 "b" 3 FALSE "b3")
("Pawn" "none" "c" 5 "c" 6 FALSE "c6")
("pawn" "none" "f" 7 "f" 6 FALSE "f6")
("Pawn" "none" "c" 6 "c" 7 FALSE "c7")
("pawn" "none" "f" 6 "f" 5 FALSE "f5")
("Pawn" "none" "c" 7 "c" 8 TRUE "c8=Q+")
))
((
("Event" "Test der Chessgame Klasse")
("Site" "...")
("Date" "2006.12.08")
("White" "Mirko D.")
("Black" "somebody else")
("WhiteElo" "100")
("BlackElo" "2500")
("EventDate" "2006.12.07"))
(
("Pawn" "none" "c" 2 "c" 4 FALSE "c4")
("pawn" "none" "c" 7 "c" 5 FALSE "c5")
("Pawn" "none" "d" 2 "d" 3 FALSE "d3")
("pawn" "none" "d" 7 "d" 6 FALSE "d6")
("Knight" "none" "b" 1 "c" 3 FALSE "Nc3")
("bishop" "none" "c" 8 "f" 5 FALSE "Bf5")
("Pawn" "none" "e" 2 "e" 4 FALSE "e4")
("bishop" "Pawn" "f" 5 "e" 4 FALSE "Bxe4")
("Knight" "bishop" "c" 3 "e" 4 FALSE "Nxe4")
("pawn" "none" "g" 7 "g" 6 FALSE "g6")
("Bishop" "none" "c" 1 "e" 3 FALSE "Be3")
("pawn" "none" "h" 7 "h" 5 FALSE "h5")
("Queen" "none" "d" 1 "d" 2 FALSE "Qd2")
("queen" "none" "d" 8 "d" 7 FALSE "Qd7")
("King" "none" "e" 1 "c" 1 FALSE "O-O-O")
("knight" "none" "b" 8 "a" 6 FALSE "Na6")
("Knight" "none" "g" 1 "h" 3 FALSE "Nh3")
("pawn" "none" "b" 7 "b" 6 FALSE "b6")
("Knight" "none" "e" 4 "g" 5 FALSE "Neg5")
("queen" "Knight" "d" 7 "h" 3 FALSE "Qxh3")
("Pawn" "queen" "g" 2 "h" 3 FALSE "gxh3")
("pawn" "none" "h" 5 "h" 4 FALSE "h4")
("Bishop" "pawn" "e" 3 "c" 5 FALSE "Bxc5")
("pawn" "none" "b" 6 "b" 5 FALSE "b5")
("Bishop" "pawn" "c" 5 "d" 6 FALSE "Bxd6")
("pawn" "none" "b" 5 "b" 4 FALSE "b4")
("Pawn" "none" "c" 4 "c" 5 FALSE "c5")
("pawn" "none" "b" 4 "b" 3 FALSE "b3")
("Pawn" "none" "c" 5 "c" 6 FALSE "c6")
("pawn" "none" "f" 7 "f" 6 FALSE "f6")
("Pawn" "none" "c" 6 "c" 7 FALSE "c7")
("pawn" "none" "f" 6 "f" 5 FALSE "f5")
("Pawn" "none" "c" 7 "c" 8 TRUE "c8=Q+")
))))];
# a TESTCASE consists of a TESTCASE declarative followed
# by a YIELDS declarative followed by a command.
# multiple or no commands after a YIELD directive
# will confuse the TestRunner
# the expected output specified by the YIELD declarative
# is converted to a ListExpr and the TestRunner compares
# it to Secondo's actual output by calling
# NestedList->Equal
# An unspecified yields definition will result in an error
# for example a result specified as "yields 3.184" will do so.
# the TEARDOWN directive is followed by commands which
# should be executed after the execution of all TESTCASES
#teardown
close database;