1
0
mirror of https://github.com/tiyn/yeschess.git synced 2025-10-19 06:11:22 +02:00

tests: created tests dir

The tests where cluttering the src dir
so i moved them to a separate dir.
Same goes for the binaries so i changed the
outputdirectory for them and
added these to the new gitignore file
This commit is contained in:
TiynGER
2021-05-15 00:46:35 +02:00
parent 2d021366cb
commit c6ecdd4c83
4 changed files with 8 additions and 3 deletions

48
tests/engineTest.nim Normal file
View File

@@ -0,0 +1,48 @@
import einheit
include chess
include engine
testSuite ChessTest of TestSuite:
var
chess: Chess
method setup() =
self.chess = initChess()
method testPieceEvalStalemate() =
self.chess = initChess("8/8/2k5/8/8/5K2/8/8 b - - 0 1")
var pieceEvaluation = self.chess.evaluate()
self.check(pieceEvaluation == 0)
method testBestMoveProm() =
self.chess = initChess("8/2k1P3/8/8/8/5K2/8/8 w - - 0 1")
var testBestMove = self.chess.bestMove(2)
self.check(testBestMove.start != 0)
self.check(indToField(testBestMove.start) == "e7")
self.check(indToField(testBestMove.dest) == "e8")
method testBestMoveStopProm() =
self.chess = initChess("8/2k1P3/8/8/8/5K2/8/8 b - - 0 1")
var testBestMove = self.chess.bestMove(2)
self.check(testBestMove.start != 0)
self.check(indToField(testBestMove.start) == "c7")
self.check(indToField(testBestMove.dest) == "d7")
method testBestMoveTacticBlack() =
self.chess = initChess("8/2k3r1/8/6p1/5P2/8/4K1R1/8 b - - 0 1")
var testBestMove = self.chess.bestMove(2)
self.check(testBestMove.start != 0)
self.check(indToField(testBestMove.start) != "g5" or indToField(
testBestMove.dest) != "f4")
method testBestMoveTacticWhite() =
self.chess = initChess("8/2k3r1/8/5p2/6P1/8/4K1R1/8 w - - 0 1")
var testBestMove = self.chess.bestMove(2)
self.check(testBestMove.start != 0)
self.check(indToField(testBestMove.start) != "g4" or indToField(
testBestMove.dest) != "f5")
when isMainModule:
einheit.runTests()