202 lines
5.5 KiB
Plaintext
202 lines
5.5 KiB
Plaintext
#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
|
|
#
|
|
# a test for the getkey operator in the chess algebra
|
|
# run with : TestRunner -i chess_getkey.test
|
|
|
|
# clean up what may be left over from e.g. a segfault
|
|
|
|
#setup
|
|
create database chesstest;
|
|
open database chesstest;
|
|
|
|
let gamestype = [const rel(tuple([x: int])) value ((1))];
|
|
derive games = gamestype feed extendstream [Match: readpgn('test.pgn')] project[Match] consume;
|
|
|
|
#testcase getkeyTest_Event
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("37th Olympiad")\
|
|
("37th Olympiad")\
|
|
("37th Olympiad")\
|
|
("37th Olympiad")))
|
|
query games feed extend[Result: .Match getkey["Event"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_event
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("37th Olympiad")\
|
|
("37th Olympiad")\
|
|
("37th Olympiad")\
|
|
("37th Olympiad")))
|
|
query games feed extend[Result: .Match getkey["event"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_Site
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("Turin ITA")\
|
|
("Turin ITA")\
|
|
("Turin ITA")\
|
|
("Turin ITA")))
|
|
query games feed extend[Result: .Match getkey["Site"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_site
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("Turin ITA")\
|
|
("Turin ITA")\
|
|
("Turin ITA")\
|
|
("Turin ITA")))
|
|
query games feed extend[Result: .Match getkey["site"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_Date
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2006.05.30")\
|
|
("2006.06.02")\
|
|
("2006.06.03")\
|
|
("2006.06.04")))
|
|
query games feed extend[Result: .Match getkey["Date"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_date
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2006.05.30")\
|
|
("2006.06.02")\
|
|
("2006.06.03")\
|
|
("2006.06.04")))
|
|
query games feed extend[Result: .Match getkey["date"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_Round
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("9")\
|
|
("11")\
|
|
("12")\
|
|
("13")))
|
|
query games feed extend[Result: .Match getkey["Round"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_White
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("Mas,H")\
|
|
("Korchnoi,V")\
|
|
("Paragua,M")\
|
|
("Ghaem Maghami,E")))
|
|
query games feed extend[Result: .Match getkey["White"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_name_w
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("Mas,H")\
|
|
("Korchnoi,V")\
|
|
("Paragua,M")\
|
|
("Ghaem Maghami,E")))
|
|
query games feed extend[Result: .Match getkey["name_w"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_Black
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("Korchnoi,V")\
|
|
("Berg,E")\
|
|
("Korchnoi,V")\
|
|
("Korchnoi,V")))
|
|
query games feed extend[Result: .Match getkey["Black"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_name_b
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("Korchnoi,V")\
|
|
("Berg,E")\
|
|
("Korchnoi,V")\
|
|
("Korchnoi,V")))
|
|
query games feed extend[Result: .Match getkey["name_b"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_Result
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("1-0")\
|
|
("1-0")\
|
|
("0-1")\
|
|
("1/2-1/2")))
|
|
query games feed extend[Result: .Match getkey["Result"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_result
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("1-0")\
|
|
("1-0")\
|
|
("0-1")\
|
|
("1/2-1/2")))
|
|
query games feed extend[Result: .Match getkey["result"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_ECO
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("C68")\
|
|
("D02")\
|
|
("E12")\
|
|
("C54")))
|
|
query games feed extend[Result: .Match getkey["ECO"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_eco_code
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("C68")\
|
|
("D02")\
|
|
("E12")\
|
|
("C54")))
|
|
query games feed extend[Result: .Match getkey["eco_code"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_WhiteElo
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2412")\
|
|
("2607")\
|
|
("2617")\
|
|
("2584")))
|
|
query games feed extend[Result: .Match getkey["WhiteElo"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_BlackElo
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2607")\
|
|
("2539")\
|
|
("2607")\
|
|
("2607")))
|
|
query games feed extend[Result: .Match getkey["BlackElo"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_rating_w
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2412")\
|
|
("2607")\
|
|
("2617")\
|
|
("2584")))
|
|
query games feed extend[Result: .Match getkey["rating_w"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_rating_b
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2607")\
|
|
("2539")\
|
|
("2607")\
|
|
("2607")))
|
|
query games feed extend[Result: .Match getkey["rating_b"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_WhiteElo
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("2412")\
|
|
("2607")\
|
|
("2617")\
|
|
("2584")))
|
|
query games feed extend[Result: .Match getkey["WhiteElo"]] project[Result] consume;
|
|
|
|
#testcase getkeyTest_moves
|
|
#yields ((rel (tuple ((Result string))))\
|
|
(("41")\
|
|
("137")\
|
|
("120")\
|
|
("68")))
|
|
query games feed extend[Result: .Match getkey["moves"]] project[Result] consume;
|
|
|
|
#teardown
|
|
close database;
|
|
delete database chesstest; |