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

Function test_graph_operations

atomic-core/src/pristine/txn/write/tests.rs:290–315  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

288
289 #[test]
290 fn test_graph_operations() {
291 let dir = tempdir().unwrap();
292 let db_path = dir.path().join("pristine");
293 let pristine = Pristine::open(&db_path).unwrap();
294
295 let mut txn = pristine.write_txn().unwrap();
296
297 let node = GraphNode::from_parts(NodeId::new(1), 0, 100);
298 let dest = Position::new(NodeId::new(2), ChangePosition::new(0));
299 let edge = SerializedGraphEdge::new(EdgeFlags::BLOCK, dest, NodeId::new(1));
300
301 // Insert edge
302 txn.put_graph(node, edge).unwrap();
303
304 // Check it exists
305 assert!(txn.has_vertex(node).unwrap());
306
307 // Get edges
308 let edges = txn.get_edges(node).unwrap();
309 assert_eq!(edges.len(), 1);
310
311 // Delete edge
312 txn.del_graph(node, edge).unwrap();
313
314 txn.commit().unwrap();
315 }
316
317 #[test]
318 fn test_del_change() {

Callers

nothing calls this directly

Calls 7

write_txnMethod · 0.80
get_edgesMethod · 0.80
del_graphMethod · 0.80
commitMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
put_graphMethod · 0.45

Tested by

no test coverage detected