| 1 |
macro_rules! guid { |
| 2 |
({ $p0:tt - $p1:tt - $p2:tt - $p3:tt - $p4:tt }) => { |
| 3 |
crate::shared::guid::Guid::from_str(concat!( |
| 4 |
stringify!($p0), |
| 5 |
'-', |
| 6 |
stringify!($p1), |
| 7 |
'-', |
| 8 |
stringify!($p2), |
| 9 |
'-', |
| 10 |
stringify!($p3), |
| 11 |
'-', |
| 12 |
stringify!($p4), |
| 13 |
)) |
| 14 |
.unwrap() |
| 15 |
}; |
| 16 |
} |
| 17 |
|
| 18 |
macro_rules! exguid { |
| 19 |
({$guid:tt , $n:literal}) => { |
| 20 |
crate::fsshttpb::data::exguid::ExGuid::from_guid(guid!($guid), $n) |
| 21 |
}; |
| 22 |
} |
| 23 |
|
| 24 |
#[cfg(test)] |
| 25 |
mod test { |
| 26 |
use crate::fsshttpb::data::exguid::ExGuid; |
| 27 |
use crate::shared::guid::Guid; |
| 28 |
|
| 29 |
#[test] |
| 30 |
fn parse_guid() { |
| 31 |
let guid = guid!({1A5A319C-C26B-41AA-B9C5-9BD8C44E07D4}); |
| 32 |
|
| 33 |
assert_eq!( |
| 34 |
guid, |
| 35 |
Guid::from_str("1A5A319C-C26B-41AA-B9C5-9BD8C44E07D4").unwrap() |
| 36 |
); |
| 37 |
} |
| 38 |
|
| 39 |
#[test] |
| 40 |
fn parse_exguid() { |
| 41 |
let guid = exguid!({{1A5A319C-C26B-41AA-B9C5-9BD8C44E07D4}, 1}); |
| 42 |
|
| 43 |
assert_eq!( |
| 44 |
guid, |
| 45 |
ExGuid::from_guid( |
| 46 |
Guid::from_str("1A5A319C-C26B-41AA-B9C5-9BD8C44E07D4").unwrap(), |
| 47 |
1 |
| 48 |
) |
| 49 |
); |
| 50 |
} |
| 51 |
} |