package game.patterns;

import game.pieces.Square;
import game.pieces.SquaresMatrix;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author givanse
 */
public class TSTest {
    
    @Test
    public void findPatternMatchRightHorizontalTest() {
        /**
         * 01234
         * 1 ##1
         * 2## 2
         * 3   3
         */
        SquaresMatrix squares = new SquaresMatrix(5, 4)
                .insertSquare(2, 1, Square.SquareColour.BLUE)
                .insertSquare(3, 1, Square.SquareColour.BLUE)
                .insertSquare(1, 2, Square.SquareColour.BLUE)
                .insertSquare(2, 2, Square.SquareColour.BLUE);
        /* pattern match a S */
        String message;
        int expecteds[][] = new int[0][0];
        int actuals[][];
        int x, y;
        for(x = 0; x < squares.getWidth(); x++) {
            y = 0;
            actuals = TetrominoType.S.isPatternFound(x, y, squares);
            message = "S (" + x + ", " + y + ")";
            assertArrayEquals(message, expecteds, actuals);
            y = 3;
            actuals = TetrominoType.S.isPatternFound(x, y, squares);
            message = "S (" + x + ", " + y + ")";
            assertArrayEquals(message, expecteds, actuals);
        }
        
        x = 0; y = 1;
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        x = 0; y = 2;
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        x = 1; y = 1;
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        
        x = 3; y = 2;
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        x = 4; y = 1;
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        x = 4; y = 2;
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        
        /**
         * 01234
         * 1 ##1
         * 2## 2
         * 3   3
         */
        x = 2; y = 1;
        expecteds = new int[][]{{2, 1}, {3, 1}, {2, 2}, {1, 2}};
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        
        x = 3; y = 1;
        expecteds = new int[][]{{3, 1}, {2, 1}, {2, 2}, {1, 2}};
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        
        x = 2; y = 2;
        expecteds = new int[][]{{2, 2}, {1, 2}, {2, 1}, {3, 1}};
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
        
        x = 1; y = 2;
        expecteds = new int[][]{{1, 2}, {2, 2}, {2, 1}, {3, 1}};
        actuals = TetrominoType.S.isPatternFound(x, y, squares);
        message = "S (" + x + ", " + y + ")";
        assertArrayEquals(message, expecteds, actuals);
    }
    
}
@@ -692,32 +692,8 @@
  */%0A
-        String message;%0A
     
@@ -916,58 +916,8 @@
 s);%0A
-            message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -938,33 +938,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1055,58 +1055,8 @@
 s);%0A
-            message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1077,33 +1077,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1212,54 +1212,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1230,33 +1230,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1346,54 +1346,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1364,33 +1364,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1480,54 +1480,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1498,33 +1498,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1623,54 +1623,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1641,33 +1641,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1757,54 +1757,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1775,33 +1775,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -1891,54 +1891,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -1909,33 +1909,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -2191,54 +2191,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -2209,33 +2209,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -2399,54 +2399,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -2417,33 +2417,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -2607,54 +2607,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -2625,33 +2625,24 @@
 ArrayEquals(
-message, 
 expecteds, a
@@ -2815,54 +2815,8 @@
 s);%0A
-        message = %22S (%22 + x + %22, %22 + y + %22)%22;%0A
     
@@ -2841,17 +2841,8 @@
 als(
-message, 
 expe

remove 'message'