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

Function test_stats_from_file_ops

atomic-core/src/change/ops.rs:1111–1140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1109
1110 #[test]
1111 fn test_stats_from_file_ops() {
1112 let mut file1 =
1113 FileOps::create(test_trunk_id(), "new.txt".to_string(), Some(Encoding::Utf8));
1114 file1.add_line_op(LineOps::insert(
1115 test_branch_id(0),
1116 None,
1117 vec![
1118 LeafOp::Insert {
1119 after: None,
1120 kind: TokenKind::Word,
1121 content: b"Hello".to_vec(),
1122 },
1123 LeafOp::Insert {
1124 after: None,
1125 kind: TokenKind::Word,
1126 content: b"World".to_vec(),
1127 },
1128 ],
1129 ));
1130
1131 let file2 = FileOps::delete(TrunkId::new(NodeId::new(2), 0), "old.txt".to_string());
1132
1133 let stats = FileOpsStats::from_file_ops(&[file1, file2]);
1134
1135 assert_eq!(stats.files_created, 1);
1136 assert_eq!(stats.files_deleted, 1);
1137 assert_eq!(stats.lines_added, 1);
1138 assert_eq!(stats.tokens_added, 2);
1139 assert!(stats.has_changes());
1140 }
1141
1142 #[test]
1143 fn test_stats_display() {

Callers

nothing calls this directly

Calls 3

test_branch_idFunction · 0.85
test_trunk_idFunction · 0.70
add_line_opMethod · 0.45

Tested by

no test coverage detected