diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-07-18 16:11:24 +0200 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-07-18 16:11:24 +0200 |
| commit | 9197dd393cc519dbc10ad331ba5e57e21d5c21b6 (patch) | |
| tree | 8fa3e6351fd25b19656d32f11b1df12dc0ba03be /src/unit_tests.cc | |
| parent | 50fec8674970fa1c4e9c9590756a155aded7edb5 (diff) | |
More refactoring of the diff code in order to make it cleaner
Diffstat (limited to 'src/unit_tests.cc')
| -rw-r--r-- | src/unit_tests.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/unit_tests.cc b/src/unit_tests.cc index c2fe1fa6..54269074 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -22,14 +22,6 @@ UnitTest test_diff{[]() }; { - StringView s1 = "mais que fais la police"; - StringView s2 = "mais ou va la police"; - - auto diff = find_diff(s1.begin(), (int)s1.length(), s2.begin(), (int)s2.length()); - kak_assert(diff.size() == 11); - } - - { auto diff = find_diff("a?", 2, "!", 1); kak_assert(diff.size() == 3 and eq(diff[0], {Diff::Remove, 1, 0}) and @@ -38,10 +30,10 @@ UnitTest test_diff{[]() } { - auto diff = find_diff("abcd", 4, "c", 1); + auto diff = find_diff("abcde", 5, "cd", 2); kak_assert(diff.size() == 3 and eq(diff[0], {Diff::Remove, 2, 0}) and - eq(diff[1], {Diff::Keep, 1, 0}) and + eq(diff[1], {Diff::Keep, 2, 0}) and eq(diff[2], {Diff::Remove, 1, 0})); } @@ -52,6 +44,14 @@ UnitTest test_diff{[]() eq(diff[1], {Diff::Keep, 2, 0}) and eq(diff[2], {Diff::Add, 2, 2})); } + + { + StringView s1 = "mais que fais la police"; + StringView s2 = "mais ou va la police"; + + auto diff = find_diff(s1.begin(), (int)s1.length(), s2.begin(), (int)s2.length()); + kak_assert(diff.size() == 11); + } }}; UnitTest* UnitTest::list = nullptr; |
