- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathStandardDeviationTest.java
37 lines (31 loc) · 946 Bytes
/
StandardDeviationTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
packagecom.thealgorithms.maths;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.api.Test;
publicclassStandardDeviationTest {
@Test
voidtest1() {
double[] t1 = newdouble[] {1, 1, 1, 1, 1};
Assertions.assertEquals(StandardDeviation.stdDev(t1), 0.0);
}
@Test
voidtest2() {
double[] t2 = newdouble[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Assertions.assertEquals(StandardDeviation.stdDev(t2), 2.8722813232690143);
}
@Test
voidtest3() {
double[] t3 = newdouble[] {1.1, 8.5, 20.3, 2.4, 6.2};
Assertions.assertEquals(StandardDeviation.stdDev(t3), 6.8308125431752265);
}
@Test
voidtest4() {
double[] t4 = newdouble[] {
3.14,
2.22222,
9.89898989,
100.00045,
56.7,
};
Assertions.assertEquals(StandardDeviation.stdDev(t4), 38.506117353865775);
}
}