Skip to content

Commit da27934

Browse files
committed
Update SolutionTest.kt
1 parent 2f191de commit da27934

File tree

1 file changed

+16
-12
lines changed
  • test/com/github/masx200/leetcode_test/construct_binary_search_tree_from_preorder_traversal

1 file changed

+16
-12
lines changed

test/com/github/masx200/leetcode_test/construct_binary_search_tree_from_preorder_traversal/SolutionTest.kt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,36 @@ package com.github.masx200.leetcode_test.construct_binary_search_tree_from_preor
22

33
import com.cedarsoftware.util.DeepEquals.deepEquals
44
import com.github.masx200.leetcode_test.utils.TreeNodeLeetCodeParse
5-
65
import com.github.masx200.leetcode_test.utils.TreeNodeLeetCodeStringify
6+
import kotlin.test.assertTrue
77
import kotlinx.serialization.encodeToString
88
import kotlinx.serialization.json.Json
99
import org.junit.jupiter.api.Assertions.assertEquals
1010
import org.junit.jupiter.api.Test
11-
import kotlin.test.assertTrue
1211

1312
internal class SolutionTest {
1413

1514
@Test
1615
fun testbstFromPreorder() {
1716

1817
assertEquals(
19-
listOf(intArrayOf(8, 5, 1, 7, 10, 12), intArrayOf(1, 3)).map { Solution().bstFromPreorder(it) }
20-
.map { TreeNodeLeetCodeStringify(it) },
21-
listOf(arrayOf(8, 5, 10, 1, 7, null, 12), arrayOf(1, null, 3)).map { Json.encodeToString(it) }
18+
listOf(intArrayOf(8, 5, 1, 7, 10, 12), intArrayOf(1, 3))
19+
.map { Solution().bstFromPreorder(it) }
20+
.map { TreeNodeLeetCodeStringify(it) },
21+
listOf(arrayOf(8, 5, 10, 1, 7, null, 12), arrayOf(1, null, 3)).map {
22+
Json.encodeToString(it)
23+
}
2224
)
2325

2426
assertTrue(
25-
deepEquals(
26-
listOf(intArrayOf(8, 5, 1, 7, 10, 12), intArrayOf(1, 3)).map { Solution().bstFromPreorder(it) },
27-
listOf(arrayOf(8, 5, 10, 1, 7, null, 12), arrayOf(1, null, 3)).map { Json.encodeToString(it) }
28-
.map { TreeNodeLeetCodeParse(it) }
29-
30-
)
27+
deepEquals(
28+
listOf(intArrayOf(8, 5, 1, 7, 10, 12), intArrayOf(1, 3)).map {
29+
Solution().bstFromPreorder(it)
30+
},
31+
listOf("[8, 5, 10, 1, 7, null, 12]", "[1, null, 3]").map {
32+
TreeNodeLeetCodeParse(it)
33+
}
34+
)
3135
)
3236
}
33-
}
37+
}

0 commit comments

Comments
 (0)