vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use crate::properties::tests::{pair, primitive, result_u32, unary};
use crate::spec::law::AlgebraicLaw;

#[inline]
pub fn verify_bounded(spec: &crate::spec::types::OpSpec, lo: u32, hi: u32) {
    if spec.signature.inputs.len() == 2 {
        for a in SAMPLE {
            for b in SAMPLE {
                let val = call_u32(spec, &pair(a, b));
                assert!(
                    lo <= val && val <= hi,
                    "{} violates Bounded([{lo}, {hi}]) at ({a}, {b}): got {val}",
                    spec.id
                );
            }
        }
        return;
    }

    for a in SAMPLE {
        let val = call_u32(spec, &unary(a));
        assert!(
            lo <= val && val <= hi,
            "{} violates Bounded([{lo}, {hi}]) at {a}: got {val}",
            spec.id
        );
    }
}