use crate::metis::{Anchor, Dot, DotSet, Dotted, Kind, Locus};
use super::{Author, TestNode, rank};
mod construction;
mod depth;
mod dissolution;
mod kinds;
mod reassignment;
fn tag_block(dot: Dot, kind: Kind) -> TestNode {
let mut block = TestNode::new();
assert!(block.write_tag(dot, kind));
block
}
fn reg_block(dot: Dot, value: &'static str) -> TestNode {
let mut block = TestNode::new();
assert!(block.write_register(dot, value));
block
}
fn seq_block(dot: Dot, n: u64) -> TestNode {
let mut block = TestNode::new();
assert!(block.weave(
dot,
Locus {
anchor: Anchor::Origin,
rank: rank(n),
}
));
block
}
fn page_with(key: u8, block: TestNode) -> TestNode {
let mut page = TestNode::new();
assert!(page.insert_child(key, block));
page
}
fn sync(from: &Author, to: &mut Author) {
let delta = from.owed_to(to.state().context());
let _ = to.absorb(from.station(), &delta);
}
fn add(author: &mut Author, build: impl FnOnce(Dot) -> TestNode) -> Dotted<TestNode> {
let (_, delta) = author.compose(|dot| (build(dot), DotSet::new()));
delta
}