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

commonMain.io.kotest.matchers.longs.between.kt Maven / Gradle / Ivy

package io.kotest.matchers.longs

import io.kotest.matchers.Matcher
import io.kotest.matchers.MatcherResult
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNot

/**
 * Verifies that the given Long is between a and b inclusive.
 */
fun Long.shouldBeBetween(a: Long, b: Long) = this shouldBe between(a, b)

/**
 * Verifies that the given Long is NOT between a and b inclusive.
 */
fun Long.shouldNotBeBetween(a: Long, b: Long) = this shouldNot between(a, b)

/**
 * Verifies that the given Long is between a and b inclusive.
 */
fun between(a: Long, b: Long): Matcher = object : Matcher {
   override fun test(value: Long) = MatcherResult(value in a..b,
      "$value should be between ($a, $b)",
      "$value should not be between ($a, $b)")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy