Escape-sprowe / test / mastertest / release2 / HexMasterTest2.java
HexMasterTest2.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.params.provider.Arguments.arguments;
import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.params.provider.Arguments;
import mastertest.BaseEscapeTestMaster;

/**
 * Description
 */
class HexMasterTest2 extends BaseEscapeTestMaster
{
    @BeforeAll
    static void classSetup()
    {
        configFile = "config/egc/R2Hex1.egc";
        currentTests = "Master Hex Game Test 1";
        initialPieceTestValue = 0;
        basicOneMoveTestValue = 4;
        harderOneMoveTestValue = 3;
        multiMoveTestValue = 3;
    }
    
    static Stream<Arguments> initialPiecesProvider()
    {
        return Stream.of(
            arguments(3, -4, HORSE, PLAYER1)
        );
            
    }
    
    static Stream<Arguments> basicOneMoveProvider()
    {
        return Stream.of(
            // valid moves
            arguments("Frog over one block", 3, -1, 4, 0, true),
            arguments("Frog over two blocks", 3, -1, 2, 2, true),
            arguments("Dog linear up", 2, -2, 6, -2, true),
            
            // invalid moves
            arguments("Dog not linear", 2, -2, 5, -3, false),
            arguments("Horse over block onto piece", -1, 4, -1, 2, false)
        );
    }
    
    static Stream<Arguments> harderOneMoveProvider()
    {
        return Stream.of(
            // no hard ones now
            arguments("Bird to exit", -2, 0, 1, 1, true)
        );
    }
    
    static Stream<Arguments> multiMoveProvider()
    {
        return Stream.of(
            arguments("win on one move", true, true,
                ml(2, -2, -1, 1)),
            arguments("attempt move after game over", false, false,
                ml(2, -2, -1, 1, 0, 2, 0, -1))
        );
    }
}