| 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() { |