Skip to content

Commit

Permalink
[Units] Add MK⁻¹ unit alias (#4433)
Browse files Browse the repository at this point in the history
* Add unit alias for Micro Reciprocal Kelvin

Signed-off-by: AndrewFG <software@whitebear.ch>
  • Loading branch information
andrewfg authored Nov 4, 2024
1 parent bc67311 commit 591d8d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ public final class Units extends CustomUnits {
SimpleUnitFormat.getInstance().label(MILLIAMPERE_HOUR, "mAh");
SimpleUnitFormat.getInstance().label(MILLIBAR, "mbar");
SimpleUnitFormat.getInstance().label(MILLIMETRE_OF_MERCURY, MILLIMETRE_OF_MERCURY.getSymbol());
SimpleUnitFormat.getInstance().label(MIRED, "mired");
SimpleUnitFormat.getInstance().label(MIRED, "MK⁻¹");
SimpleUnitFormat.getInstance().alias(MIRED, "mired");
SimpleUnitFormat.getInstance().alias(MIRED, "mirek");
SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
SimpleUnitFormat.getInstance().label(PARTS_PER_MILLION, "ppm");
SimpleUnitFormat.getInstance().label(PETABYTE, "PB");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,17 @@ public void testYearMonthDay() {
assertThat(converted2.doubleValue(), is(closeTo(12.0, DEFAULT_ERROR)));
}

@Test
public void testColorTemperatureAliases() {
QuantityType<?> value;
value = QuantityType.valueOf("20 mired");
assertEquals(Units.MIRED, value.getUnit());
value = QuantityType.valueOf("20 mirek");
assertEquals(Units.MIRED, value.getUnit());
value = QuantityType.valueOf("20 MK⁻¹");
assertEquals(Units.MIRED, value.getUnit());
}

private static class QuantityEquals extends IsEqual<Quantity<?>> {
private Quantity<?> quantity;

Expand Down

0 comments on commit 591d8d9

Please sign in to comment.