Commit f35cd2c7 authored by Kai-Holger Brassel's avatar Kai-Holger Brassel
Browse files

Ensure US number format in tests ('.' is decimal point)

parent a7efae45
Pipeline #1761 failed with stages
in 2 minutes and 46 seconds
package de.hftstuttgart.cityunits.tests;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Locale;
import java.util.Locale.Category;
import javax.measure.Quantity;
import javax.measure.Unit;
import javax.measure.quantity.Area;
......@@ -19,6 +23,8 @@ class QuantityTest
static void init() {
// Initialize additional units like metric ton, $ and € with their labels
UrbanSimulationUnits.getInstance();
// Ensure US number format (interpret '.' as decimal point)
Locale.setDefault(Category.FORMAT, Locale.US);
}
@Test
......@@ -57,7 +63,7 @@ class QuantityTest
void testkWhPerCubicMeter() {
Quantity<?> q = Quantities.getQuantity((String)"5.2 kW*h/m³");
assertEquals("[M]/([L]·[T]²)", q.getUnit().getDimension().toString(), "Wrong dimension!");
assertEquals("187200000 W·s/m³", q.toSystemUnit().toString());
assertEquals("18720000 W·s/m³", q.toSystemUnit().toString());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment