JAVA-626 : Moved extra articles to java-math-2 module
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
package com.baeldung.algorithms.gcd;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class GCDImplementationUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenCalculatingGCDByBruteForceMethod_thenCorrect() {
|
||||
int n1 = 60;
|
||||
int n2 = 90;
|
||||
int gcd = GCDImplementation.gcdByBruteForce(n1, n2);
|
||||
assertThat(gcd).isEqualTo(30);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCalculatingGCDByEuclidsAlgorithm_thenCorrect() {
|
||||
int n1 = 60;
|
||||
int n2 = 90;
|
||||
int gcd = GCDImplementation.gcdByEuclidsAlgorithm(n1, n2);
|
||||
assertThat(gcd).isEqualTo(30);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCalculatingGCDBySteinsAlgorithm_thenCorrect() {
|
||||
int n1 = 60;
|
||||
int n2 = 90;
|
||||
int gcd = GCDImplementation.gcdBySteinsAlgorithm(n1, n2);
|
||||
assertThat(gcd).isEqualTo(30);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.baeldung.algorithms.logarithm;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class LogarithmUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenLog10_shouldReturnValidResults() {
|
||||
assertEquals(Math.log10(100), 2);
|
||||
assertEquals(Math.log10(1000), 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLogE_shouldReturnValidResults() {
|
||||
assertEquals(Math.log(Math.E), 1);
|
||||
assertEquals(Math.log(10), 2.30258, 0.00001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCustomLog_shouldReturnValidResults() {
|
||||
assertEquals(customLog(2, 256), 8);
|
||||
assertEquals(customLog(10, 100), 2);
|
||||
}
|
||||
|
||||
private static double customLog(double base, double logNumber) {
|
||||
return Math.log(logNumber) / Math.log(base);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user