use arbitrary::Arbitrary;
use arbitrary::Unstructured;
use beancount_types::MetadataKey;
use beancount_types::MetadataValue;

#[test]
fn arbitrary_key() {
    let mut u = Unstructured::new(b"someverylongandmildlyrandominput");

    insta::assert_debug_snapshot!(MetadataKey::arbitrary(&mut u));
}

#[test]
fn arbitrary_values() {
    const INPUTS: &[&[u8]] = &[b"\0123", b"anotherrandominput", b"\x02randominput"];

    insta::assert_debug_snapshot!(INPUTS
        .iter()
        .map(|&input| {
            let mut u = Unstructured::new(input);
            MetadataValue::arbitrary(&mut u)
        })
        .collect::<Vec<_>>());
}