Skip to content

Commit 0c502fb

Browse files
authored
chore: Merge pull request TheAlgorithms#641 from leeyan44/leeyan44-patch-1
Added Volume.test.js file
2 parents ada2973 + 23714cb commit 0c502fb

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Maths/test/Volume.test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import * as volume from '../Volume'
2+
3+
test('Testing on volCuboid', () => {
4+
const volCuboid = volume.volCuboid(2.0, 5.0, 3)
5+
expect(volCuboid).toBe(30.0)
6+
})
7+
8+
test('Testing on volCube', () => {
9+
const volCube = volume.volCube(2.0)
10+
expect(volCube).toBe(8.0)
11+
})
12+
13+
test('Testing on volCone', () => {
14+
const volCone = volume.volCone(3.0, 8.0)
15+
expect(volCone).toBe(75.39822368615503)
16+
})
17+
18+
test('Testing on volPyramid', () => {
19+
const volPyramid = volume.volPyramid(2.0, 3.0, 8.0)
20+
expect(volPyramid).toBe(16.0)
21+
})
22+
23+
test('Testing on volCylinder', () => {
24+
const volCylinder = volume.volCylinder(3.0, 8.0)
25+
expect(volCylinder).toBe(226.1946710584651)
26+
})
27+
28+
test('Testing on volTriangularPrism', () => {
29+
const volTriangularPrism = volume.volTriangularPrism(3.0, 6.0, 8.0)
30+
expect(volTriangularPrism).toBe(72.0)
31+
})
32+
33+
test('Testing on volPentagonalPrism', () => {
34+
const volPentagonalPrism = volume.volPentagonalPrism(1.0, 4.0, 8.0)
35+
expect(volPentagonalPrism).toBe(80.0)
36+
})
37+
38+
test('Testing on volSphere', () => {
39+
const volSphere = volume.volSphere(4.0)
40+
expect(volSphere).toBe(268.082573106329)
41+
})
42+
43+
test('Testing on volHemisphere', () => {
44+
const volHemisphere = volume.volHemisphere(4.0)
45+
expect(volHemisphere).toBe(134.0412865531645)
46+
})

0 commit comments

Comments
 (0)