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

Function test_lis_simple

atomic-core/src/diff/patience.rs:510–535  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

508 // LIS Tests
509 #[test]
510 fn test_lis_simple() {
511 let matches = vec![
512 UniqueMatch {
513 old_idx: 0,
514 new_idx: 0,
515 },
516 UniqueMatch {
517 old_idx: 1,
518 new_idx: 2,
519 },
520 UniqueMatch {
521 old_idx: 2,
522 new_idx: 1,
523 },
524 UniqueMatch {
525 old_idx: 3,
526 new_idx: 3,
527 },
528 ];
529
530 let lis = longest_increasing_subsequence(&matches);
531
532 // LIS by new_idx: 0 -> 2 -> 3 (indices 0, 1, 3) or 0 -> 1 -> 3 (indices 0, 2, 3)
533 // Both have length 3
534 assert_eq!(lis.len(), 3);
535 }
536
537 #[test]
538 fn test_lis_empty() {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected