| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| /// The `collection` macro provides syntax for hash and set literals. |
| macro_rules! collection { |
| ($($k:expr => $v:expr),* $(,)?) => {{ |
| use std::iter::{Iterator, IntoIterator}; |
| Iterator::collect(IntoIterator::into_iter([$(($k, $v),)*])) |
| ($($v:expr),* $(,)?) => {{ |
| use std::iter::{Iterator, IntoIterator}; |
| Iterator::collect(IntoIterator::into_iter([$($v),*])) |
| /// The `testdata` macro can be used in tests to reference testdata directories. |
| let mut path = PathBuf::new(); |
| let mut path = testdata!(); |
| testdata!().to_str().unwrap(), |
| "sw/host/opentitanlib/src/util/testdata" |
| testdata!("my.file").to_str().unwrap(), |
| "sw/host/opentitanlib/src/util/testdata/my.file" |