Skip to content

Commit

Permalink
feat: Test file added for kanns algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
RaviSadam committed Jul 5, 2024
1 parent fddebdd commit d12336c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Graphs/test/KannsAlgorithm.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { kannsAlgorithm } from "../KannsAlgorithm";

test('Test Case 1: Graph wihout cycle', () => {

Check failure on line 3 in Graphs/test/KannsAlgorithm.test.js

View workflow job for this annotation

GitHub Actions / Check for spelling errors

wihout ==> without
const graph = [[], [], [3], [1], [0, 1], [0, 2]];

expect(kannsAlgorithm(graph, 6)).toEqual([4, 5, 0, 2, 3, 1]);
});

test('Test Case 2: Graph with cycle', () => {

const graph = [[2], [], [3, 5], [0, 1], [0, 2]];

expect(kannsAlgorithm(graph, 6)).toEqual([]);
});

0 comments on commit d12336c

Please sign in to comment.