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

Function test_inode_operations

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

Source from the content-addressed store, hash-verified

624
625 #[test]
626 fn test_inode_operations() {
627 let dir = tempdir().unwrap();
628 let db_path = dir.path().join("pristine");
629 let pristine = Pristine::open(&db_path).unwrap();
630
631 let mut txn = pristine.write_txn().unwrap();
632
633 let inode = txn.alloc_inode().unwrap();
634 let pos = Position::new(NodeId::new(42), ChangePosition::new(100));
635
636 txn.put_inode(inode, pos).unwrap();
637
638 assert_eq!(txn.inode_position(inode).unwrap(), Some(pos));
639 assert_eq!(txn.position_inode(pos).unwrap(), Some(inode));
640
641 let removed_pos = txn.del_inode(inode).unwrap();
642 assert_eq!(removed_pos, Some(pos));
643 assert_eq!(txn.inode_position(inode).unwrap(), None);
644
645 txn.commit().unwrap();
646 }
647
648 #[test]
649 fn test_abort_transaction() {

Callers

nothing calls this directly

Calls 7

write_txnMethod · 0.80
put_inodeMethod · 0.80
del_inodeMethod · 0.80
commitMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
alloc_inodeMethod · 0.45

Tested by

no test coverage detected