Skip to content

Created VolumeTest.java & Fixed Bugs in Volume.java #3682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Created VolumeTest.java
Created VolumeTest.java JUnit Tests for Volume.java
  • Loading branch information
TaranjeetSinghKalsi authored Oct 26, 2022
commit 8255c23d7aaed25ea02f6b7822f4c49b6e4e19d9
35 changes: 35 additions & 0 deletions src/test/java/com/thealgorithms/maths/VolumeTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.thealgorithms.maths;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

public class VolumeTest {

@Test
public void volume() {

/* test cube */
assertTrue(Volume.volumeCube(7) == 343.0);

/* test cuboid */
assertTrue(Volume.volumeCuboid(2, 5, 7) == 70.0);

/* test sphere */
assertTrue(Volume.volumeSphere(7) == 1436.7550402417319);

/* test cylinder */
assertTrue(Volume.volumeCylinder(3, 7) == 197.92033717615698);

/* test hemisphere */
assertTrue(Volume.volumeHemisphere(7) == 718.3775201208659);

/* test cone */
assertTrue(Volume.volumeCone(3, 7) == 65.97344572538566);

/* test prism */
assertTrue(Volume.volumePrism(10, 2) == 20.0);

/* test pyramid */
assertTrue(Volume.volumePyramid(10, 3) == 10.0);
}
}