Refactor algorithm & add Junit test (fixes #2959) (#2960)

This commit is contained in:
leren1
2022-03-04 17:25:42 +01:00
committed by GitHub
parent cf07de8afa
commit 8bf74929e3
2 changed files with 57 additions and 30 deletions

View File

@ -0,0 +1,32 @@
package com.thealgorithms.maths;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import static com.thealgorithms.maths.Gaussian.gaussian;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class GaussianTest {
// easy pass test for the whole class. Matrix of 2*3.
@Test
void passTest1()
{
ArrayList<Double> list = new ArrayList<Double>();
ArrayList<Double> gaussian = new ArrayList<Double>();
ArrayList<Double> answer = new ArrayList<Double>();
answer.add(0.0);
answer.add(1.0);
int matrixSize = 2;
list.add(1.0);
list.add(1.0);
list.add(1.0);
list.add(2.0);
list.add(1.0);
list.add(1.0);
gaussian=gaussian(matrixSize,list);
assertEquals(answer,gaussian);
}
}