forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVolumeTest.java
More file actions
39 lines (26 loc) · 1020 Bytes
/
VolumeTest.java
File metadata and controls
39 lines (26 loc) · 1020 Bytes
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
38
39
package com.thealgorithms.maths;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class VolumeTest {
@Test
public void volume() {
/* test cube */
assertEquals(Volume.volumeCube(7), 343.0);
/* test cuboid */
assertEquals(Volume.volumeCuboid(2, 5, 7), 70.0);
/* test sphere */
assertEquals(Volume.volumeSphere(7), 1436.7550402417319);
/* test cylinder */
assertEquals(Volume.volumeCylinder(3, 7), 197.92033717615698);
/* test hemisphere */
assertEquals(Volume.volumeHemisphere(7), 718.3775201208659);
/* test cone */
assertEquals(Volume.volumeCone(3, 7), 65.97344572538566);
/* test prism */
assertEquals(Volume.volumePrism(10, 2), 20.0);
/* test pyramid */
assertEquals(Volume.volumePyramid(10, 3), 10.0);
/* test frustum */
assertEquals(Volume.volumeFrustumOfCone(3, 5, 7), 359.188760060433);
}
}