Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 21.3k
Expand file tree
/
Copy pathCeilTest.java
More file actions
Latest commit
31 lines (24 loc) · 1.2 KB
/
Copy pathCeilTest.java
File metadata and controls
31 lines (24 loc) · 1.2 KB
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
packagecom.thealgorithms.maths;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importjava.util.stream.Stream;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.CsvSource;
importorg.junit.jupiter.params.provider.MethodSource;
publicclassCeilTest {
@ParameterizedTest
@CsvSource({"7.057, 8", "7.004, 8", "-13.004, -13", "0.98, 1", "-11.357, -11"})
voidtestCeil(doubleinput, intexpected) {
assertEquals(expected, Ceil.ceil(input));
}
@ParameterizedTest
@MethodSource("edgeCaseProvider")
voidtestEdgeCases(TestDatadata) {
assertEquals(Ceil.ceil(data.input), data.expected);
}
recordTestData(doubleinput, doubleexpected) {
}
staticStream<TestData> edgeCaseProvider() {
returnStream.of(newTestData(Double.MAX_VALUE, Double.MAX_VALUE), newTestData(Double.MIN_VALUE, Math.ceil(Double.MIN_VALUE)), newTestData(0.0, Math.ceil(0.0)), newTestData(-0.0, Math.ceil(-0.0)), newTestData(Double.NaN, Math.ceil(Double.NaN)),
newTestData(Double.NEGATIVE_INFINITY, Math.ceil(Double.NEGATIVE_INFINITY)), newTestData(Double.POSITIVE_INFINITY, Math.ceil(Double.POSITIVE_INFINITY)));
}
}