static void TestMakeMove() { CQPosition pos; char sBoard[65]; pos.Initialize(); pos.MakeMove(CMove("F5")); assertStringEquals("---------------------------O*------***--------------------------", pos.GetSBoard(sBoard)); assertFalse(pos.BlackMove()); assertEquals(59, pos.NEmpty()); assertEquals(1, pos.NMover()); }
//! Test that WriteCompressed() followed by ReadCompressed() returns the same book void CBook::TestIO() { { // test book with no position CBook book(NULL, s_out); book.TestMyIO(); } { // test book with a pass position and a subposition from that CBook book(NULL, s_out); CQPosition pos; pos.Initialize("---------------------------**------**------------------O------O*", true); book.StoreRoot(pos.BitBoard(), CHeightInfoX(10, 4, false, pos.NEmpty()), 32, -300); pos.MakeMove(CMove(057)); pos.Pass(); book.StoreLeaf(pos.BitBoard(), CHeightInfoX(10, 4, false, pos.NEmpty()), 32); book.TestMyIO(); } { // test book with only one entry CBook book(NULL, s_out); CQPosition pos; pos.Initialize(); book.StoreLeaf(pos.BitBoard(), CHeightInfoX(10, 4, false, 60), 32); book.TestMyIO(); } { // test book with two entries in a tree CBook book(NULL, s_out); CQPosition pos; pos.Initialize(); book.StoreRoot(pos.BitBoard(), CHeightInfoX(10, 4, false, 60), 32, 16400); pos.MakeMove(CMove(045)); book.StoreLeaf(pos.BitBoard(), CHeightInfoX(10, 4, false, 59), -32); book.TestMyIO(); } }