1pub mod bigint;
6pub mod bitbang;
7pub mod bitfield;
8pub mod file;
9pub mod fs;
10pub mod hexdump;
11pub mod num_de;
12pub mod parse_int;
13pub mod present;
14pub mod printer;
15pub mod raw_tty;
16pub mod rom_detect;
17pub mod runtime;
18pub mod serde;
19pub mod status;
20pub mod testing;
21pub mod unknown;
22pub mod usb;
23pub mod usr_access;
24pub mod vcd;
25pub mod vmem;
26pub mod voltage;
27
28pub use runtime::runtime;
29
30#[macro_export]
32macro_rules! collection {
33 ($($k:expr => $v:expr),* $(,)?) => {{
35 use std::iter::{Iterator, IntoIterator};
36 Iterator::collect(IntoIterator::into_iter([$(($k, $v),)*]))
37 }};
38
39 ($($v:expr),* $(,)?) => {{
41 use std::iter::{Iterator, IntoIterator};
42 Iterator::collect(IntoIterator::into_iter([$($v),*]))
43 }};
44}
45
46#[cfg(test)]
48pub fn testdata(test: &str) -> std::path::PathBuf {
49 let mut path: std::path::PathBuf = std::env::var_os("TESTDATA").unwrap().into();
50 path.pop();
52 path.pop();
53 path.push(test);
54 path
55}
56
57pub fn tmpfilename(name: &str) -> String {
61 let mut dir = match std::env::var("TEST_UNDECLARED_OUTPUTS_DIR") {
62 Ok(name) => std::path::PathBuf::from(name),
63 Err(_) => std::env::temp_dir(),
64 };
65 dir.push(name);
66 dir.to_str().unwrap().into()
67}