Esempio n. 1
0
    public void ShiftDownInvalidTest()
    {
        var index = new FastIndex(1, 'A');
        var board = new BitsBoard();

        board[index] = true;
        var shifted = board.Shift(HexNeighborDirection.Down);

        AssertNoIndicesSet(shifted);
    }
Esempio n. 2
0
    public void ShiftDownAcrossBoundaryTest()
    {
        var index    = FastIndex.FromByte(64);
        var expected = index[HexNeighborDirection.Down];
        var board    = new BitsBoard();

        board[index] = true;

        var shifted = board.Shift(HexNeighborDirection.Down);

        AssertOnlyIndexSet(shifted, expected);
    }
Esempio n. 3
0
    public void ShiftDownTest()
    {
        var index = new FastIndex(5, 'E');
        var board = new BitsBoard();

        board[index] = true;
        AssertOnlyIndexSet(board, index);

        var shifted = board.Shift(HexNeighborDirection.Down);

        AssertOnlyIndexSet(board, index);
        AssertOnlyIndexSet(shifted, new FastIndex(4, 'E'));
    }
Esempio n. 4
0
    public void ShiftComprehensivetest([ValueSource(typeof(PrecomputedMoveData), nameof(PrecomputedMoveData.AllDirections))] HexNeighborDirection direction)
    {
        for (byte b = 0; b < 85; b++)
        {
            FastIndex index    = FastIndex.FromByte(b);
            var       original = new BitsBoard();
            original[index] = true;

            var expected = index[direction];
            var shifted  = original.Shift(direction);
            if (expected.IsInBounds)
            {
                AssertOnlyIndexSet(shifted, expected);
            }
            else
            {
                AssertNoIndicesSet(shifted);
            }
        }
    }