vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use vyre::ir::{BufferDecl, DataType, Expr, Node, Program};
use vyre_conform::{reference::interp, spec::value::Value};

/// ADVERSARIAL: Bytes element with stride 0 is treated as unconditionally OOB — vector: every
/// Load on a Bytes buffer returns empty bytes, making the entire contents inaccessible.
#[test]
fn load_from_bytes_buffer_is_accessible() {
    let program = Program::new(
        vec![
            BufferDecl::read("bytes_in", 0, DataType::Bytes),
            BufferDecl::read_write("out", 1, DataType::Bytes),
        ],
        [1, 1, 1],
        vec![Node::store(
            "out",
            Expr::u32(0),
            Expr::load("bytes_in", Expr::u32(0)),
        )],
    );

    let input = vec![0xAB, 0xCD, 0xEF];
    let outputs = interp::run(
        &program,
        &[Value::Bytes(input.clone()), Value::Bytes(vec![0; 1])],
    )
    .expect("load from Bytes buffer must be accessible");

    // For a Bytes buffer BufLen reports the byte count, so index 0 must return the first byte.
    assert_eq!(outputs, vec![Value::Bytes(vec![0xAB])]);
}