vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use crate::generate::generators;
use crate::OpSpec;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::fs;
use std::io;
use std::path::Path;
use super::util::*;

/// Generate up to 50 deterministic inputs for a spec.
fn generate_50_inputs(spec: &OpSpec, seed: u64) -> Vec<Vec<u8>> {
    let gens = generators::default_generators();
    let mut seen = HashSet::with_capacity(50);
    let mut out = Vec::with_capacity(50);

    for gen in &gens {
        if !gen.handles(&spec.signature) {
            continue;
        }
        for (_label, bytes) in gen.generate_for_op(spec.id, &spec.signature, seed) {
            if seen.insert(bytes.clone()) {
                out.push(bytes);
                if out.len() >= 50 {
                    return out;
                }
            }
        }
    }

    // Fallback: synthesize additional random inputs for signatures
    // not fully covered by built-in generators.
    let mut rng = XorShift64::new(seed);
    while out.len() < 50 {
        let bytes = random_input_for_signature(&mut rng, &spec.signature);
        if seen.insert(bytes.clone()) {
            out.push(bytes);
        }
    }

    out
}