mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 23:15:17 +08:00
Herons : Changed the signature of the function (#4686)
* Made changes to the code to correct the Logic of Armstrong Number * Resolved the issues * Trying to resolve the Linter error by changing Variable name * Changed Variable Names : trying to resolve Clang error * Chnged the signature of the function * Added the Function documentation * Added exception for parameters * Resolved with suggested changes * Resolved with Suggested changes * fix: use proper logic --------- Co-authored-by: vil02 <vil02@o2.pl>
This commit is contained in:

committed by
GitHub

parent
e87036d886
commit
9dae389faa
@ -7,21 +7,33 @@ public class HeronsFormulaTest {
|
||||
|
||||
@Test
|
||||
void test1() {
|
||||
Assertions.assertEquals(HeronsFormula.Herons(3, 4, 5), 6.0);
|
||||
Assertions.assertEquals(HeronsFormula.herons(3, 4, 5), 6.0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test2() {
|
||||
Assertions.assertEquals(HeronsFormula.Herons(24, 30, 18), 216.0);
|
||||
Assertions.assertEquals(HeronsFormula.herons(24, 30, 18), 216.0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test3() {
|
||||
Assertions.assertEquals(HeronsFormula.Herons(1, 1, 1), 0.4330127018922193);
|
||||
Assertions.assertEquals(HeronsFormula.herons(1, 1, 1), 0.4330127018922193);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test4() {
|
||||
Assertions.assertEquals(HeronsFormula.Herons(4, 5, 8), 8.181534085976786);
|
||||
Assertions.assertEquals(HeronsFormula.herons(4, 5, 8), 8.181534085976786);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalculateAreaWithInvalidInput() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(1, 2, 3); });
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(2, 1, 3); });
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(3, 2, 1); });
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(1, 3, 2); });
|
||||
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(1, 1, 0); });
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(1, 0, 1); });
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> { HeronsFormula.herons(0, 1, 1); });
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user