use core::str::FromStr;
use bee_block::BlockId;
use packable::PackableExt;
const BLOCK_ID: &str = "0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649";
#[test]
fn debug_impl() {
assert_eq!(
format!("{:?}", BlockId::from_str(BLOCK_ID).unwrap()),
"BlockId(0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649)"
);
}
#[test]
fn from_str_valid() {
BlockId::from_str(BLOCK_ID).unwrap();
}
#[test]
fn null() {
assert_eq!(
format!("{:?}", BlockId::null()),
"BlockId(0x0000000000000000000000000000000000000000000000000000000000000000)"
);
}
#[test]
fn from_to_str() {
assert_eq!(BLOCK_ID, BlockId::from_str(BLOCK_ID).unwrap().to_string());
}
#[test]
fn packed_len() {
let block_id = BlockId::from_str(BLOCK_ID).unwrap();
assert_eq!(block_id.packed_len(), 32);
assert_eq!(block_id.pack_to_vec().len(), 32);
}
#[test]
fn pack_unpack_valid() {
let block_id = BlockId::from_str(BLOCK_ID).unwrap();
let packed_block_id = block_id.pack_to_vec();
assert_eq!(packed_block_id.len(), block_id.packed_len());
assert_eq!(
block_id,
PackableExt::unpack_verified(&mut packed_block_id.as_slice(), &()).unwrap()
);
}