Skip to content

Commit

Permalink
[graph] test case refined
Browse files Browse the repository at this point in the history
  • Loading branch information
zrwusa committed Nov 4, 2023
1 parent a85ea70 commit 3596ca5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/unit/data-structures/graph/undirected-graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,16 @@ describe('UndirectedGraph', () => {
const allPaths = graph.getAllPathsBetween('Intersection_1','Intersection_5');
expect(allPaths.length).toBe(1000);
const minWeightedPathDFS = graph.getMinPathBetween('Intersection_1','Intersection_5', true, true);
expect(minWeightedPathDFS?.[0]?.key).toBe('Intersection_1');
expect(minWeightedPathDFS?.[5]?.key).toBe('Intersection_42');
expect(minWeightedPathDFS?.[8]?.key).toBe('Intersection_18');
expect(minWeightedPathDFS?.[27]?.key).toBe('Intersection_6');
const minWeightedPath = graph.dijkstra('Intersection_1','Intersection_5', true, true);
expect(minWeightedPathDFS?.[0].key).toBe('Intersection_1');
expect(minWeightedPathDFS?.[5].key).toBe('Intersection_42');
expect(minWeightedPathDFS?.[8].key).toBe('Intersection_18');
expect(minWeightedPathDFS?.[31].key).toBe('Intersection_5');
expect(minWeightedPath?.minPath?.[0].key).toBe('Intersection_1')
expect(minWeightedPath?.minPath?.[1].key).toBe('Intersection_2')
expect(minWeightedPath?.minPath?.[2].key).toBe('Intersection_3')
expect(minWeightedPath?.minPath?.[3].key).toBe('Intersection_4')
expect(minWeightedPath?.minPath?.[4].key).toBe('Intersection_5')

expect(minWeightedPath?.minPath?.[0]?.key).toBe('Intersection_1')
expect(minWeightedPath?.minPath?.[1]?.key).toBe('Intersection_2')
expect(minWeightedPath?.minPath?.[2]?.key).toBe('Intersection_3')
expect(minWeightedPath?.minPath?.[3]?.key).toBe('Intersection_4')
expect(minWeightedPath?.minPath?.[4]?.key).toBe('Intersection_5')
});
});

0 comments on commit 3596ca5

Please sign in to comment.