Improved tests
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user