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

Function test_graph_operations

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

Source from the content-addressed store, hash-verified

401
402 #[test]
403 fn test_graph_operations() {
404 let dir = tempdir().unwrap();
405 let db_path = dir.path().join("pristine");
406 let pristine = Pristine::open(&db_path).unwrap();
407
408 let mut txn = pristine.write_txn().unwrap();
409
410 let node = GraphNode::from_parts(NodeId::new(1), 0, 100);
411 let dest = Position::new(NodeId::new(2), ChangePosition::new(0));
412 let edge = SerializedGraphEdge::new(EdgeFlags::BLOCK, dest, NodeId::new(1));
413
414 // Insert edge
415 txn.put_graph(node, edge).unwrap();
416
417 // Check it exists
418 assert!(txn.has_vertex(node).unwrap());
419
420 // Get edges
421 let edges = txn.get_edges(node).unwrap();
422 assert_eq!(edges.len(), 1);
423
424 // Delete edge
425 txn.del_graph(node, edge).unwrap();
426
427 txn.commit().unwrap();
428 }
429
430 #[test]
431 fn test_del_change() {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected