mirror of
https://github.com/bybrooklyn/openbitdo.git
synced 2026-03-19 12:12:57 -04:00
Bootstrap OpenBitdo clean-room SDK and reliability milestone
This commit is contained in:
41
sdk/tests/boot_safety.rs
Normal file
41
sdk/tests/boot_safety.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use bitdo_proto::{BitdoError, DeviceSession, MockTransport, SessionConfig, VidPid};
|
||||
|
||||
#[test]
|
||||
fn unsafe_boot_requires_dual_ack() {
|
||||
let transport = MockTransport::default();
|
||||
let mut session = DeviceSession::new(
|
||||
transport,
|
||||
VidPid::new(0x2dc8, 24585),
|
||||
SessionConfig {
|
||||
allow_unsafe: true,
|
||||
brick_risk_ack: false,
|
||||
experimental: true,
|
||||
..SessionConfig::default()
|
||||
},
|
||||
)
|
||||
.expect("session init");
|
||||
|
||||
let err = session.enter_bootloader().expect_err("expected denial");
|
||||
match err {
|
||||
BitdoError::UnsafeCommandDenied { .. } => {}
|
||||
other => panic!("unexpected error: {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsafe_boot_succeeds_with_dual_ack() {
|
||||
let transport = MockTransport::default();
|
||||
let mut session = DeviceSession::new(
|
||||
transport,
|
||||
VidPid::new(0x2dc8, 24585),
|
||||
SessionConfig {
|
||||
allow_unsafe: true,
|
||||
brick_risk_ack: true,
|
||||
experimental: true,
|
||||
..SessionConfig::default()
|
||||
},
|
||||
)
|
||||
.expect("session init");
|
||||
|
||||
session.enter_bootloader().expect("boot sequence");
|
||||
}
|
||||
Reference in New Issue
Block a user