Ejemplo n.º 1
0
void SolverTest::StepDown()
{
    Board board;
    int blockId = board.AddBlockV(0,0,4);
    VisitedNode visitedNodes;
    Step step;
    auto res = step.Solve(1, board, visitedNodes);
    QCOMPARE((int)res.size(), 0);
    QCOMPARE((int)visitedNodes.Children().size(), 2);
    QCOMPARE((int)step.Children().size(), 2);
    QCOMPARE(step.Children()[0].MoveDesc(), MoveDescription(blockId, Direction::Down, 1));
    QCOMPARE(step.Children()[1].MoveDesc(), MoveDescription(blockId, Direction::Down, 2));
}
Ejemplo n.º 2
0
void SolverTest::vNodeAddV()
{
    VisitedNode root;
    Board board;
    board.AddBlockV(0,2,4);
    board.SetBlockF(3,4);
    QVERIFY2(!root.HadNodeBeforeCall(board), "0");
    QCOMPARE((int)root.Children().size(), 1);
    QCOMPARE((int)root.Children()[0].Children().size(), 1);
    QCOMPARE((int)root.Children()[0].Children()[0].Children().size(), 0);
    QCOMPARE(root.Children()[0].Position(), IntVector(0,2));
    QCOMPARE(root.Children()[0].Children()[0].Position(), IntVector(3,4));
}
Ejemplo n.º 3
0
void SolverTest::vNodeAddVTwoPos()
{
    VisitedNode root;
    Board board;
    int blockId = board.AddBlockV(0,1,2);
    board.SetBlockF(4,6);
    root.HadNodeBeforeCall(board);
    board.MoveDown(blockId, 1);
    QVERIFY2(!root.HadNodeBeforeCall(board), "0");
    QCOMPARE((int)root.Children().size(), 2);
    QCOMPARE((int)root.Children()[0].Children().size(), 1);
    QCOMPARE((int)root.Children()[1].Children().size(), 1);
    QCOMPARE((int)root.Children()[0].Children()[0].Children().size(), 0);
    QCOMPARE((int)root.Children()[1].Children()[0].Children().size(), 0);
    QCOMPARE(root.Children()[0].Position(), IntVector(0,1));
    QCOMPARE(root.Children()[1].Position(), IntVector(0,2));
    QCOMPARE(root.Children()[0].Children()[0].Position(), IntVector(4,6));
    QCOMPARE(root.Children()[1].Children()[0].Position(), IntVector(4,6));
}