Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

EndgameUtilsTest.cpp

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00002 /** @file EndgameUtilsTest.cpp
00003  */
00004 //---------------------------------------------------------------------------
00005 
00006 #include <boost/test/auto_unit_test.hpp>
00007 
00008 #include "EndgameUtils.hpp"
00009 #include "BitsetIterator.hpp"
00010 #include "BoardUtils.hpp"
00011 
00012 using namespace benzene;
00013 
00014 //---------------------------------------------------------------------------
00015 
00016 namespace {
00017 
00018 /** Ensure MovesToConsider() removes all rotations from consider set. */
00019 BOOST_AUTO_TEST_CASE(EndgameUtils_ConsiderRotations)
00020 {
00021     ICEngine ice;
00022     VCBuilderParam param;
00023     HexBoard brd(9, 9, ice, param);
00024     brd.GetPosition().PlayMove(BLACK, HEX_CELL_E5);
00025     brd.ComputeAll(WHITE);
00026     const bitset_t consider = EndgameUtils::MovesToConsider(brd, WHITE);
00027     for (BitsetIterator it(consider); it; ++it)
00028     {
00029         HexPoint rotated = BoardUtils::Rotate(brd.GetPosition().Const(), *it);
00030         BOOST_CHECK(!consider.test(rotated));
00031     }
00032 }
00033 
00034 }
00035 
00036 //---------------------------------------------------------------------------


6 Jan 2011 Doxygen 1.6.3