Skip to content

Commit 48bedf8

Browse files
author
Divyansh Saxena
committed
Refactor Cycles.java and add tests
1 parent 6faef1a commit 48bedf8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/java/com/thealgorithms/datastructures/graphs/CyclesTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,22 @@ void testSelfLoop() {
7373
assertEquals(1, cycles.get(0).size());
7474
assertEquals(0, cycles.get(0).get(0));
7575
}
76+
77+
@Test
78+
void testPrintAll() {
79+
int nodes = 3;
80+
int[][] matrix = {
81+
{ 0, 1, 1 },
82+
{ 1, 0, 1 },
83+
{ 1, 1, 0 }
84+
};
85+
Cycle c = new Cycle(nodes, matrix);
86+
c.start();
87+
c.printAll(); // Ensure no exception
88+
}
89+
90+
@Test
91+
void testMain() {
92+
Cycles.main(new String[] {});
93+
}
7694
}

0 commit comments

Comments
 (0)