use vyre::ir::{BufferDecl, DataType, Expr, Node, Program};
use vyre_conform::{reference::interp, spec::value::Value};
#[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))],
},
)],
);
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)]);
}