From 61ea85ac1b77f81229006254142132d39656b6f4 Mon Sep 17 00:00:00 2001 From: akkkihi Date: Fri, 12 May 2023 22:42:24 +0300 Subject: [PATCH] refactor and add mixed --- .../micro_utils/common/MapDiffUtilsTests.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/MapDiffUtilsTests.kt b/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/MapDiffUtilsTests.kt index 06643e7bd5a..6e111b5bb84 100644 --- a/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/MapDiffUtilsTests.kt +++ b/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/MapDiffUtilsTests.kt @@ -211,6 +211,24 @@ class MapDiffUtilsTests { ) } + @Test + @OptIn(Warning::class) + fun testMapDiffMixed() { + val originalMap = mutableMapOf("a" to 1, "b" to 2, "c" to 3) + val diff = MapDiff(mapOf("b" to 2), mapOf("c" to (3 to 5)), mapOf("d" to 4)) + + originalMap.remove("b") + // change value + originalMap["c"] = 5 + // add value + originalMap["d"] = 4 + + assertEquals( + mapOf("a" to 1, "c" to 5, "d" to 4), + originalMap + ) + } + @Test @OptIn(Warning::class) fun testApplyMapDiffMixed() {