use relate_core::Value;
use super::super::Graph;
#[test]
fn reposition_sealed_charge_prices_the_price_side_arms() {
let g = Graph::default();
let (a, b, ids, _) = crate::graph::test_support::folded_floor_chunk(&g);
g.begin_write().unwrap();
g.set_property_rel(ids[0], "ts", Value::Int(1000));
g.commit_write();
g.begin_write().unwrap();
g.set_property_rel(ids[0], "ts", Value::Int(1001));
g.commit_write();
assert_eq!(g.used_bytes(), g.accounted_bytes());
let lone = crate::graph::test_support::doomed_rel(&g, a, b, "V");
g.begin_write().unwrap();
g.set_property_rel(lone, "ts", Value::Int(7));
g.commit_write();
assert_eq!(g.used_bytes(), g.accounted_bytes());
}
#[test]
fn a_fully_reclaimed_chunk_marks_its_stream_dead_before_the_entry_goes() {
let g = Graph::default();
let (a, _, ids, _) = crate::graph::test_support::folded_floor_chunk(&g);
let (arena, dead) = g.out_side().sealed().reclaim_pair();
assert_eq!(dead, 0);
assert!(arena > 0, "the seal left the chunk's stream in the arena");
g.begin_write().unwrap();
for id in &ids {
g.delete_rel(*id);
}
g.commit_write();
g.fold_adjacency_at_watermark(u64::MAX);
assert!(
g.out_side().sealed().region(a).is_none(),
"the emptied region goes"
);
let (_, dead) = g.out_side().sealed().reclaim_pair();
assert_eq!(
dead, arena,
"the dead range is exactly the reclaimed stream's length"
);
g.out_side().sealed().compact();
assert_eq!(g.out_side().sealed().reclaim_pair(), (0, 0));
}