diff --git a/src/dsp408/client/dsp408.rs b/src/dsp408/client/dsp408.rs index a936be7..914e93f 100644 --- a/src/dsp408/client/dsp408.rs +++ b/src/dsp408/client/dsp408.rs @@ -2096,9 +2096,8 @@ fn full_command_sweep_against_real_hardware() { ); { - let state = dsp - .state() - .expect("state should be populated after connect"); + let state = dsp.state(); + assert!(!state.name.is_empty(), "device name should be non-empty"); assert!( !state.presets.names.is_empty(), @@ -2120,7 +2119,7 @@ fn full_command_sweep_against_real_hardware() { .expect("set_delay_unit"); assert!(ok); assert_eq!( - dsp.state().unwrap().current_config.delay_unit, + dsp.state().current_config.delay_unit, types::DelayUnit::Millisecond ); @@ -2130,27 +2129,27 @@ fn full_command_sweep_against_real_hardware() { let ok = dsp.set_mute(in_ch, true).expect("set_mute"); assert!(ok); - assert!(dsp.state().unwrap().current_config.input_states[&input].mute); + assert!(dsp.state().current_config.input_states[&input].mute); let ok = dsp.set_mute(in_ch, false).expect("unmute"); assert!(ok); - assert!(!dsp.state().unwrap().current_config.input_states[&input].mute); + assert!(!dsp.state().current_config.input_states[&input].mute); let ok = dsp.set_channel_gain(in_ch, -3.0).expect("set_channel_gain"); assert!(ok); - assert!((dsp.state().unwrap().current_config.input_states[&input].gain - (-3.0)).abs() < 0.01); + assert!((dsp.state().current_config.input_states[&input].gain - (-3.0)).abs() < 0.01); let ok = dsp .set_channel_inverse_gain(in_ch, true) .expect("set_channel_inverse_gain"); assert!(ok); - assert!(dsp.state().unwrap().current_config.input_states[&input].phase_inverted); + assert!(dsp.state().current_config.input_states[&input].phase_inverted); dsp.set_channel_inverse_gain(in_ch, false) .expect("revert phase"); let ok = dsp - .set_channel_delay(in_ch, 1.5, types::DelayUnit::Millisecond) - .expect("set_channel_delay"); + .set_delay(in_ch, 1.5, types::DelayUnit::Millisecond) + .expect("set_delay"); assert!(ok); let ok = dsp @@ -2158,7 +2157,7 @@ fn full_command_sweep_against_real_hardware() { .expect("set_channel_name"); assert!(ok); assert_eq!( - dsp.state().unwrap().current_config.input_states[&input].name, + dsp.state().current_config.input_states[&input].name, "Test InA" ); @@ -2231,7 +2230,7 @@ fn full_command_sweep_against_real_hardware() { .expect("set_matrix_routing"); assert!(ok); assert_eq!( - dsp.state().unwrap().current_config.output_states[&output] + dsp.state().current_config.output_states[&output] .matrix_routes .connected, vec![input] @@ -2273,11 +2272,11 @@ fn full_command_sweep_against_real_hardware() { .store_current_configuration(1, false) .expect("store_current_configuration"); assert!(ok); - assert!(dsp.state().unwrap().presets.modified[1]); + assert!(dsp.state().presets.modified[1]); let ok = dsp.recall_preset(1).expect("recall_preset"); assert!(ok); - assert_eq!(dsp.state().unwrap().presets.current_index, 1); + assert_eq!(dsp.state().presets.current_index, 1); // factory_reset intentionally left commented out — wipes the unit. // let ok = dsp.factory_reset(true).expect("factory_reset"); @@ -2287,6 +2286,6 @@ fn full_command_sweep_against_real_hardware() { } // ---------- Disconnect ---------- - dsp.disconnect(); + assert!(dsp.disconnect().is_ok()); assert!(!dsp.connected(), "device should report disconnected"); }