diff --git a/src/commonTest/kotlin/testMerge.kt b/src/commonTest/kotlin/testMerge.kt index d6d2548..7b9a253 100644 --- a/src/commonTest/kotlin/testMerge.kt +++ b/src/commonTest/kotlin/testMerge.kt @@ -1,4 +1,5 @@ import net.sergeych.merge3.MergeResult +import net.sergeych.merge3.MergedBlock import net.sergeych.merge3.merge3 import net.sergeych.mp_logger.Log import net.sergeych.sprintf.sprintf @@ -74,4 +75,30 @@ class BasicTest { println(m.changedAreas) assertEquals("Hello 123456", m.merged.str) } + + @Test + fun testMergeIndexes() { + Log.connectConsole() + val src = "Hello".toList() + val a = "123 Hello".toList() + val b = "456 Hello".toList() + + val m = merge3(src, b, a, true) + val unchanged = m.blocks.last() as MergedBlock.Unchanged + println(unchanged) + assertEquals(0, unchanged.referenceIndex) + } + + @Test + fun testMergeIndexes2() { + Log.connectConsole() + val src = "Hello".toList() + val a = "1Hello".toList() + val b = "2Hello".toList() + + val m = merge3(src, b, a, true) + val unchanged = m.blocks.last() as MergedBlock.Unchanged + println(unchanged) + assertEquals(0, unchanged.referenceIndex) + } } \ No newline at end of file