MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / TestClass

Class TestClass

searches/test_tabu_search.py:25–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class TestClass(unittest.TestCase):
26 def test_generate_neighbours(self):
27 neighbours = generate_neighbours(TEST_FILE)
28
29 self.assertEqual(NEIGHBOURS_DICT, neighbours)
30
31 def test_generate_first_solutions(self):
32 first_solution, distance = generate_first_solution(TEST_FILE, NEIGHBOURS_DICT)
33
34 self.assertEqual(FIRST_SOLUTION, first_solution)
35 self.assertEqual(DISTANCE, distance)
36
37 def test_find_neighbours(self):
38 neighbour_of_solutions = find_neighborhood(FIRST_SOLUTION, NEIGHBOURS_DICT)
39
40 self.assertEqual(NEIGHBOURHOOD_OF_SOLUTIONS, neighbour_of_solutions)
41
42 def test_tabu_search(self):
43 best_sol, best_cost = tabu_search(FIRST_SOLUTION, DISTANCE, NEIGHBOURS_DICT, 4, 3)
44
45 self.assertEqual(['a', 'd', 'b', 'e', 'c', 'a'], best_sol)
46 self.assertEqual(87, best_cost)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected