protospec-build 0.3.0

One binary format language to rule them all, One binary format language to find them, One binary format language to bring them all and in the darkness bind them.
Documentation
use super::*;

#[test]
fn test_base() {
    let asg = load_asg(include_str!("./test.pspec")).unwrap();

    let test = quote! {
        let mut input = TestContainer {
            name_len: 0,
            name: "test name".to_string(),
            int1: Some(128),
        };

        let mut out = vec![];
        input.encode_sync(&mut out).expect("failed to encode");
        let decoded = TestContainer::decode_sync(&mut &out[..]).expect("failed to decode");
        assert!(decoded.int1.is_none());
        input.name = "test name-test name".to_string();
        out = vec![];
        input.encode_sync(&mut out).expect("failed to encode");
        let decoded = TestContainer::decode_sync(&mut &out[..]).expect("failed to decode");
        assert!(decoded.int1.is_some());
    };

    compile("test", &compile_test_program(&asg, test));
}