Tests that ``Result``'s data properties are correctly set after initialisation completes.
(ok_small, routes, num_iterations, runtime)
| 14 | [([[1, 2], [3], [4]], 1, 1.5), ([[1, 2, 3, 4]], 100, 54.2)], |
| 15 | ) |
| 16 | def test_fields_are_correctly_set(ok_small, routes, num_iterations, runtime): |
| 17 | """ |
| 18 | Tests that ``Result``'s data properties are correctly set after |
| 19 | initialisation completes. |
| 20 | """ |
| 21 | sol = Solution(ok_small, routes) |
| 22 | res = Result(sol, Statistics(), num_iterations, runtime) |
| 23 | |
| 24 | assert_equal(res.is_feasible(), sol.is_feasible()) |
| 25 | assert_equal(res.num_iterations, num_iterations) |
| 26 | assert_allclose(res.runtime, runtime) |
| 27 | |
| 28 | if sol.is_feasible(): |
| 29 | assert_equal(res.cost(), CostEvaluator([0], 0, 0).cost(sol)) |
| 30 | else: |
| 31 | assert_equal(res.cost(), math.inf) |
| 32 | |
| 33 | |
| 34 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected