mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-05-29 05:38:39 +00:00
usb/src/lib.rs: make set_address() run by default, move upwards
This commit is contained in:
parent
08884f1718
commit
4bd350c948
|
@ -96,7 +96,6 @@ pub enum Descriptor {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[cfg(TODO)]
|
|
||||||
use core::num::NonZeroU8;
|
use core::num::NonZeroU8;
|
||||||
|
|
||||||
use crate::{Descriptor, Request};
|
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]
|
#[test]
|
||||||
fn set_address() {
|
fn set_address() {
|
||||||
// OK: SET_ADDRESS 16
|
// 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)]
|
#[cfg(TODO)]
|
||||||
#[test]
|
#[test]
|
||||||
fn set_configuration() {
|
fn set_configuration() {
|
||||||
|
|
Loading…
Reference in a new issue