Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
JannesBrands committed Feb 21, 2024
1 parent 0c8d683 commit d5914dd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/j1939/extended_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,34 @@ mod tests {
);
}

// not finished yet TODO!
//#[test]
fn test_try_from_u32_for_extended_id() {

Check failure on line 181 in src/j1939/extended_id.rs

View workflow job for this annotation

GitHub Actions / Test and coverage

function `test_try_from_u32_for_extended_id` is never used
let id = ExtendedId::try_from(0x18A0F25).unwrap();
assert_eq!(
id,
ExtendedId::new(
StandardId::new(Priority::Zero, Address::new(0x25)),
Pgn::new(false, true, PduFormat::new(0x8A), PduSpecific::new(0x0F)),
)
);

let id = ExtendedId::try_from(0x1D8A2FAF).unwrap();
assert_eq!(
id,
ExtendedId::new(
StandardId::new(Priority::Seven, Address::new(0xAF)),
Pgn::new(false, true, PduFormat::new(0x8A), PduSpecific::new(0x2F)),
)
);

let id = ExtendedId::try_from(0x24C1200).unwrap();
assert_eq!(
id,
ExtendedId::new(
StandardId::new(Priority::Zero, Address::new(0x00)),
Pgn::new(true, false, PduFormat::new(0x4C), PduSpecific::new(0x12)),
)
);
}
}

0 comments on commit d5914dd

Please sign in to comment.