Skip to content

Commit 30dcc4c

Browse files
committed
Add additional edge cases to GCD unit tests
1 parent 4f293b3 commit 30dcc4c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/test/java/com/thealgorithms/maths/GCDTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,28 @@ void testArrayGcd2() {
5959
void testArrayGcdForEmptyInput() {
6060
Assertions.assertEquals(GCD.gcd(new int[] {}), 0);
6161
}
62+
63+
64+
65+
66+
@Test
67+
void testSameNumbers() {
68+
Assertions.assertEquals(GCD.gcd(7, 7), 7);
69+
}
70+
71+
@Test
72+
void testPrimeNumbers() {
73+
Assertions.assertEquals(GCD.gcd(13, 17), 1);
74+
}
75+
76+
@Test
77+
void testSingleElementArray() {
78+
Assertions.assertEquals(GCD.gcd(new int[] {42}), 42);
79+
}
80+
81+
@Test
82+
void testLargeNumbers() {
83+
Assertions.assertEquals(GCD.gcd(123456, 789012), 12);
84+
}
85+
6286
}

0 commit comments

Comments
 (0)