clean up code
This commit is contained in:
parent
53fd1f9caa
commit
1bd9799816
@ -22,7 +22,7 @@ dependencies {
|
||||
testImplementation(Config.Libs.junit)
|
||||
testImplementation(Config.Libs.kluent)
|
||||
testImplementation(Config.Libs.mockk)
|
||||
testImplementation (Config.Libs.jetbrainJunit)
|
||||
testImplementation(Config.Libs.jetbrainJunit)
|
||||
// testImplementation(Config.Libs.spekDsl)
|
||||
|
||||
testRuntimeOnly(Config.Libs.junitEngine)
|
||||
|
@ -25,7 +25,11 @@
|
||||
|
||||
package it.norangeb.algorithms.datastructures.dictionary
|
||||
|
||||
import arrow.core.*
|
||||
import arrow.core.getOrElse
|
||||
import arrow.core.None
|
||||
import arrow.core.Option
|
||||
import arrow.core.Some
|
||||
import arrow.core.toOption
|
||||
|
||||
class ImmutableBST<K : Comparable<K>, V> : OrderedDictionary<K, V> {
|
||||
private var root: Option<Node<K, V>> = None
|
||||
@ -47,7 +51,8 @@ class ImmutableBST<K : Comparable<K>, V> : OrderedDictionary<K, V> {
|
||||
|
||||
private fun set(
|
||||
node: Option<Node<K, V>>,
|
||||
key: K, value: V
|
||||
key: K,
|
||||
value: V
|
||||
): Option<Node<K, V>> = node.fold(
|
||||
{ Node(key, value) },
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class LinkedListBagTest {
|
||||
private lateinit var bag :LinkedListBag<Int>
|
||||
private lateinit var bag: LinkedListBag<Int>
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ResizingArrayBagTest {
|
||||
private lateinit var bag :ResizingArrayBag<Int>
|
||||
private lateinit var bag: ResizingArrayBag<Int>
|
||||
|
||||
@BeforeEach
|
||||
fun makeBag() {
|
||||
|
@ -32,7 +32,6 @@ import org.amshove.kluent.`should be`
|
||||
import org.amshove.kluent.shouldEqual
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
|
||||
class ImmutableBSTTest {
|
||||
|
||||
@Test
|
||||
@ -84,25 +83,25 @@ class ImmutableBSTTest {
|
||||
|
||||
orderedMap.size() `should be equal to` 9
|
||||
|
||||
//delete node with no child
|
||||
// delete node with no child
|
||||
orderedMap.delete(1)
|
||||
|
||||
orderedMap.size() `should be equal to` 8
|
||||
orderedMap.min() shouldEqual Some(2)
|
||||
|
||||
//delete node with only right child
|
||||
// delete node with only right child
|
||||
orderedMap.delete(2)
|
||||
|
||||
orderedMap.size() `should be equal to` 7
|
||||
orderedMap.min() shouldEqual Some(3)
|
||||
|
||||
//delete node with two child
|
||||
// delete node with two child
|
||||
orderedMap.delete(10)
|
||||
|
||||
orderedMap.size() `should be equal to` 6
|
||||
|
||||
orderedMap.delete(13)
|
||||
//delete node with only left child
|
||||
// delete node with only left child
|
||||
orderedMap.delete(11)
|
||||
|
||||
orderedMap.size() `should be equal to` 4
|
||||
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class LinkedListQueueTest {
|
||||
private lateinit var queue : LinkedListQueue<Int>
|
||||
private lateinit var queue: LinkedListQueue<Int>
|
||||
|
||||
@BeforeEach
|
||||
fun makeQueue() {
|
||||
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ResizingArrayQueueTest {
|
||||
private lateinit var queue : ResizingArrayQueue<Int>
|
||||
private lateinit var queue: ResizingArrayQueue<Int>
|
||||
|
||||
@BeforeEach
|
||||
fun makeQueue() {
|
||||
|
@ -32,7 +32,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class LinkedListStackTest {
|
||||
private lateinit var stack : LinkedListStack<Int>
|
||||
private lateinit var stack: LinkedListStack<Int>
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class QuickFindTest {
|
||||
private lateinit var unionFind : QuickFind
|
||||
private lateinit var unionFind: QuickFind
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class QuickUnionCompressionPathTest {
|
||||
private lateinit var unionFind : QuickUnion
|
||||
private lateinit var unionFind: QuickUnion
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class QuickUnionTest {
|
||||
private lateinit var unionFind : QuickUnion
|
||||
private lateinit var unionFind: QuickUnion
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class QuickUnionWithSizeTest {
|
||||
private lateinit var unionFind : QuickUnionWithSize
|
||||
private lateinit var unionFind: QuickUnionWithSize
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
|
Loading…
Reference in New Issue
Block a user