Skip to content

Commit

Permalink
Add test for optimizing when converging at the last iteration (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Nov 9, 2023
1 parent ca33e7c commit f83b969
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,20 @@ def test_intel_two_iterations(self):
self.assertFalse(result.converged)
print(result)

def test_intel_max_iterations(self):
"""Test for optimizing the Intel dataset."""
intel = os.path.join(os.path.dirname(__file__), "..", "data", "input_INTEL.g2o")

g = load_g2o(intel)
result = g.optimize()
self.assertTrue(result.converged)
self.assertEqual(result.num_iterations + 1, len(result.iteration_results))

g2 = load_g2o(intel)
result2 = g2.optimize(max_iter=result.num_iterations)
self.assertTrue(result2.converged)
self.assertEqual(result2.num_iterations, len(result2.iteration_results))

def test_parking_garage(self):
"""Test for optimizing the parking garage dataset."""
parking_garage = os.path.join(os.path.dirname(__file__), "..", "data", "parking-garage.g2o")
Expand Down

0 comments on commit f83b969

Please sign in to comment.