def test_simple_example(self): example = { 'Alice': ('0', '1', '2', '3'), 'Bob': ('1', '2'), 'Charlie': ('2', '3'), 'Denise': ('3', '0') } correct_result = { '0': ('Alice', 'Denise'), '1': ('Alice', 'Bob'), '2': ('Bob', 'Charlie'), '3': ('Charlie', 'Denise') } result = hw2.Solve(example) for slot in '0123': self.assertTrue(slot in result) self.assertEqual(correct_result[slot], tuple(sorted(result[slot])))
def test_nq_instance(self): self.CheckValidSolution(nq_instance, hw2.Solve(nq_instance))
def test_random7(self): availabilities = RandomInstance(10, 4.0, 4) self.CheckValidSolution(availabilities, hw2.Solve(availabilities))
def test_random11(self): availabilities = RandomInstance(30, 8.0, 8) self.CheckValidSolution(availabilities, hw2.Solve(availabilities))