use winterwallet_client::*;
#[test]
fn deserialize_wallet_account() {
let mut data = [0u8; WALLET_ACCOUNT_LEN];
data[0..32].fill(0x01);
data[32..64].fill(0x02);
data[64] = 42;
let account = WinterWalletAccount::from_bytes(&data).unwrap();
assert_eq!(account.id, [0x01; 32]);
assert_eq!(*account.root.as_bytes(), [0x02; 32]);
assert_eq!(account.bump, [42]);
}
#[test]
fn deserialize_rejects_wrong_size() {
let short = [0u8; 64];
assert!(WinterWalletAccount::from_bytes(&short).is_err());
let long = [0u8; 66];
assert!(WinterWalletAccount::from_bytes(&long).is_err());
let exact = [0u8; 65];
assert!(WinterWalletAccount::from_bytes(&exact).is_ok());
}
#[test]
fn wallet_account_len_is_65() {
assert_eq!(WALLET_ACCOUNT_LEN, 65);
assert_eq!(
core::mem::size_of::<WinterWalletAccount>(),
WALLET_ACCOUNT_LEN
);
}