package com.example.model.command;

import com.example.model.Board;
import com.example.model.Game;
import com.example.model.Point;
import junit.framework.TestCase;

/**
 * Created by zonoise on 2016/02/19.
 */
public class PutCommandTest extends TestCase {

    public void setUp() throws Exception {
        super.setUp();
    }


    /*
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 W B 0 0 0
0 0 0 B W 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
 */
    public Game put(int x,int y){
        Board board = new Board();
        board.init();
        Game game = new Game(board);
        game.run(new InitializeCommand());
        return game;
//        Point point = new Point(x,y);
//        PutCommand p = new PutCommand(point);
//        game.run(p);
//        //p.execute(game);
//        return game;
    }

    public void test1(){
        Game game = put(2,3);
        String after = game.getBoard().toDetailString();
        System.out.println(after);
        String expect =
        "0 0 0 0 0 0 0 0\n" +
        "0 0 0 0 0 0 0 0\n" +
        "0 0 0 0 0 0 0 0\n" +
        "0 0 0 W B 0 0 0\n" +
        "0 0 0 B W 0 0 0\n" +
        "0 0 0 0 0 0 0 0\n" +
        "0 0 0 0 0 0 0 0\n" +
        "0 0 0 0 0 0 0 0\n";
        assertEquals(expect,after);
    }

    public void test2(){
        int x = 2;
        int y = 3;
        Board board = new Board();
        board.init();
        Game game = new Game(board);
        game.run(new InitializeCommand());
        Point point = new Point(x,y);
        PutCommand p = new PutCommand(point);
        game.run(p);
        //p.execute(game);
        //return game;
    }
}

@@ -946,16 +946,18 @@
         
+//
 System.o
@@ -1015,32 +1015,33 @@
 %220 0 0 0 0 0 0 0
+ 
 %5Cn%22 +%0A        %220
@@ -1046,32 +1046,33 @@
 %220 0 0 0 0 0 0 0
+ 
 %5Cn%22 +%0A        %220
@@ -1077,32 +1077,33 @@
 %220 0 0 0 0 0 0 0
+ 
 %5Cn%22 +%0A        %220
@@ -1112,24 +1112,25 @@
  0 W B 0 0 0
+ 
 %5Cn%22 +%0A      
@@ -1143,24 +1143,25 @@
  0 B W 0 0 0
+ 
 %5Cn%22 +%0A      
@@ -1170,32 +1170,33 @@
 %220 0 0 0 0 0 0 0
+ 
 %5Cn%22 +%0A        %220
@@ -1209,16 +1209,17 @@
  0 0 0 0
+ 
 %5Cn%22 +%0A  
@@ -1240,16 +1240,17 @@
  0 0 0 0
+ 
 %5Cn%22;%0A   

modify text format