All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmTest.TestPriorityQueue.kt Maven / Gradle / Ivy

There is a newer version: 0.4.5-alpha6
Show newest version

import io.kotest.matchers.ints.shouldBeExactly
import java.util.*
import kotlin.Comparator
import org.openrndr.kartifex.graphs.PriorityQueue as KPriorityQueue
import kotlin.test.Test

class TestPriorityQueue {
    @Test
    fun testBasic() {
        val kpr = KPriorityQueue(Comparator { x,y -> x.compareTo(y) })
        kpr.add(10)
        kpr.add(0)
        val result = kpr.poll()
        result!!.shouldBeExactly(0)

        val pr = PriorityQueue(Comparator { x,y -> x.compareTo(y) })
        pr.add(10)
        pr.add(0)
        pr.poll()!!.shouldBeExactly(0)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy