Skip to content

Commit d12336c

Browse files
authored
feat: Test file added for kanns algorithm
1 parent fddebdd commit d12336c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: Graphs/test/KannsAlgorithm.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { kannsAlgorithm } from "../KannsAlgorithm";
2+
3+
test('Test Case 1: Graph wihout cycle', () => {
4+
const graph = [[], [], [3], [1], [0, 1], [0, 2]];
5+
6+
expect(kannsAlgorithm(graph, 6)).toEqual([4, 5, 0, 2, 3, 1]);
7+
});
8+
9+
test('Test Case 2: Graph with cycle', () => {
10+
11+
const graph = [[2], [], [3, 5], [0, 1], [0, 2]];
12+
13+
expect(kannsAlgorithm(graph, 6)).toEqual([]);
14+
});

0 commit comments

Comments
 (0)