Tyre pressures show in bar by default; Settings → Display offers kPa and psi as well. Display only: the car reports kPa and the server keeps storing kPa. A "Power, 5-min average" card under Power: the time-weighted mean battery power over the last five minutes, standing included, from the same samples as the 5-minute range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
30 lines
906 B
Java
30 lines
906 B
Java
package com.evsuite.abrp;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import org.junit.Test;
|
|
|
|
/** Tyre pressure display units — pure JVM. */
|
|
public class PressureUnitTest {
|
|
|
|
@Test
|
|
public void kpaFromTheCarInEachUnit() {
|
|
assertEquals("2.5 bar", PressureUnit.BAR.format(250f));
|
|
assertEquals("250 kPa", PressureUnit.KPA.format(250f));
|
|
assertEquals("36.3 psi", PressureUnit.PSI.format(250f));
|
|
}
|
|
|
|
@Test
|
|
public void anUnreadPressureStaysADash() {
|
|
assertEquals("—", PressureUnit.BAR.format(null));
|
|
assertEquals("—", PressureUnit.PSI.format(Float.NaN));
|
|
}
|
|
|
|
@Test
|
|
public void barUnlessSomethingElseWasChosen() {
|
|
assertEquals(PressureUnit.BAR, PressureUnit.fromPref(null));
|
|
assertEquals(PressureUnit.BAR, PressureUnit.fromPref("nonsense"));
|
|
assertEquals(PressureUnit.PSI, PressureUnit.fromPref("PSI"));
|
|
}
|
|
}
|