MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_position_cache

Function test_position_cache

atomic-core/src/output/alive/retrieve/tests.rs:832–849  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

830
831#[test]
832fn test_position_cache() {
833 let mut cache: HashMap<Position<NodeId>, VertexId> = HashMap::new();
834
835 let pos1 = Position::new(NodeId::new(1), ChangePosition::new(0));
836 let pos2 = Position::new(NodeId::new(1), ChangePosition::new(100));
837 let pos3 = Position::new(NodeId::new(2), ChangePosition::new(0));
838
839 cache.insert(pos1, VertexId::new(1));
840 cache.insert(pos2, VertexId::new(2));
841 cache.insert(pos3, VertexId::new(3));
842
843 assert_eq!(cache.get(&pos1), Some(&VertexId::new(1)));
844 assert_eq!(cache.get(&pos2), Some(&VertexId::new(2)));
845 assert_eq!(cache.get(&pos3), Some(&VertexId::new(3)));
846
847 // Duplicate insertion returns same ID
848 assert!(cache.contains_key(&pos1));
849}
850
851#[test]
852fn test_position_cache_bottom() {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected