diff options
author | Daniel Mueller <deso@posteo.net> | 2019-08-12 22:07:44 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-08-12 22:07:44 -0700 |
commit | 4dc73375e0364aea70b52682b916635b7b75a2eb (patch) | |
tree | b92b238d61c14bb634db699dedcd714918b84975 /nitrokey/tests/util/mod.rs | |
parent | a18066a1a10792ddbd57527ad58f75fc84fafad2 (diff) | |
download | nitrocli-4dc73375e0364aea70b52682b916635b7b75a2eb.tar.gz nitrocli-4dc73375e0364aea70b52682b916635b7b75a2eb.tar.bz2 |
Update nitrokey crate to 0.4.0-alpha.2
This change updates the dependency to nitrokey to version 0.4.0-alpha.2.
In addition to minor interface changes for the get_*_firmware_version
and get_*_retry_count functions, several functions that change the
device state now require a mutable handle to the nitrokey. Hence, this
patch a number of function signatures to accept mutable device objects.
Import subrepo nitrokey/:nitrokey at 34efcfadf1436102e42144f710edabaa2c4b55cd
Diffstat (limited to 'nitrokey/tests/util/mod.rs')
-rw-r--r-- | nitrokey/tests/util/mod.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/nitrokey/tests/util/mod.rs b/nitrokey/tests/util/mod.rs index 49ec13e..f2b20ec 100644 --- a/nitrokey/tests/util/mod.rs +++ b/nitrokey/tests/util/mod.rs @@ -1,8 +1,35 @@ // Copyright (C) 2018-2019 Robin Krahl <robin.krahl@ireas.org> // SPDX-License-Identifier: MIT -pub static ADMIN_PASSWORD: &str = "12345678"; -pub static USER_PASSWORD: &str = "123456"; +#[macro_export] +macro_rules! unwrap_ok { + ($val:expr) => {{ + match $val { + Ok(val) => val, + Err(err) => panic!( + r#"assertion failed: `(left == right)` + left: `Ok(_)`, + right: `Err({:?})`"#, + err + ), + } + }}; +} + +#[macro_export] +macro_rules! assert_any_ok { + ($val:expr) => {{ + match &$val { + Ok(_) => {} + Err(err) => panic!( + r#"assertion failed: `(left == right)` + left: `Ok(_)`, + right: `Err({:?})`"#, + err + ), + } + }}; +} #[macro_export] macro_rules! assert_ok { |