icfp-model/src/test/java/ru/bosony/tests/TestGame.java
author indvdum (gotoindvdum[at]gmail[dot]com)
Sun, 15 Jul 2012 00:05:12 +0400
changeset 16 4e0d86c1c22a
child 18 735c03e46425
permissions -rw-r--r--
Testing the game
     1 package ru.bosony.tests;
     2 
     3 import static org.junit.Assert.*;
     4 
     5 import org.junit.Test;
     6 
     7 import ru.bosony.model.game.Game;
     8 import ru.bosony.model.game.GameState;
     9 import ru.bosony.model.mine.Mine;
    10 
    11 /**
    12  * @author 	indvdum (gotoindvdum[at]gmail[dot]com) <br>
    13  * 			14.07.2012 23:55:07
    14  *
    15  */
    16 public class TestGame {
    17 
    18 	@Test
    19 	public void testMapFromTask() {
    20 		/* Map from task (15x15)
    21 		 * 
    22 			###############
    23 			#***...R......#
    24 			#***... ...*..#
    25 			#\\\... ..\\\.#
    26 			#...... ...*..#
    27 			#..     .. ...#
    28 			#.... .... ...#
    29 			#.... .... ...#
    30 			#.. .       ..#
    31 			#..*. .. .....#
    32 			#.... .. .....#
    33 			#.\.. .......*#
    34 			#.............#
    35 			#.........   .#
    36 			#############L#
    37 
    38 		 */
    39 		String map = 
    40 				"###############\n" + 
    41 				"#***...R......#\n" + 
    42 				"#***... ...*..#\n" + 
    43 				"#\\\\\\... ..\\\\\\.#\n" + 
    44 				"#...... ...*..#\n" + 
    45 				"#..     .. ...#\n" + 
    46 				"#.... .... ...#\n" + 
    47 				"#.... .... ...#\n" + 
    48 				"#.. .       ..#\n" + 
    49 				"#..*. .. .....#\n" + 
    50 				"#.... .. .....#\n" + 
    51 				"#.\\.. .......*#\n" + 
    52 				"#.............#\n" + 
    53 				"#.........   .#\n" + 
    54 				"#############L#";
    55 		Mine mine = new Mine(map);
    56 		Game game = new Game(mine);
    57 		String route = "DDDLLLLLLURRRRRRRRRRRRDDDDDDDLLLLLLLLLLLDDDRRRRRRRRRRRD"; 
    58 		assertEquals(game.move(route), GameState.Win);
    59 	}
    60 
    61 }