forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloorTest.java
More file actions
28 lines (24 loc) · 771 Bytes
/
FloorTest.java
File metadata and controls
28 lines (24 loc) · 771 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
package com.thealgorithms.maths;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class FloorTest {
@Test
public void testFloorWholeNumber() {
assertEquals(0, Floor.floor(0));
assertEquals(1, Floor.floor(1));
assertEquals(-1, Floor.floor(-1));
assertEquals(42, Floor.floor(42));
assertEquals(-42, Floor.floor(-42));
}
@Test
public void testFloorDoubleNumber() {
assertEquals(0, Floor.floor(0.1));
assertEquals(1, Floor.floor(1.9));
assertEquals(-2, Floor.floor(-1.1));
assertEquals(-43, Floor.floor(-42.7));
}
@Test
public void testFloorNegativeZero() {
assertEquals(-0.0, Floor.floor(-0.0));
}
}