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

Function test_full_pipeline

atomic-core/src/change/format_v3/chunking.rs:1187–1218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1185
1186 #[test]
1187 fn test_full_pipeline() {
1188 // Simulate a realistic scenario: source code content
1189 let mut data = Vec::new();
1190 for i in 0..5000 {
1191 let line = format!(
1192 "/// Documentation for function {}\nfn func_{}(x: i32) -> i32 {{ x + {} }}\n\n",
1193 i,
1194 i,
1195 i * 7
1196 );
1197 data.extend_from_slice(line.as_bytes());
1198 }
1199
1200 // Chunk
1201 let (chunks, chunk_stats) = chunk_content_with_stats(&data, &ChunkingOptions::default());
1202 assert!(chunk_stats.chunk_count >= 1);
1203 assert_eq!(chunk_stats.total_input_bytes, data.len());
1204
1205 // Compress in parallel
1206 let (compressed, comp_stats) = compress_chunks_parallel_with_stats(&data, &chunks, 3);
1207 assert_eq!(comp_stats.chunk_count, chunks.len());
1208 assert!(comp_stats.total_compressed < comp_stats.total_uncompressed);
1209
1210 // Decompress and reassemble
1211 let mut reassembled = Vec::with_capacity(data.len());
1212 for cc in &compressed {
1213 let decompressed = zstd::decode_all(&cc.compressed_data[..]).unwrap();
1214 reassembled.extend_from_slice(&decompressed);
1215 }
1216
1217 assert_eq!(reassembled, data, "reassembled data should match original");
1218 }
1219
1220 #[test]
1221 fn test_full_pipeline_with_different_compression_levels() {

Callers

nothing calls this directly

Calls 5

chunk_content_with_statsFunction · 0.85
as_bytesMethod · 0.45
lenMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected