Improved tests

This commit is contained in:
Eric Ratliff
2026-02-18 21:22:14 -06:00
parent eee2f690da
commit d7c6d432f9
2 changed files with 322 additions and 2 deletions

View File

@@ -550,6 +550,32 @@ mod tests {
assert_eq!(info.vid_pid(), "2341:0043");
}
#[test]
fn test_vid_pid_case_insensitive() {
let info = PortInfo {
port_name: "COM3".to_string(),
protocol: "Serial Port (USB)".to_string(),
board_name: "Unknown".to_string(),
fqbn: String::new(),
vid: "0x2341".to_string(),
pid: "0x0043".to_string(),
serial_number: String::new(),
};
// vid_pid() should normalize to lowercase
assert_eq!(info.vid_pid(), "2341:0043");
let upper = PortInfo {
port_name: "COM3".to_string(),
protocol: "Serial Port (USB)".to_string(),
board_name: "Unknown".to_string(),
fqbn: String::new(),
vid: "0x1A86".to_string(),
pid: "0x7523".to_string(),
serial_number: String::new(),
};
assert_eq!(upper.vid_pid(), "1a86:7523");
}
#[test]
fn test_is_usb_from_vid_pid() {
let info = PortInfo {