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

Function test_lcs_computation

atomic-core/src/diff/myers.rs:404–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402
403 #[test]
404 fn test_lcs_computation() {
405 let old = lines(&["a\n", "b\n", "c\n", "d\n"]);
406 let new = lines(&["a\n", "c\n", "d\n"]);
407
408 let lcs = compute_lcs(&old, &new);
409
410 // LCS should be a, c, d (3 elements)
411 assert_eq!(lcs.len(), 3);
412 assert_eq!(lcs[0].old_idx, 0);
413 assert_eq!(lcs[0].new_idx, 0);
414 assert_eq!(lcs[1].old_idx, 2);
415 assert_eq!(lcs[1].new_idx, 1);
416 assert_eq!(lcs[2].old_idx, 3);
417 assert_eq!(lcs[2].new_idx, 2);
418 }
419}

Callers

nothing calls this directly

Calls 2

compute_lcsFunction · 0.85
linesFunction · 0.70

Tested by

no test coverage detected