use tox_binary_io::*;
use tox_core::state_format::old::*;
#[test]
fn load_old_state_format_with_contacts() {
let bytes = include_bytes!("data/old-profile-with-contacts.tox");
let (_rest, profile) = State::from_bytes(bytes).unwrap();
let mut buf = [0; 1024 * 1024];
let (_, size) = profile.to_bytes((&mut buf, 0)).unwrap();
assert_eq!(&bytes[..size], &buf[..size]);
for b in &bytes[size..] {
assert_eq!(0, *b);
}
}
#[test]
fn load_old_state_format_no_friends() {
let bytes = include_bytes!("data/old-profile-no-friends.tox");
let (_rest, profile) = State::from_bytes(bytes).unwrap();
let mut buf = [0; 1024 * 1024];
let (_, size) = profile.to_bytes((&mut buf, 0)).unwrap();
assert_eq!(&bytes[..size], &buf[..size]);
for b in &bytes[size..] {
assert_eq!(0, *b);
}
}