diff options
author | Dan Davison <dandavison7@gmail.com> | 2019-08-04 15:43:21 -0700 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2019-08-06 23:45:04 -0700 |
commit | fc9041d5368a071a188f43f05c47c82b6c0ca385 (patch) | |
tree | e4c8e83ed352d9199f1072f3d5fd246335c4fee8 /src/align.rs | |
parent | fd2fba3c8a06c796509b5d854cbb111b8eeb69ef (diff) |
Update tests
- Fix tests
- Reproduce bug: short string vs long
Diffstat (limited to 'src/align.rs')
-rw-r--r-- | src/align.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/align.rs b/src/align.rs index 198a37aa..a49ebb01 100644 --- a/src/align.rs +++ b/src/align.rs @@ -130,7 +130,7 @@ impl<'a> Alignment<'a> { (numer as f64) / (denom as f64) } - fn distance_parts(&self) -> (usize, usize) { + pub fn distance_parts(&self) -> (usize, usize) { let noop = 0; let (mut numer, mut denom) = (0, 0); for (op, (_, s)) in self.edit_operations(0, 1, 1, 1, true) { @@ -221,6 +221,16 @@ mod tests { ); } + #[test] + fn test_3() { + let (before, after) = ("aaabbb", "bbbbbb"); + // assert_string_distance_parts(before, after, (6, 6)); + assert_eq!( + edit_operations(before, after), + vec![Deletion, Deletion, Deletion, NoOp, NoOp, NoOp, Insertion, Insertion, Insertion,] + ); + } + fn assert_string_distance_parts(s1: &str, s2: &str, parts: (usize, usize)) { let (numer, _) = parts; assert_string_levenshtein_distance(s1, s2, numer); |