forked from dkandalov/kotlin-99
-
Notifications
You must be signed in to change notification settings - Fork 1
/
P63.kt
31 lines (27 loc) · 921 Bytes
/
P63.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.kotlin99.binarytrees
import com.natpryce.hamkrest.assertion.assertThat
import org.junit.Test
import org.kotlin99.binarytrees.Tree.Node
fun <T> completeBinaryTree(nodeAmount: Int, value: T): Tree {
fun generate(nodeAddress: Int): Tree =
TODO()
return generate(1)
}
class P63Test {
@Test fun `construct complete binary tree`() {
// assertThat(completeBinaryTree(1, "x"), equalToTree(
// Node("x")
// ))
// assertThat(completeBinaryTree(2, "x"), equalToTree(
// Node("x", Node("x"))
// ))
// assertThat(completeBinaryTree(3, "x"), equalToTree(
// Node("x", Node("x"), Node("x"))
// ))
// assertThat(completeBinaryTree(6, "x"), equalToTree(
// Node("x",
// Node("x", Node("x"), Node("x")),
// Node("x", Node("x"), End))
// ))
}
}