Skip to content

Commit 2dca4a0

Browse files
committed
Create SolutionTest.kt
1 parent 99c6548 commit 2dca4a0

File tree

1 file changed

+21
-0
lines changed
  • test/com/github/masx200/leetcode_test/construct_binary_search_tree_from_preorder_traversal

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.github.masx200.leetcode_test.construct_binary_search_tree_from_preorder_traversal
2+
3+
4+
import com.github.masx200.leetcode_test.utils.TreeNodeLeetCodeStringify
5+
import kotlinx.serialization.encodeToString
6+
import kotlinx.serialization.json.Json
7+
import org.junit.jupiter.api.Assertions.assertEquals
8+
import org.junit.jupiter.api.Test
9+
10+
internal class SolutionTest {
11+
12+
@Test
13+
fun bstFromPreorder() {
14+
15+
assertEquals(
16+
listOf(intArrayOf(8, 5, 1, 7, 10, 12), intArrayOf(1, 3)).map { Solution().bstFromPreorder(it) }
17+
.map { TreeNodeLeetCodeStringify(it) },
18+
listOf(arrayOf(8, 5, 10, 1, 7, null, 12), arrayOf(1, null, 3)).map { Json.encodeToString(it) }
19+
)
20+
}
21+
}

0 commit comments

Comments
 (0)