use saleae::device::{ConnectedDevice, DeviceID};
use std::str::FromStr;
#[test]
fn test_from_str() {
assert_eq!(
ConnectedDevice::from_str(
"1, Logic Pro 16, LOGIC_PRO_16_DEVICE, 0xdf03c43d1f3aa2f3, ACTIVE"
)
.unwrap(),
ConnectedDevice {
d_type: "1".to_string(),
name: "Logic Pro 16".to_string(),
device_id: DeviceID::LOGIC_PRO_16_DEVICE,
index: "0xdf03c43d1f3aa2f3".to_string(),
is_active: true,
}
);
assert_eq!(
ConnectedDevice::from_str("2, Logic 8, LOGIC_8_DEVICE, 0xffffffffff, ACTIVE").unwrap(),
ConnectedDevice {
d_type: "2".to_string(),
name: "Logic 8".to_string(),
device_id: DeviceID::LOGIC_8_DEVICE,
index: "0xffffffffff".to_string(),
is_active: true,
}
);
assert_eq!(
ConnectedDevice::from_str("1, Logic Pro 16, LOGIC_PRO_16_DEVICE, 0xdf03c43d1f3aa2f3")
.unwrap(),
ConnectedDevice {
d_type: "1".to_string(),
name: "Logic Pro 16".to_string(),
device_id: DeviceID::LOGIC_PRO_16_DEVICE,
index: "0xdf03c43d1f3aa2f3".to_string(),
is_active: false,
}
);
}