aboutsummaryrefslogtreecommitdiff
path: root/nitrokey/tests/util
diff options
context:
space:
mode:
Diffstat (limited to 'nitrokey/tests/util')
-rw-r--r--nitrokey/tests/util/mod.rs31
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 {