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: eval_call truncates multi-byte arguments to 4 bytes — vector: a Call with a
/// Bytes argument longer than 4 bytes passes only the first word to the CPU reference,
/// corrupting the operation result.
#[test]
fn call_preserves_full_bytes_argument() {
    let program = Program::new(
        vec![
            BufferDecl::read("bytes_in", 0, DataType::Bytes),
            BufferDecl::read_write("bytes_out", 1, DataType::Bytes),
        ],
        [1, 1, 1],
        vec![Node::store(
            "bytes_out",
            Expr::u32(0),
            Expr::Call {
                op_id: "primitive.encoding.base64".to_string(),
                args: vec![Expr::load("bytes_in", Expr::u32(0))],
            },
        )],
    );

    // "SGVsbG8=" is the base64 encoding of "Hello" (5 bytes).
    let b64_input = b"SGVsbG8=".to_vec();
    let expected_output = b"Hello".to_vec();

    let outputs = interp::run(
        &program,
        &[Value::Bytes(b64_input), Value::Bytes(vec![0; 5])],
    )
    .expect("call must pass the full bytes payload to the CPU reference");

    assert_eq!(outputs, vec![Value::Bytes(expected_output)]);
}