package boxpusher.tests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import gdi.ws0809.test.SokobanTestAdapter;

import java.io.File;

import org.junit.BeforeClass;
import org.junit.Test;

public class ExtendedDeadlockTest {
	private static SokobanTestAdapter game = null;
	private static String levelDir = "data" + File.separator + "levelsets"
	+ File.separator + "Test Deadlocked" + File.separator;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		game = new SokobanTestAdapter();
		game.setLevelDir(new File(levelDir));
	}
	
	@Test
	public void testTwoBoxesAreInpossibleToMoveWithoutDeadlock() throws Exception {
		game.loadLevel(new File(levelDir + "level_06.txt"));
		assertTrue(game.isDeadlock());
	}
	
	@Test
	public void testTwoBoxesAreInpossibleToMoveWithoutDeadlock2() throws Exception {
		game.loadLevel(new File(levelDir + "level_07.txt"));
		assertTrue(game.isDeadlock());
	}

	@Test
	public void testBoxIsInAnUnsolvableTunnel() throws Exception {
		game.loadLevel(new File(levelDir + "level_10.txt"));
		assertTrue(game.isDeadlock());
	}
	
	@Test
	public void testBoxCanOnlyBeMovedInAnUnsolvableTunnel() throws Exception {
		game.loadLevel(new File(levelDir + "level_11.txt"));
		assertTrue(game.isDeadlock());
	}
	
	@Test
	public void testOneBoxDeadlockedButOnGoalAndOneCantMoveableOnGoal() throws Exception {
		game.loadLevel(new File(levelDir + "level_13.txt"));
		assertTrue(game.isDeadlock());
	}
}
