diff --git a/src/main/java/com/thealgorithms/maths/Ceil.java b/src/main/java/com/thealgorithms/maths/Ceil.java index 2263f9e6..08cc05cf 100644 --- a/src/main/java/com/thealgorithms/maths/Ceil.java +++ b/src/main/java/com/thealgorithms/maths/Ceil.java @@ -4,14 +4,6 @@ import java.util.Random; public class Ceil { - public static void main(String[] args) { - Random random = new Random(); - for (int i = 1; i <= 1000; ++i) { - double randomNumber = random.nextDouble(); - assert ceil(randomNumber) == Math.ceil(randomNumber); - } - } - /** * Returns the smallest (closest to negative infinity) * diff --git a/src/test/java/com/thealgorithms/maths/CeilTest.java b/src/test/java/com/thealgorithms/maths/CeilTest.java new file mode 100644 index 00000000..e57e23f1 --- /dev/null +++ b/src/test/java/com/thealgorithms/maths/CeilTest.java @@ -0,0 +1,17 @@ +package com.thealgorithms.maths; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +public class CeilTest { + + @Test + void testCeil() { + assertEquals(8, Ceil.ceil(7.057)); + assertEquals(8, Ceil.ceil(7.004)); + assertEquals(-13, Ceil.ceil(-13.004)); + assertEquals(1, Ceil.ceil(.98)); + assertEquals(-11, Ceil.ceil(-11.357)); + } +}