Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Simulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pg-andi
Simulator
Commits
84ccc3bd
There was an error fetching the commit references. Please try again later.
Commit
84ccc3bd
authored
7 years ago
by
Melanie Bruns
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for getMinimum
parent
0b176db5
No related branches found
No related tags found
1 merge request
!160
Add minimum used memory across all hosts to plot
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/ReportTest.java
+19
-0
19 additions, 0 deletions
src/test/ReportTest.java
with
19 additions
and
0 deletions
src/test/ReportTest.java
+
19
−
0
View file @
84ccc3bd
...
...
@@ -25,6 +25,7 @@ import static org.junit.Assert.*;
public
class
ReportTest
{
private
static
final
String
WRONG_MAXIMUM
=
"The maximum was computed or formatted incorrectly."
;
private
static
final
String
WRONG_MINIMUM
=
"The minimum was computed or formatted incorrectly."
;
private
File
outputFile
;
private
Report
report
;
...
...
@@ -73,6 +74,24 @@ public class ReportTest {
assertEquals
(
WRONG_MAXIMUM
,
"100.3000"
,
report
.
getMaximum
(
valuesWithMaxTwice
));
}
@Test
public
void
testGetMinimumReturnsNaNForEmptyList
(){
List
<
Double
>
values
=
new
ArrayList
<>();
assertEquals
(
"For empty lists, NaN should be returned"
,
"NaN"
,
report
.
getMinimum
(
values
));
}
@Test
public
void
testGetMinimumReturnsMinimum
(){
final
List
<
Double
>
values
=
Arrays
.
asList
(
3.0
,
-
1.2
,
100.0
,
100.3
,
0.07
);
assertEquals
(
WRONG_MINIMUM
,
"-1.2000"
,
report
.
getMinimum
(
values
));
final
List
<
Double
>
valuesWithNegativeMin
=
Arrays
.
asList
(-
3.0
,
-
1.2
,
-
100.0
,
-
100.3
,
-
0.07
);
assertEquals
(
WRONG_MINIMUM
,
"-100.3000"
,
report
.
getMinimum
(
valuesWithNegativeMin
));
final
List
<
Double
>
valuesWithSameNumberTwice
=
Arrays
.
asList
(
30.0
,
-
1.2
,
100.0
,
100.3
,
-
0.07
,
100.0
);
assertEquals
(
WRONG_MINIMUM
,
"-1.2000"
,
report
.
getMinimum
(
valuesWithSameNumberTwice
));
final
List
<
Double
>
valuesWithMinTwice
=
Arrays
.
asList
(
30.0
,
1.2
,
100.0
,
100.3
,
0.07
,
100.3
,
0.07
);
assertEquals
(
WRONG_MINIMUM
,
"0.0700"
,
report
.
getMinimum
(
valuesWithMinTwice
));
}
@After
public
void
cleanUp
()
{
SimScenario
.
reset
();
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
·
7 years ago
Contributor
SonarQube analysis reported no issues.
SonarQube analysis reported no issues.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment