| 368 | |
| 369 | #[test] |
| 370 | fn test_large_common_prefix() { |
| 371 | let mut old_strs: Vec<&str> = (0..100).map(|_| "same\n").collect(); |
| 372 | old_strs.push("old\n"); |
| 373 | |
| 374 | let mut new_strs: Vec<&str> = (0..100).map(|_| "same\n").collect(); |
| 375 | new_strs.push("new\n"); |
| 376 | |
| 377 | let old = lines(&old_strs); |
| 378 | let new = lines(&new_strs); |
| 379 | |
| 380 | let result = diff(&old, &new); |
| 381 | |
| 382 | // Only the last line differs |
| 383 | assert_eq!(result.edit_distance(), 2); // delete old, insert new |
| 384 | } |
| 385 | |
| 386 | #[test] |
| 387 | fn test_large_common_suffix() { |