Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NeqModPlus
de.hft-stuttgart.cityunits
Commits
f35cd2c7
Commit
f35cd2c7
authored
4 years ago
by
Kai-Holger Brassel
Browse files
Options
Download
Email Patches
Plain Diff
Ensure US number format in tests ('.' is decimal point)
parent
a7efae45
Pipeline
#1761
failed with stages
in 2 minutes and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.hftstuttgart.cityunits.tests/src/de/hftstuttgart/cityunits/tests/QuantityTest.java
+7
-1
...sts/src/de/hftstuttgart/cityunits/tests/QuantityTest.java
with
7 additions
and
1 deletion
+7
-1
de.hftstuttgart.cityunits.tests/src/de/hftstuttgart/cityunits/tests/QuantityTest.java
+
7
-
1
View file @
f35cd2c7
package
de.hftstuttgart.cityunits.tests
;
package
de.hftstuttgart.cityunits.tests
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
java.util.Locale
;
import
java.util.Locale.Category
;
import
javax.measure.Quantity
;
import
javax.measure.Quantity
;
import
javax.measure.Unit
;
import
javax.measure.Unit
;
import
javax.measure.quantity.Area
;
import
javax.measure.quantity.Area
;
...
@@ -19,6 +23,8 @@ class QuantityTest
...
@@ -19,6 +23,8 @@ class QuantityTest
static
void
init
()
{
static
void
init
()
{
// Initialize additional units like metric ton, $ and € with their labels
// Initialize additional units like metric ton, $ and € with their labels
UrbanSimulationUnits
.
getInstance
();
UrbanSimulationUnits
.
getInstance
();
// Ensure US number format (interpret '.' as decimal point)
Locale
.
setDefault
(
Category
.
FORMAT
,
Locale
.
US
);
}
}
@Test
@Test
...
@@ -57,7 +63,7 @@ class QuantityTest
...
@@ -57,7 +63,7 @@ class QuantityTest
void
testkWhPerCubicMeter
()
{
void
testkWhPerCubicMeter
()
{
Quantity
<?>
q
=
Quantities
.
getQuantity
((
String
)
"5.2 kW*h/m³"
);
Quantity
<?>
q
=
Quantities
.
getQuantity
((
String
)
"5.2 kW*h/m³"
);
assertEquals
(
"[M]/([L]·[T]²)"
,
q
.
getUnit
().
getDimension
().
toString
(),
"Wrong dimension!"
);
assertEquals
(
"[M]/([L]·[T]²)"
,
q
.
getUnit
().
getDimension
().
toString
(),
"Wrong dimension!"
);
assertEquals
(
"18720000
0
W·s/m³"
,
q
.
toSystemUnit
().
toString
());
assertEquals
(
"18720000 W·s/m³"
,
q
.
toSystemUnit
().
toString
());
}
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment