Add 2 tests for merge indexes

This commit is contained in:
anzhu 2023-04-11 12:24:41 +03:00
parent 86d24c6a9a
commit ce3987d009

View File

@ -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)
}
}