vyre 0.4.0

GPU compute intermediate representation with a standard operation library
Documentation
//! Coverage rebuttal: `decode.base64` is a public API with real tests.
//!
//! External audit 2026-04-13 flagged `core/src/ops/decode/base64` as a
//! public entrypoint with no unit tests, integration tests, or
//! `#[cfg(test)]` blocks. This file is the direct rebuttal for the
//! core-side surface: construction, determinism, validation, and wire
//! round-trip of the op's canonical IR.
//!
//! Semantic bytes-in → bytes-out tests run under
//! `conform/tests/laws_are_not_decorative.rs` and the per-op KAT
//! corpus — both executed via the conform registry's `cpu_fn` which
//! knows how to evaluate the IR.

use vyre::ir::{validate, Program};
use vyre::ops::decode::base64::Base64Decode;

#[test]
fn decode_base64_program_constructs_without_error() {
    let program = Base64Decode::program();
    let errors = validate(&program);
    assert!(
        errors.is_empty(),
        "decode.base64 program validation failed: {errors:?}. \
         This is a public API — it must always produce a valid IR."
    );
}

#[test]
fn decode_base64_program_is_deterministic() {
    let first = Base64Decode::program();
    let second = Base64Decode::program();
    assert_eq!(
        first, second,
        "decode.base64 program construction is non-deterministic — \
         two calls to Base64Decode::program() produced different IRs"
    );
}

#[test]
fn decode_base64_wire_roundtrips_losslessly() {
    let program = Base64Decode::program();
    let encoded = program
        .to_wire()
        .expect("decode.base64 program must encode to wire format without error");
    let decoded = Program::from_wire(&encoded)
        .expect("decode.base64 program must decode from wire format without error");
    assert_eq!(
        decoded, program,
        "decode.base64 wire format is not a roundtrip identity: decode(encode(p)) != p"
    );
}

#[test]
fn decode_base64_spec_declares_bounded_output_law() {
    // The CPU reference lives in a const LAWS slice inside kernel.rs. We
    // verify the declared law set contains Bounded(0, 255) — the only
    // law that can be correctly declared on a bytes-to-bytes transform
    // without a runtime that can evaluate semantics.
    let spec = Base64Decode::SPEC;
    let has_bounded = spec
        .laws()
        .iter()
        .any(|law| matches!(law, vyre::ops::AlgebraicLaw::Bounded { lo: 0, hi: 255 }));
    assert!(
        has_bounded,
        "decode.base64 must declare Bounded(0, 255) on its output. Laws: {:?}",
        spec.laws()
    );
}

#[test]
fn decode_base64_spec_id_is_stable() {
    assert_eq!(
        Base64Decode::SPEC.id(),
        "decode.base64",
        "decode.base64 op id changed — this breaks testforge, the contribution surface, \
         and every consumer that references the op by string id"
    );
}