Add the leveled value source and the dormant leveled edge form

This commit is contained in:
Dennis Kobert
2026-08-22 10:52:21 +00:00
parent e4adf16eba
commit 8eaa541c8c
3 changed files with 127 additions and 0 deletions

View File

@@ -1661,6 +1661,25 @@ mod tests {
assert_eq!(unsafe { out.rec(&value).element::<f64>() }, 20.);
}
#[test]
fn a_leveled_value_source_serves_its_items_as_lanes() {
let arena = Arena::new(1 << 16).unwrap();
let generations = [];
let scope = scope_fixture(&generations, &arena);
let ctx = ContextImpl::root(&scope);
let source = core_types::value::LeveledValueSource::new(vec![1.5, 2.25, 3.75]);
let leveled = Node::<ContextImpl>::layout(&source).clone();
let out = f64_layout(&[]);
reserve_for(&[&leveled, &out]);
let node = install_flip(SumNode::new(source, &leveled), &out);
let GPoll::Final(value) = node.eval(&ctx) else {
panic!("expected a final record");
};
assert_eq!(unsafe { out.rec(&value).element::<f64>() }, 7.5);
}
#[test]
fn reducer_drains_a_lower_bound_level() {
let arena = Arena::new(1 << 16).unwrap();