Skip to content

Commit 7166e00

Browse files
committed
Update SolutionTest.kt
1 parent 9c4f9b8 commit 7166e00

File tree

1 file changed

+13
-1
lines changed
  • test/com/github/masx200/leetcode_test/construct_binary_search_tree_from_preorder_traversal

1 file changed

+13
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
package com.github.masx200.leetcode_test.construct_binary_search_tree_from_preorder_traversal
22

3+
import com.cedarsoftware.util.DeepEquals.deepEquals
4+
import com.github.masx200.leetcode_test.utils.TreeNodeLeetCodeParse
35

46
import com.github.masx200.leetcode_test.utils.TreeNodeLeetCodeStringify
57
import kotlinx.serialization.encodeToString
68
import kotlinx.serialization.json.Json
79
import org.junit.jupiter.api.Assertions.assertEquals
810
import org.junit.jupiter.api.Test
11+
import kotlin.test.assertTrue
912

1013
internal class SolutionTest {
1114

1215
@Test
13-
fun bstFromPreorder() {
16+
fun testbstFromPreorder() {
1417

1518
assertEquals(
1619
listOf(intArrayOf(8, 5, 1, 7, 10, 12), intArrayOf(1, 3)).map { Solution().bstFromPreorder(it) }
1720
.map { TreeNodeLeetCodeStringify(it) },
1821
listOf(arrayOf(8, 5, 10, 1, 7, null, 12), arrayOf(1, null, 3)).map { Json.encodeToString(it) }
1922
)
23+
24+
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+
)
31+
)
2032
}
2133
}

0 commit comments

Comments
 (0)