diff --git a/minimateplus/decode_check.py b/minimateplus/decode_check.py index 63f09f0..e3d396b 100644 --- a/minimateplus/decode_check.py +++ b/minimateplus/decode_check.py @@ -191,7 +191,9 @@ def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> Fie if not printed.strip() or printed.strip() == "N/A": return FieldResult(tag, "no_reference", printed, None) if tag in ("MicLPSPL", "MicTriggerLevel"): - units = ref.event_units or "" + # A printed value that states its unit is compared in that unit: + # K441LA17.IN0W's Units say psi(L), its MicTriggerLevel "125.0 dB(L)". + units = printed if ("dB(L)" in printed or "psi(L)" in printed) else (ref.event_units or "") key = (f"{tag} dB(L)" if "dB(L)" in units else f"{tag} psi(L)" if "psi(L)" in units else None) value = sfm.values.get(key) if key else None diff --git a/tests/test_decode_check.py b/tests/test_decode_check.py index 6c76c80..da1eca3 100644 --- a/tests/test_decode_check.py +++ b/tests/test_decode_check.py @@ -269,3 +269,13 @@ def test_dB_or_psi_is_blastwares_display_preference(): def test_the_units_carveout_still_needs_the_mic(): assert _units_case("in/s").verdict == "mismatch" + + +def test_a_mic_trigger_level_is_read_in_the_unit_it_is_printed_in(): + # K441LA17.IN0W: Units "in/s and psi(L)", yet MicTriggerLevel "125.0 dB(L)". + # The printed value states its own unit; that is the one to compare in. + sf = FIX.parent / "setup-fields-11-03-26" + ref = parse_xml_report_file(sf / "T189HUD6_QE0W_XML.XML") # 128.0 dB(L) + ref.event_units = "in/s and psi(L)" + res = {r.field: r for r in compare(sfm_side((sf / "T189HUD6.QE0W").read_bytes()), ref, CARVEOUTS)} + assert res["MicTriggerLevel"].verdict == "match", res["MicTriggerLevel"]