helena 0.1.0

Core types and component interfaces for helena, a latent data-to-waveform generation platform.
Documentation
use super::*;

#[test]
fn generation_defaults_resolve_to_typed_values() {
    // The default `generation` section (temperature 1.0, guidance 1.0, one
    // candidate) resolves to the domain vocabulary: a positive temperature is
    // `Some(Temperature)`, guidance is the neutral scale, candidates is one.
    let spec = valid_config().resolve().expect("resolve");
    let g = spec.generation();
    assert_eq!(g.temperature().map(|t| t.get()), Some(1.0));
    assert!(g.guidance().is_neutral());
    assert_eq!(g.candidates().get(), 1);
}

#[test]
fn positive_temperature_maps_to_some_deterministic_to_none() {
    // The `0.0 => None` (deterministic) nuance, mapped onto the typed default:
    // a positive value must satisfy `Temperature`'s own invariant and lands in
    // `Some`, while exactly `0.0` is the determinism sentinel and lands in
    // `None`.
    let mut c = valid_config();
    c.generation.temperature = 0.7;
    let some = c.clone().resolve().unwrap();
    assert_eq!(some.generation().temperature().map(|t| t.get()), Some(0.7));

    c.generation.temperature = 0.0;
    let none = c.resolve().unwrap();
    assert_eq!(none.generation().temperature(), None);
}