tokitai-operator 0.1.0

Verified DL kernel compiler: formally-checked GEMM, p-adic, sheaf, contract-carrying ops. Paper-artifact grade.
Documentation
use tokitai_operator::object::shape::Dim;

#[test]
fn value_returns_some_for_static() {
    assert_eq!(Dim::Static(5).value(), Some(5));
    assert_eq!(Dim::Static(0).value(), Some(0));
    assert_eq!(Dim::Static(usize::MAX).value(), Some(usize::MAX));
}

#[test]
fn value_returns_none_for_non_static_variants() {
    assert_eq!(Dim::Symbolic("N".to_string()).value(), None);
    assert_eq!(
        Dim::Bounded {
            name: "K".to_string(),
            min: 1,
            max: 1024
        }
        .value(),
        None
    );
    assert_eq!(Dim::DataDependent("D".to_string()).value(), None);
}

#[test]
fn value_or_returns_default_for_non_static_variants() {
    assert_eq!(Dim::Symbolic("X".to_string()).value_or(42), 42);
    assert_eq!(
        Dim::Bounded {
            name: "B".to_string(),
            min: 0,
            max: 10
        }
        .value_or(7),
        7
    );
    assert_eq!(Dim::DataDependent("D".to_string()).value_or(0), 0);
}

#[test]
fn value_or_returns_inner_for_static() {
    assert_eq!(Dim::Static(3).value_or(99), 3);
    assert_eq!(Dim::Static(0).value_or(99), 0);
}