FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/src/test/java/com/thealgorithms/maths/CeilTest.java at master · YanYan-Rf/Java · GitHub
YanYan-Rf
/
Java
Public
forked from
TheAlgorithms/Java
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
src
/
test
/
java
/
com
/
thealgorithms
/
maths
/
CeilTest.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 1.2 KB
Breadcrumbs
Java
/
src
/
test
/
java
/
com
/
thealgorithms
/
maths
/
CeilTest.java
Copy path
File metadata and controls
31 lines (24 loc) · 1.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
com
.
thealgorithms
.
maths
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
java
.
util
.
stream
.
Stream
;
import
org
.
junit
.
jupiter
.
params
.
ParameterizedTest
;
import
org
.
junit
.
jupiter
.
params
.
provider
.
CsvSource
;
import
org
.
junit
.
jupiter
.
params
.
provider
.
MethodSource
;
public
class
CeilTest
{
@
ParameterizedTest
@
CsvSource
({
"7.057, 8"
,
"7.004, 8"
,
"-13.004, -13"
,
"0.98, 1"
,
"-11.357, -11"
})
void
testCeil
(
double
input
,
int
expected
) {
assertEquals
(
expected
,
Ceil
.
ceil
(
input
));
}
@
ParameterizedTest
@
MethodSource
(
"edgeCaseProvider"
)
void
testEdgeCases
(
TestData
data
) {
assertEquals
(
Ceil
.
ceil
(
data
.
input
),
data
.
expected
);
}
record
TestData
(
double
input
,
double
expected
) {
}
static
Stream
<
TestData
>
edgeCaseProvider
() {
return
Stream
.
of
(
new
TestData
(
Double
.
MAX_VALUE
,
Double
.
MAX_VALUE
),
new
TestData
(
Double
.
MIN_VALUE
,
Math
.
ceil
(
Double
.
MIN_VALUE
)),
new
TestData
(
0.0
,
Math
.
ceil
(
0.0
)),
new
TestData
(-
0.0
,
Math
.
ceil
(-
0.0
)),
new
TestData
(
Double
.
NaN
,
Math
.
ceil
(
Double
.
NaN
)),
new
TestData
(
Double
.
NEGATIVE_INFINITY
,
Math
.
ceil
(
Double
.
NEGATIVE_INFINITY
)),
new
TestData
(
Double
.
POSITIVE_INFINITY
,
Math
.
ceil
(
Double
.
POSITIVE_INFINITY
)));
}
}
Back
|
FazBrowse Home
|
New Git URL