|
66 | 66 | end |
67 | 67 |
|
68 | 68 | end |
| 69 | + |
| 70 | + @testset "Simple Problem - Two way connections" begin |
| 71 | + problem = ShortestPathProblem( |
| 72 | + Connection[ |
| 73 | + Connection(1, 2, 4), #1 |
| 74 | + Connection(1, 3, 15), #2 |
| 75 | + |
| 76 | + # Two way connection |
| 77 | + Connection(2, 3, 2), #3 |
| 78 | + Connection(3, 2, 3), #4 |
| 79 | + |
| 80 | + Connection(2, 4, 15), #5 |
| 81 | + Connection(3, 4, 6), #6 |
| 82 | + ] |
| 83 | + ) |
| 84 | + |
| 85 | + # Shortest path: 1 -> 2 -> 3 -> 4 |
| 86 | + CorrectShortestPath = [ |
| 87 | + problem.connections[1], |
| 88 | + problem.connections[3], |
| 89 | + problem.connections[6]] |
| 90 | + |
| 91 | + result = solve(problem) |
| 92 | + |
| 93 | + @test result isa ShortestPathResult |
| 94 | + @test result.cost == 12.0 |
| 95 | + |
| 96 | + for element in result.path |
| 97 | + @test element in CorrectShortestPath |
| 98 | + end |
| 99 | + |
| 100 | + end |
69 | 101 | end |
0 commit comments