Skip to content

Commit

Permalink
Add tests for ShutdownMessage struct
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Mar 14, 2024
1 parent 75808a2 commit 68284c0
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/spn.rs
Expand Up @@ -1647,7 +1647,6 @@ impl core::fmt::Display for VehicleElectricalPowerMessage {
// Engine Fluid Level/Pressure 2
//

// TODO: Not tested
pub struct EngineFluidLevelPressure2Message {
/// The gage pressure of the engine oil in the hydraulic accumulator that powers an
/// intensifier used for fuel injection.
Expand Down Expand Up @@ -2020,6 +2019,35 @@ mod tests {
assert_eq!(fan_drive_decoded.fan_speed, None);
}

#[test]
fn shutdown_message_1() {
let shutdown = ShutdownMessage::from_pdu(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);

assert_eq!(shutdown.idle_shutdown_has_shutdown_engine, Some(false));
assert_eq!(shutdown.idle_shutdown_driver_alert_mode, Some(false));
assert_eq!(shutdown.idle_shutdown_timer_override, Some(false));
assert_eq!(shutdown.idle_shutdown_timer_state, Some(false));
assert_eq!(shutdown.idle_shutdown_timer_function, Some(false));
assert_eq!(shutdown.ac_high_pressure_fan_switch, Some(false));
assert_eq!(shutdown.refrigerant_low_pressure_switch, Some(false));
assert_eq!(shutdown.refrigerant_high_pressure_switch, Some(false));
assert_eq!(shutdown.wait_to_start_lamp, Some(false));
assert_eq!(
shutdown.engine_protection_system_has_shutdown_engine,
Some(false)
);
assert_eq!(
shutdown.engine_protection_system_approaching_shutdown,
Some(false)
);
assert_eq!(
shutdown.engine_protection_system_timer_override,
Some(false)
);
assert_eq!(shutdown.engine_protection_system_timer_state, Some(false));
assert_eq!(shutdown.engine_protection_system_configuration, Some(false));
}

#[test]
fn engine_temperature_1_message_1() {
let engine_temperature =
Expand Down

0 comments on commit 68284c0

Please sign in to comment.