triseratops 0.0.3

The robust, in-depth Serato Parser & Serializer.
Documentation
#[test]
#[allow(non_snake_case)]
fn {name}() {{
    println!("Parsing file: {filepath}");
    let input = include_bytes!("{filepath}");
    let value = match triseratops::tag::{parser}::parse_{tag_type}(&input[..]) {{
        Ok(value) => value,
        Err(err) => {{
            eprintln!("Error: {{err:?}}");
            unreachable!();
        }}
    }};

    let mut writer = Cursor::new(vec![]);
    let bytes_written = match value.write_{tag_type}(&mut writer) {{
        Ok(x) => x,
        Err(err) => {{
            eprintln!("Error: {{err:?}}");
            unreachable!();
        }}
    }};

    let output = writer.get_ref().as_slice();
    assert_eq!(bytes_written, output.len(), "Number of written bytes is incorrect");

    // The last two bytes of the base64 encoding in FLAC/MP4 tags is *random* (maybe an
    // out-of-bound read?), so we can't use it for roundtrip tests.
    let tag_type = "{tag_type}";
    if tag_type == "flac" || tag_type == "mp4" {{
        assert_eq!(input[..input.len()-2], output[..output.len()-2], "Input does not match output!");
    }} else {{
        assert_eq!(input, output, "Input does not match output!");
    }}
}}