diff --git a/src/commonTest/kotlin/io/github/petertrr/diffutils/DiffUtilsTest.kt b/src/commonTest/kotlin/io/github/petertrr/diffutils/DiffUtilsTest.kt index 5b3350d..d6e45b0 100644 --- a/src/commonTest/kotlin/io/github/petertrr/diffutils/DiffUtilsTest.kt +++ b/src/commonTest/kotlin/io/github/petertrr/diffutils/DiffUtilsTest.kt @@ -18,16 +18,10 @@ */ package io.github.petertrr.diffutils -import io.github.petertrr.diffutils.patch.ChangeDelta -import io.github.petertrr.diffutils.patch.Chunk -import io.github.petertrr.diffutils.patch.DeleteDelta -import io.github.petertrr.diffutils.patch.EqualDelta -import io.github.petertrr.diffutils.patch.InsertDelta -import io.github.petertrr.diffutils.patch.Patch +import io.github.petertrr.diffutils.patch.* import io.github.petertrr.diffutils.utils.changeDeltaOf import io.github.petertrr.diffutils.utils.deleteDeltaOf import io.github.petertrr.diffutils.utils.insertDeltaOf - import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -128,7 +122,7 @@ class DiffUtilsTest { val patch: Patch = diff(original, revised) assertEquals(1, patch.deltas.size) assertEquals( - changeDeltaOf(1, listOf("line2", "line3"),1, listOf("line2-2", "line4")), + changeDeltaOf(1, listOf("line2", "line3"), 1, listOf("line2-2", "line4")), patch.deltas[0] ) } @@ -148,8 +142,9 @@ class DiffUtilsTest { @Test fun testDiff_Equal() { val patch: Patch = diff( - listOf("hhh", "jjj", "kkk"), - listOf("hhh", "jjj", "kkk"), true + source = listOf("hhh", "jjj", "kkk"), + target = listOf("hhh", "jjj", "kkk"), + includeEqualParts = true, ) assertNotNull(patch) assertEquals(1, patch.deltas.size) @@ -161,7 +156,11 @@ class DiffUtilsTest { @Test fun testDiff_InsertWithEqual() { - val patch: Patch = diff(listOf("hhh"), listOf("hhh", "jjj", "kkk"), true) + val patch: Patch = diff( + source = listOf("hhh"), + target = listOf("hhh", "jjj", "kkk"), + includeEqualParts = true, + ) assertNotNull(patch) assertEquals(2, patch.deltas.size) var delta = patch.deltas[0] @@ -177,8 +176,9 @@ class DiffUtilsTest { @Test fun testDiff_ProblemIssue42() { val patch: Patch = diff( - listOf("The", "dog", "is", "brown"), - listOf("The", "fox", "is", "down"), true + source = listOf("The", "dog", "is", "brown"), + target = listOf("The", "fox", "is", "down"), + includeEqualParts = true, ) println(patch) assertNotNull(patch) diff --git a/src/commonTest/kotlin/io/github/petertrr/diffutils/algorithm/myers/MyersDiffTest.kt b/src/commonTest/kotlin/io/github/petertrr/diffutils/algorithm/myers/MyersDiffTest.kt index dcb19d2..77b6216 100644 --- a/src/commonTest/kotlin/io/github/petertrr/diffutils/algorithm/myers/MyersDiffTest.kt +++ b/src/commonTest/kotlin/io/github/petertrr/diffutils/algorithm/myers/MyersDiffTest.kt @@ -31,7 +31,7 @@ class MyersDiffTest { fun testDiffMyersExample1Forward() { val original: List = listOf("A", "B", "C", "A", "B", "B", "A") val revised: List = listOf("C", "B", "A", "B", "A", "C") - val patch: Patch = Patch.generate(original, revised, MyersDiff().computeDiff(original, revised, null)) + val patch: Patch = Patch.generate(original, revised, MyersDiff().computeDiff(original, revised)) assertNotNull(patch) assertEquals(4, patch.deltas.size) assertEquals(