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

commonMain.io.kotest.matchers.collections.larger.kt Maven / Gradle / Ivy

package io.kotest.matchers.collections

import io.kotest.matchers.Matcher
import io.kotest.matchers.MatcherResult
import io.kotest.matchers.should

infix fun  Iterable.shouldBeLargerThan(other: Collection): Iterable {
   toList().shouldBeLargerThan(other)
   return this
}

infix fun  Iterable.shouldBeLargerThan(other: Iterable): Iterable {
   toList().shouldBeLargerThan(other.toList())
   return this
}

infix fun  Array.shouldBeLargerThan(other: Collection): Array {
   asList().shouldBeLargerThan(other)
   return this
}

infix fun  Array.shouldBeLargerThan(other: Array): Array {
   asList().shouldBeLargerThan(other.asList())
   return this
}

infix fun  Collection.shouldBeLargerThan(other: Collection): Collection {
   this should beLargerThan(other)
   return this
}

fun  beLargerThan(other: Collection) = object : Matcher> {
   override fun test(value: Collection) = MatcherResult(
      value.size > other.size,
      { "Collection of size ${value.size} should be larger than collection of size ${other.size}" },
      {
         "Collection of size ${value.size} should not be larger than collection of size ${other.size}"
      })
}