package comp1110.ass1;
import org.junit.jupiter.api.*;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.junit.jupiter.api.Assertions.assertEquals;
@Timeout(value = 1000, unit = MILLISECONDS)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class SolveTest {
private void test(Objective obj, String expected) {
WalkTheDog game = new WalkTheDog(obj);
String sol = game.solve();
assertEquals(expected, sol, “Expected ” + expected +
” to be the solution for objective ” + obj.getProblemNumber() +
” (‘” + obj.getInitialState() + “‘)” +
“, but got ” + sol + “.”);
}
@Test
public void testAll() {
for (int i = 0; i < Objective.getOBJECTIVES().length; i++) {
test(Objective.getObjective(i), sols[i]);
}
}
public static String[] sols = {
"20231210333203",
"02323010000133",
"32020110203023",
"32201210000123",
"23201210010003",
"01313010333203",
"32022110233303",
"02321100313013",
"23200200111032",
"03330110122220",
"32023010010021",
"33301210212001",
"03331210302001",
"03331210313000",
"33301311202101",
"30001311222133",
"00033010221233",
"33301210010003",
"23200200323330",
"33301311001002",
"32131210010021",
"33302011031322",
"33300110121120",
"33030211222130",
"11233010031332",
"30001311222133",
"00302211020333",
"33301311202100",
"33302211030220",
"33300110221203",
"02323010112123",
"03330110221231",
"33302011121301",
"13100200222331",
"02320011313013",
"33033010021200",
"23200200101130",
"32023010000123",
"23201100030231",
"20231210313033",
"00031311302022",
"20230110313003",
"00301311312102",
"30332110131201",
"03330110302022",
"00033010112113",
"20230200130311",
"32022110302003",
"23200200323330",
"23200200323330",
"32201311001002",
"23023010211132",
"13320200222130",
"02323010211133",
"20231100030233",
"20231311323102",
"01313010131232",
"00301311020133",
"00031311322230",
"33030200302022",
"20230110313003",
"21331311100030",
"32131210010003",
"33302211030200",
"31231210333203",
"21133010000132",
"20230200131231",
"11230200302013",
"20321210233303",
"01133010332321",
"32023010233303",
"21130200323123",
"33211311020130",
"02323010112100",
"32023010211123",
"20231311020300",
"32023010000103",
"01313010131233",
"00032011312133",
"33211311222330",
};
}