clean up code

This commit is contained in:
Raffaele Mignone 2019-04-30 19:55:04 +02:00
parent 53fd1f9caa
commit 1bd9799816
Signed by: norangebit
GPG Key ID: F5255658CB220573
12 changed files with 25 additions and 21 deletions

View File

@ -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)

View File

@ -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) },
{

View File

@ -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() {

View File

@ -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() {

View File

@ -32,7 +32,6 @@ import org.amshove.kluent.`should be`
import org.amshove.kluent.shouldEqual
import org.junit.jupiter.api.Test
class ImmutableBSTTest {
@Test
@ -42,8 +41,8 @@ class ImmutableBSTTest {
orderedMap.isEmpty() `should be` true
orderedMap.size() `should be equal to` 0
orderedMap.contains("UNO") `should be` false
orderedMap.max() shouldEqual None
orderedMap.min() shouldEqual None
orderedMap.max() shouldEqual None
orderedMap.min() shouldEqual None
orderedMap["QUATTRO"] = 4
orderedMap["UNO"] = 0
@ -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)
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)
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

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {