Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package weblab;
- import game.*;
- import org.junit.*;
- import org.junit.rules.*;
- import static org.junit.Assert.assertEquals;
- public class UTest {
- // TIP: If WebLab kills your process after a minute, you can
- // try to reduce the number of tests being run by commenting
- // them out.
- private static final String LEVEL_SET = "Aymeric_Hard.sok";
- private static final boolean REQUIRE_OPT = false;
- private static final int SOLVER_TIMEOUT = 4000;
- private static IAgent getAgent() {
- return new Solution();
- }
- private static void testLevel(IAgent agent, int level) {
- boolean verbose = false;
- String agentId = null;
- agent.init(REQUIRE_OPT, verbose);
- SokobanResult result =
- Sokoban.simAgentLevel(agentId, LEVEL_SET, level, SOLVER_TIMEOUT, agent, verbose, REQUIRE_OPT);
- SokobanResultType resultType = result.getResult();
- assertEquals(SokobanResultType.VICTORY, resultType);
- }
- private long time = 0;
- @Rule
- public TestName name = new TestName();
- @Before
- public void setUp() {
- time = System.currentTimeMillis();
- }
- @After
- public void tearDown() {
- System.out.println("Test '" + name.getMethodName() + "' took " + (System.currentTimeMillis() - time) + "ms");
- }
- @Test(timeout = 4100)
- public void level1() {
- testLevel(getAgent(), 1);
- }
- @Test(timeout = 4100)
- public void level2() {
- testLevel(getAgent(), 2);
- }
- @Test(timeout = 4100)
- public void level3() {
- testLevel(getAgent(), 3);
- }
- @Test(timeout = 4100)
- public void level4() {
- testLevel(getAgent(), 4);
- }
- @Test(timeout = 4100)
- public void level5() {
- testLevel(getAgent(), 5);
- }
- @Test(timeout = 4100)
- public void level6() {
- testLevel(getAgent(), 6);
- }
- @Test(timeout = 4100)
- public void level7() {
- testLevel(getAgent(), 7);
- }
- @Test(timeout = 4100)
- public void level8() {
- testLevel(getAgent(), 8);
- }
- @Test(timeout = 4100)
- public void level9() {
- testLevel(getAgent(), 9);
- }
- @Test(timeout = 4100)
- public void level10() {
- testLevel(getAgent(), 10);
- }
- @Test(timeout = 4100)
- public void level11() {
- testLevel(getAgent(), 11);
- }
- @Test(timeout = 4100)
- public void level12() {
- testLevel(getAgent(), 12);
- }
- @Test(timeout = 4100)
- public void level13() {
- testLevel(getAgent(), 13);
- }
- @Test(timeout = 4100)
- public void level14() {
- testLevel(getAgent(), 14);
- }
- @Test(timeout = 4100)
- public void level15() {
- testLevel(getAgent(), 15);
- }
- @Test(timeout = 4100)
- public void level16() {
- testLevel(getAgent(), 16);
- }
- @Test(timeout = 4100)
- public void level17() {
- testLevel(getAgent(), 17);
- }
- @Test(timeout = 4100)
- public void level18() {
- testLevel(getAgent(), 18);
- }
- @Test(timeout = 4100)
- public void level19() {
- testLevel(getAgent(), 19);
- }
- @Test(timeout = 4100)
- public void level20() {
- testLevel(getAgent(), 20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement