Phase 3 PR 60 -- Mitsubishi MELSEC quirk integration tests #59

Merged
dohertj2 merged 1 commits from phase-3-pr60-mitsubishi-quirk-tests into v2 2026-04-18 23:10:37 -04:00
Owner

Summary

Seven facts in MitsubishiQuirkTests against the mitsubishi pymodbus profile:

  1. D0_fingerprint_reads_0x1234 — D-register fingerprint convention, uses DRegisterToHolding('D0').
  2. Float32_CDAB_decodes_1_5f_from_D100 — CDAB word order (same family as DL260, opposite of S7).
  3. D10_is_binary_not_BCD — reads HR[10]=0x04D2 as Int16 → 1234. MELSEC is binary-by-default.
  4. D10_as_BCD_throws_because_nibble_is_non_decimal — reading same cell as Bcd16 fails loud (nibble 0xD). Proves the BCD decoder doesn't silently corrupt.
  5. QLiQR_X210_hex_maps_to_DI_528_reads_ON — end-to-end proof of hex X-addressing via XInputToDiscrete('X210', Q_L_iQR).
  6. family_trap_X20_differs_on_Q_vs_FX — in-integration reminder of the headline trap.
  7. M512_maps_to_coil_512_reads_ON — decimal M-relay path.

Single test class + shared fixture (contrast with DL205's per-quirk class splits) — MELSEC per-model differentiation handled by MelsecFamily enum, not per-PR.

Validation

  • 8/8 Mitsubishi integration tests pass against live pymodbus mitsubishi profile
  • 176/176 Modbus.Tests unit suite green
  • S7 / DL205 suites unaffected (per-family env-var gating)
## Summary Seven facts in `MitsubishiQuirkTests` against the `mitsubishi` pymodbus profile: 1. `D0_fingerprint_reads_0x1234` — D-register fingerprint convention, uses `DRegisterToHolding('D0')`. 2. `Float32_CDAB_decodes_1_5f_from_D100` — CDAB word order (same family as DL260, opposite of S7). 3. `D10_is_binary_not_BCD` — reads HR[10]=0x04D2 as Int16 → 1234. MELSEC is binary-by-default. 4. `D10_as_BCD_throws_because_nibble_is_non_decimal` — reading same cell as Bcd16 fails loud (nibble 0xD). Proves the BCD decoder doesn't silently corrupt. 5. `QLiQR_X210_hex_maps_to_DI_528_reads_ON` — end-to-end proof of hex X-addressing via `XInputToDiscrete('X210', Q_L_iQR)`. 6. `family_trap_X20_differs_on_Q_vs_FX` — in-integration reminder of the headline trap. 7. `M512_maps_to_coil_512_reads_ON` — decimal M-relay path. Single test class + shared fixture (contrast with DL205's per-quirk class splits) — MELSEC per-model differentiation handled by `MelsecFamily` enum, not per-PR. ## Validation - 8/8 Mitsubishi integration tests pass against live pymodbus mitsubishi profile - 176/176 Modbus.Tests unit suite green - S7 / DL205 suites unaffected (per-family env-var gating)
dohertj2 added 1 commit 2026-04-18 23:10:34 -04:00
Phase 3 PR 60 -- Mitsubishi MELSEC quirk integration tests against mitsubishi pymodbus profile. Seven facts in MitsubishiQuirkTests covering the quirks documented in docs/v2/mitsubishi.md that are testable end-to-end via pymodbus: (1) Mitsubishi_D0_fingerprint_reads_0x1234 -- MELSEC operators reserve D0 as a fingerprint word so Modbus clients can verify they're hitting the right Device Assignment block; test reads HR[0]=0x1234 via DRegisterToHolding('D0') helper. (2) Mitsubishi_Float32_CDAB_decodes_1_5f_from_D100 -- reads HR[100..101] with WordSwap AND BigEndian; asserts WordSwap==1.5f AND BigEndian!=1.5f, proving (a) MELSEC uses CDAB default same as DL260, (b) opposite of S7 ABCD, (c) driver flag is not a no-op. (3) Mitsubishi_D10_is_binary_not_BCD -- reads HR[10]=0x04D2 as Int16 and asserts value 1234 (binary decode), contrasting with DL205's BCD-by-default convention. (4) Mitsubishi_D10_as_BCD_throws_because_nibble_is_non_decimal -- reads same HR[10] as Bcd16 and asserts StatusCode != 0 because nibble 0xD fails BCD validation; proves the BCD decoder fails loud when the tag config is wrong rather than silently returning garbage. (5) Mitsubishi_QLiQR_X210_hex_maps_to_DI_528_reads_ON -- reads FC02 at the MelsecAddress.XInputToDiscrete('X210', Q_L_iQR)-resolved address (=528 decimal) and asserts ON; proves the hex-parsing path end-to-end. (6) Mitsubishi_family_trap_X20_differs_on_Q_vs_FX -- unit-level proof in the integration file so the headline family trap is visible to anyone filtering by Device=Mitsubishi. (7) Mitsubishi_M512_maps_to_coil_512_reads_ON -- reads FC01 at MRelayToCoil('M512')=512 (decimal) and asserts ON; proves the decimal M-relay path. Test fixture pattern: single MitsubishiQuirkTests class with a shared ShouldRun + NewDriverAsync helper rather than per-quirk classes (contrast with DL205's per-quirk splits). MELSEC per-model differentiation is handled by MelsecFamily enum on the helper rather than per-PR -- so one quirk file + one family enum covers Q/L/iQ-R/FX/iQ-F, and a new PLC family just adds an enum case instead of a new test class. 8/8 Mitsubishi integration tests pass (1 smoke + 7 quirk). 176/176 Modbus.Tests unit suite still green. S7 + DL205 integration tests can be run against their respective profiles by swapping MODBUS_SIM_PROFILE and restarting the pymodbus sim -- each family gates on its profile env var so no cross-family test pollution. a44fc7a610
dohertj2 merged commit be8261a4ac into v2 2026-04-18 23:10:37 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#59