def testOneMoreThanGoal(self): state = game1.get_start_state() state.days['green'] = [[2, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0]] state.days['blue'] = [[0, 2, 0, 0], [0, 0, 0, 0], [2, 0, 0, 0], [0, 0, 0, 0], [2, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] self.assertEqual( len(pyhop.pyhop(state, [('sort_meds', game1.get_goal())])), 1)
def testModifyAdd(self): state = game1.get_start_state() game1.modify_state(state, 'green', 0, 0, 'add_pill', 1) self.assertEqual(state.days['green'][0][0], 1)
def testRemoveMoreThanCurrent(self): state = game1.get_start_state() game1.modify_state(state, 'green', 0, 0, 'add_pill', 1) with self.assertRaises(Exception): game1.modify_state(state, 'green', 0, 0, 'remove_pill', 2)
def testSameState(self): state = game1.get_start_state() game1.modify_state(state, 'green', 0, 0, 'add_pill', 1) game1.modify_state(state, 'green', 0, 0, 'remove_pill', 1) self.assertEqual( len(pyhop.pyhop(state, [('sort_meds', game1.get_goal())])), 13)
def testStart(self): state = game1.get_start_state() self.assertEqual( len(pyhop.pyhop(state, [('sort_meds', game1.get_goal())])), 13)
def testRemoveFromEmptySpot(self): state = game1.get_start_state() self.assertFalse(multi_pill_sort.remove_pill(state, 'green', 0, 0))