@LeoColman Thanks for the reply. By
shouldContainExactly
, you mean
collections.shouldContainExactly
in
matchers, and in order to use this I would have to make the data structure be a subclass of Kotlin’s
Collection
, right?
Currently my usecase is simple, I’m just practicing Kotlin with problem solving via leetcode, and leetcode has some predefined data structure classes such as:
class ListNode(var `val`: Int) {
var next: ListNode? = null
}
Then I wanted to make custom functions for testing locally with kotest, where I have written a function like
fun linkedListOf(vararg elements: Int): ListNode
where it creates a singly linked list with a syntax like
linkedListOf(1, 2, 3)
and returns the head
ListNode
.