usb/src/lib.rs: make set_address() run by default, move upwards

This commit is contained in:
Lotte Steenbrink 2020-07-03 12:22:58 +02:00
parent 08884f1718
commit 4bd350c948

View file

@ -96,7 +96,6 @@ pub enum Descriptor {
#[cfg(test)]
mod tests {
#[cfg(TODO)]
use core::num::NonZeroU8;
use crate::{Descriptor, Request};
@ -121,24 +120,6 @@ mod tests {
// ^^^^
}
#[cfg(TODO)]
#[test]
fn get_descriptor_configuration() {
// OK: GET_DESCRIPTOR Configuration 0 [length=9]
assert_eq!(
Request::parse(0b1000_0000, 0x06, 0x02_00, 0, 9),
Ok(Request::GetDescriptor {
descriptor: Descriptor::Configuration { index: 0 },
length: 9
})
);
// has language ID but shouldn't
assert!(Request::parse(0b1000_0000, 0x06, 0x02_00, 1033, 9).is_err());
// ^^^^
}
#[cfg(TODO)]
#[test]
fn set_address() {
// OK: SET_ADDRESS 16
@ -168,6 +149,23 @@ mod tests {
// ^
}
#[cfg(TODO)]
#[test]
fn get_descriptor_configuration() {
// OK: GET_DESCRIPTOR Configuration 0 [length=9]
assert_eq!(
Request::parse(0b1000_0000, 0x06, 0x02_00, 0, 9),
Ok(Request::GetDescriptor {
descriptor: Descriptor::Configuration { index: 0 },
length: 9
})
);
// has language ID but shouldn't
assert!(Request::parse(0b1000_0000, 0x06, 0x02_00, 1033, 9).is_err());
// ^^^^
}
#[cfg(TODO)]
#[test]
fn set_configuration() {