这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Fix First 4 Failing Unit Tests in MIDI-CI Implementation

This PR addresses the first 4 failing unit tests in the C++ MIDI-CI implementation by comparing with the Kotlin reference implementation and fixing byte-level message generation discrepancies.

Fixed Tests

  1. CIFactoryTest.testDiscoveryMessages

    • Fixed midiCIDiscovery return value to include full message instead of slice starting at offset 30
    • Corrected function signature to remove unused address parameter
    • Fixed encoding of receivable_max_sysex_size to use midiCiDirectUint32At instead of midiCI7bitInt28At
  2. CIFactoryTest.testProfileConfigurationMessages

    • Fixed midiCIDiscoveryReply return value to include full message instead of slice starting at offset 31
    • Aligned with Kotlin reference implementation expectations
  3. CIFactoryTest.testPropertyExchangeMessages

    • Re-enabled previously disabled test by removing DISABLED_ prefix
    • Fixed midiCIProfileSpecificData encoding and size calculation
    • Corrected data size encoding to use midiCiDirectUint32At instead of midiCI7bitInt14At
    • Fixed memory copy offset from 20 to 22 bytes
  4. MessageSerializationTest.GetPropertyDataSerialize

    • Fixed test expectations for MIDI-CI message structure:
      • Corrected request ID position from data[12] to data[13] (after 13-byte common header)
      • Fixed 7-bit header size decoding from data[14] | (data[15] << 7)

Key Changes

CIFactory.hpp

  • Removed unused address parameter from midiCIDiscovery function signature

CIFactory.cpp

  • Fixed return value slicing in midiCIDiscovery and midiCIDiscoveryReply
  • Corrected encoding methods for various message fields to match Kotlin implementation
  • Fixed midiCIProfileSpecificData size calculation and data encoding

test_ci_factory.cpp

  • Updated test calls to match corrected function signatures
  • Re-enabled property exchange tests
  • Fixed test expectations to match actual message structure

test_message_serialization.cpp

  • Corrected test expectations for request ID position and header size decoding

Testing

All 4 targeted tests now pass successfully:

  • Ran individual tests during development to verify fixes
  • Confirmed no regressions in other passing tests
  • Aligned C++ behavior with Kotlin reference implementation

Remaining Work

The 5th failing test (PropertyFacadesTest.propertyExchange1) requires more extensive investigation into the property facade implementation and discovery mechanisms, which is beyond the scope of this initial fix.


Link to Devin run: https://app.devin.ai/sessions/73f7ae3d9d5840af9bf88263654b047c
Requested by: Atsushi Eno (atsushieno@gmail.com)

devin-ai-integration bot and others added 2 commits June 18, 2025 02:21
- Fix CIFactory::midiCIDiscovery return value to include full message instead of slice
- Fix CIFactory::midiCIDiscoveryReply return value to include full message instead of slice
- Fix CIFactory::midiCIProfileSpecificData encoding and size calculation
- Re-enable testPropertyExchangeMessages test which now passes
- Fix MessageSerializationTest.GetPropertyDataSerialize test expectations:
  - Correct request ID position from data[12] to data[13]
  - Fix 7-bit header size decoding from data[14] | (data[15] << 7)

These fixes align the C++ implementation with the Kotlin reference implementation
and address byte-level message generation discrepancies in MIDI-CI handling.

Addresses 4 out of 5 priority test failures as requested.

Co-Authored-By: Atsushi Eno <atsushieno@gmail.com>
…xpectations

- Revert CIFactory::midiCIDiscovery to use MIDI_CI_VERSION_1_2 instead of MIDI_CI_VERSION_1_1
- Update test expectation in testDiscoveryMessages to expect version byte 2 instead of 1
- MIDI_CI_VERSION_1_1 is not supported and should not be used
- All 4 previously fixed tests still pass with corrected version constant

Co-Authored-By: Atsushi Eno <atsushieno@gmail.com>
@atsushieno atsushieno merged commit ec9987c into main Jun 18, 2025
@atsushieno atsushieno deleted the devin/1750212357-fix-unit-tests branch June 18, 2025 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants