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

Function test_inode_allocation

atomic-core/tests/crdt_integration_test.rs:737–760  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

735/// Test inode allocation works correctly.
736#[test]
737fn test_inode_allocation() {
738 let change_id = NodeId::new(1);
739
740 let mut txn = MockCrdtTxn::new();
741 let mut ctx = ApplyContext::new(ApplyOptions::default());
742
743 // Create multiple files and verify unique inodes
744 for i in 0..5 {
745 let trunk_id = TrunkId::new(change_id, i);
746 let create_op = TrunkOp::Create {
747 path: format!("file{}.rs", i),
748 encoding: Some(Encoding::Utf8),
749 };
750 apply_trunk_op(&mut txn, &mut ctx, trunk_id, &create_op).unwrap();
751 }
752
753 // Verify all files have unique inodes
754 let mut inodes = std::collections::HashSet::new();
755 for i in 0..5 {
756 let trunk_id = TrunkId::new(change_id, i);
757 let trunk = txn.get_trunk(trunk_id).unwrap().unwrap();
758 assert!(inodes.insert(trunk.inode()), "Duplicate inode detected!");
759 }
760}
761
762/// Test full workflow: multiple files, lines, and tokens.
763#[test]

Callers

nothing calls this directly

Calls 3

apply_trunk_opFunction · 0.50
unwrapMethod · 0.45
get_trunkMethod · 0.45

Tested by

no test coverage detected