Escape-sprowe / test / mastertest / release2 / SquareMasterTest2.java
SquareMasterTest2.java
Raw
/*******************************************************************************
 * This files was developed for CS4533: Techniques of Programming Language Translation
 * and/or CS544: Compiler Construction
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Copyright ©2020-21 Gary F. Pollice
 *******************************************************************************/

package mastertest.release2;

import static escape.interfaces.EscapePiece.PieceName.*;
import static escape.enumerations.Player.*;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import java.util.stream.Stream;
import org.junit.jupiter.api.*;
import org.junit.jupiter.params.provider.Arguments;
import mastertest.BaseEscapeTestMaster;

/**
 * Description
 */
class SquareMasterTest2 extends BaseEscapeTestMaster
{
    @BeforeAll
    static void classSetup()
    {
        configFile = "config/egc/R2Square1.egc";
        currentTests = "Master Square Game Test 2";
        initialPieceTestValue = 0;
        basicOneMoveTestValue = 4;
        harderOneMoveTestValue = 3;
        multiMoveTestValue = 3;
    }
    
    // Taken care of in release 1
    static Stream<Arguments> initialPiecesProvider()
    {
        return Stream.of(
            arguments(5, 5, HORSE, PLAYER1)
        );
            
    }
    
    // Most taken care of in release 1 these are more complex and the valid moves
    // check the pieceis on the final destinagion
    static Stream<Arguments> basicOneMoveProvider()
    {
        return Stream.of(
            // valid moves
            arguments("Frog linear", 9, 5, 7, 7, true),
            arguments("Dog unblock", 11, 12, 11, 14, true),
            arguments("Snail takes dog", 9, 13, 10, 12, true),
            arguments("Bird flies over pieces and block", 11, 10, 11, 14, true),
            arguments("Horse chooses path without exit", 7, 6, 9, 11, true),
            
            // invalid moves
            arguments("Bird non-linear", 8, 7, 7, 10, false),
            arguments("Horse tries to take own piece", 5, 5, 5, 8, false),
            arguments("Dog tries to sit on block", 11, 13, 12, 12, false)
        );
    }
    
    static Stream<Arguments> harderOneMoveProvider()
    {
        return Stream.of(
            // valid moves
            arguments("Snail to exit", 8, 11, 8, 10, true),
            
            // invalid moves
            arguments("Frog tries to jump opponent", 11, 11, 9, 11, false)
        );
    }
    
    static Stream<Arguments> multiMoveProvider()
    {
        return Stream.of(
            arguments("Player 1 wins", true, true,
                ml(8, 11, 8, 10, 10, 10, 8, 10, 7, 6, 8, 10)),
            arguments("Try to move a player that was removed", false, false,
                ml(9, 13, 10, 12, 10, 12, 8, 12))
        );
    }
}