@@ -1430,24 +1430,6 @@ TEST(midi_manager_close_port_after_open_attempt_no_crash) {
14301430// PLATFORM-CONSCIOUS EXTENSIONS FOR 90%+ COMPILATION TARGETS
14311431// ===========================================================================
14321432
1433- /* *
1434- * @brief Exercises the error fallback paths inside midi_manager_persist.cpp
1435- * by feeding a completely empty object context to ensure the deserializer
1436- * registers a validation failure correctly.
1437- */
1438- TEST (midi_persist_deserializer_validation_failure) {
1439- config_backup_guard guard;
1440- std::ofstream file (" midi_config.json" );
1441- file << R"( {})" ;
1442- file.close ();
1443-
1444- MidiManager mgr;
1445- mgr.clear_mappings ();
1446- mgr.load_config ();
1447-
1448- // Fallback logic forces default array parameters upon empty object tracking
1449- ASSERT_EQ (static_cast <int >(mgr.mappings ().size ()), 2 );
1450- }
14511433
14521434/* *
14531435 * @brief Validates MidiManager initialization boundaries and structural properties
@@ -1463,4 +1445,22 @@ TEST(midi_manager_core_state_tracking_boundaries) {
14631445 // Explicit call to check the clean fallback loop counters on an uninitialized instance
14641446 auto active_mappings = mgr.mappings ();
14651447 ASSERT_GE (static_cast <int >(active_mappings.size ()), 0 );
1448+ }
1449+ /* *
1450+ * @brief Drives the successful JSON parsing path in mappings_from_json()
1451+ * by creating a valid config file and asserting that mappings are
1452+ * successfully loaded, hitting the lines that currently show 0 hits.
1453+ */
1454+ TEST (midi_persist_load_config_valid_json_succeeds) {
1455+ config_backup_guard guard;
1456+ std::ofstream file (" midi_config.json" );
1457+ // Valid schema with one mapping
1458+ file << R"( {"mappings": [{"cc": 7, "target": 0, "mode": 0, "effect": "Test", "param": "Drive"}]})" ;
1459+ file.close ();
1460+
1461+ MidiManager mgr;
1462+ mgr.load_config ();
1463+
1464+ // If the parser successfully hit the successful loops, we expect at least 1 mapping
1465+ ASSERT_GE (static_cast <int >(mgr.mappings ().size ()), 1 );
14661466}
0 commit comments