VCUtilsTest.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005 #include <boost/test/auto_unit_test.hpp>
00006
00007 #include "VCUtils.hpp"
00008
00009 using namespace benzene;
00010
00011
00012
00013 namespace {
00014
00015 BOOST_AUTO_TEST_CASE(VCUtils_ValidEdgeBridge)
00016 {
00017 StoneBoard brd(4, 4);
00018 brd.StartNewGame();
00019
00020 HexPoint a1 = HEX_CELL_A1;
00021 HexPoint a2 = HEX_CELL_A2;
00022 HexPoint a3 = HEX_CELL_A3;
00023 HexPoint b1 = HEX_CELL_B1;
00024 HexPoint b2 = HEX_CELL_B2;
00025 HexPoint b3 = HEX_CELL_B3;
00026
00027 HexPoint e,p;
00028 bitset_t carrier;
00029 carrier.set(a1);
00030 carrier.set(a2);
00031
00032 BOOST_CHECK(VCUtils::ValidEdgeBridge(brd, carrier, p, e));
00033 BOOST_CHECK_EQUAL(e, WEST);
00034 BOOST_CHECK_EQUAL(p, b1);
00035
00036 carrier.reset();
00037 carrier.set(a1);
00038 carrier.set(b1);
00039 BOOST_CHECK(VCUtils::ValidEdgeBridge(brd, carrier, p, e));
00040 BOOST_CHECK_EQUAL(e, NORTH);
00041 BOOST_CHECK_EQUAL(p, a2);
00042
00043 carrier.reset();
00044 carrier.set(b1);
00045 carrier.set(b2);
00046 BOOST_CHECK(!VCUtils::ValidEdgeBridge(brd, carrier, p, e));
00047
00048 carrier.reset();
00049 carrier.set(a1);
00050 carrier.set(b3);
00051 BOOST_CHECK(!VCUtils::ValidEdgeBridge(brd, carrier, p, e));
00052
00053 brd.PlayMove(BLACK, a2);
00054 carrier.reset();
00055 carrier.set(a2);
00056 carrier.set(a3);
00057 BOOST_CHECK(!VCUtils::ValidEdgeBridge(brd, carrier, p, e));
00058 brd.UndoMove(a2);
00059 }
00060
00061 }
00062
00063