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

commonMain.io.kotest.properties.PropertyTestingVerifyNone.kt Maven / Gradle / Ivy

package io.kotest.properties

import io.kotest.assertions.failure

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(noinline fn: PropertyContext.(a: A) -> Boolean) = verifyNone(1000, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(iterations: Int, noinline fn: PropertyContext.(a: A) -> Boolean) {
  verifyNone(iterations, Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(gena: Gen, fn: PropertyContext.(a: A) -> Boolean) = verifyNone(1000, gena, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  Gen.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A) -> Boolean) = verifyNone(iterations, this, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  Gen.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A) -> Boolean) = verifyNone(iterations, this, this, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  Gen.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Boolean) = verifyNone(iterations, this, this, this, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  Gen.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Boolean) = verifyNone(iterations, this, this, this, this, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  Gen.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Boolean) = verifyNone(iterations, this, this, this, this, this, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  Gen.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Boolean) = verifyNone(iterations, this, this, this, this, this, this, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(iterations: Int, gena: Gen, fn: PropertyContext.(a: A) -> Boolean) {
  if (iterations <= 0) throw IllegalArgumentException("Iterations should be a positive number")
  val context = PropertyContext()
  fun test(a: A) {
    context.inc()
    val passed = context.fn(a)
    if (passed) {
      throw failure("Property passed for\n$a\nafter ${context.attempts()} attempts")
    }
  }
  for (a in gena.constants()) {
    test(a)
  }
  val avalues = gena.random().iterator()
  while (context.attempts() < iterations) {
    val a = avalues.next()
    test(a)
  }
  outputClassifications(context)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(noinline fn: PropertyContext.(a: A, b: B) -> Boolean) {
  verifyNone(Gen.default(), Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(iterations: Int, noinline fn: PropertyContext.(a: A, b: B) -> Boolean) {
  verifyNone(iterations, Gen.default(), Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(gena: Gen, genb: Gen, fn: PropertyContext.(a: A, b: B) -> Boolean) = verifyNone(1000, gena, genb, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(iterations: Int, gena: Gen, genb: Gen, fn: PropertyContext.(a: A, b: B) -> Boolean) {
  val context = PropertyContext()
  fun test(a: A, b: B) {
    context.inc()
    val passed = context.fn(a, b)
    if (passed) {
      throw failure("Property passed for\n$a\n$b\nafter ${context.attempts()} attempts")
    }
  }
  for (a in gena.constants()) {
    for (b in genb.constants()) {
      test(a, b)
    }
  }
  val avalues = gena.random().iterator()
  val bvalues = genb.random().iterator()
  while (context.attempts() < iterations) {
    val a = avalues.next()
    val b = bvalues.next()
    test(a, b)
  }
  outputClassifications(context)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(noinline fn: PropertyContext.(a: A, b: B, c: C) -> Boolean) {
  verifyNone(1000, fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(iterations: Int, noinline fn: PropertyContext.(a: A, b: B, c: C) -> Boolean) {
  verifyNone(iterations, Gen.default(), Gen.default(), Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(gena: Gen, genb: Gen, genc: Gen, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean) =
    verifyNone(1000, gena, genb, genc, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(iterations: Int, gena: Gen, genb: Gen, genc: Gen, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean) {
  if (iterations <= 0) throw IllegalArgumentException("Iterations should be a positive number")
  val context = PropertyContext()
  for (a in gena.constants()) {
    for (b in genb.constants()) {
      for (c in genc.constants()) {
        context.inc()
        val passed = context.fn(a, b, c)
        if (passed) {
          throw failure("Property passed for\n$a\n$b\n$c\nafter ${context.attempts()} attempts")
        }
      }
    }
  }
  val avalues = gena.random().iterator()
  val bvalues = genb.random().iterator()
  val cvalues = genc.random().iterator()
  while (context.attempts() < iterations) {
    val a = avalues.next()
    val b = bvalues.next()
    val c = cvalues.next()
    context.inc()
    val passed = context.fn(a, b, c)
    if (passed) {
      throw failure("Property passed for\n$a\n$b\n$c\nafter ${context.attempts()} attempts")
    }
  }
  outputClassifications(context)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(noinline fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean) {
  verifyNone(1000, fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(iterations: Int, noinline fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean) {
  verifyNone(iterations, Gen.default(), Gen.default(), Gen.default(), Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(gena: Gen, genb: Gen, genc: Gen, gend: Gen, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean) =
    verifyNone(1000, gena, genb, genc, gend, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(iterations: Int, gena: Gen, genb: Gen, genc: Gen, gend: Gen, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean) {
  val context = PropertyContext()
  fun test(a: A, b: B, c: C, d: D) {
    context.inc()
    val passed = context.fn(a, b, c, d)
    if (passed) {
      throw failure("Property passed for\n$a\n$b\n$c\n$d\nafter ${context.attempts()} attempts")
    }
  }
  for (a in gena.constants()) {
    for (b in genb.constants()) {
      for (c in genc.constants()) {
        for (d in gend.constants()) {
          test(a, b, c, d)
        }
      }
    }
  }
  val avalues = gena.random().iterator()
  val bvalues = genb.random().iterator()
  val cvalues = genc.random().iterator()
  val dvalues = gend.random().iterator()
  while (context.attempts() < iterations) {
    test(avalues.next(), bvalues.next(), cvalues.next(), dvalues.next())
  }
  outputClassifications(context)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(noinline fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean) =
    verifyNone(1000, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(iterations: Int, noinline fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean) {
  verifyNone(iterations, Gen.default(), Gen.default(), Gen.default(), Gen.default(), Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(gena: Gen, genb: Gen, genc: Gen, gend: Gen, gene: Gen, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean) =
    verifyNone(1000, gena, genb, genc, gend, gene, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(iterations: Int, gena: Gen, genb: Gen, genc: Gen, gend: Gen, gene: Gen, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean) {
  if (iterations <= 0) throw IllegalArgumentException("Iterations should be a positive number")
  val context = PropertyContext()
  fun test(a: A, b: B, c: C, d: D, e: E) {
    context.inc()
    val passed = context.fn(a, b, c, d, e)
    if (passed) {
      throw failure("Property passed for\n$a\n$b\n$c\n$d\n$e\nafter ${context.attempts()} attempts")
    }
  }
  for (a in gena.constants()) {
    for (b in genb.constants()) {
      for (c in genc.constants()) {
        for (d in gend.constants()) {
          for (e in gene.constants()) {
            test(a, b, c, d, e)
          }
        }
      }
    }
  }
  val avalues = gena.random().iterator()
  val bvalues = genb.random().iterator()
  val cvalues = genc.random().iterator()
  val dvalues = gend.random().iterator()
  val evalues = gene.random().iterator()
  while (context.attempts() < iterations) {
    val a = avalues.next()
    val b = bvalues.next()
    val c = cvalues.next()
    val d = dvalues.next()
    val e = evalues.next()
    test(a, b, c, d, e)
  }
  outputClassifications(context)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(noinline fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean) {
  verifyNone(1000, fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
inline fun  verifyNone(iterations: Int, noinline fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean) {
  verifyNone(iterations, Gen.default(), Gen.default(), Gen.default(), Gen.default(), Gen.default(), Gen.default(), fn)
}

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(gena: Gen, genb: Gen, genc: Gen, gend: Gen, gene: Gen, genf: Gen, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean) =
    verifyNone(1000, gena, genb, genc, gend, gene, genf, fn)

@Deprecated("Deprecated and will be removed in 5.0. Migrate to the new property test classes in 4.0")
fun  verifyNone(iterations: Int, gena: Gen, genb: Gen, genc: Gen, gend: Gen, gene: Gen, genf: Gen, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean) {
  if (iterations <= 0) throw IllegalArgumentException("Iterations should be a positive number")

  val context = PropertyContext()

  fun test(a: A, b: B, c: C, d: D, e: E, f: F) {
    context.inc()
    val passed = context.fn(a, b, c, d, e, f)
    if (passed) {
      throw failure("Property passed for\n$a\n$b\n$c\n$d\n$e\n$f\nafter ${context.attempts()} attempts")
    }
  }

  for (a in gena.constants()) {
    for (b in genb.constants()) {
      for (c in genc.constants()) {
        for (d in gend.constants()) {
          for (e in gene.constants()) {
            for (f in genf.constants()) {
              test(a, b, c, d, e, f)
            }
          }
        }
      }
    }
  }
  val avalues = gena.random().iterator()
  val bvalues = genb.random().iterator()
  val cvalues = genc.random().iterator()
  val dvalues = gend.random().iterator()
  val evalues = gene.random().iterator()
  val fvalues = genf.random().iterator()
  while (context.attempts() < iterations) {
    val a = avalues.next()
    val b = bvalues.next()
    val c = cvalues.next()
    val d = dvalues.next()
    val e = evalues.next()
    val f = fvalues.next()
    test(a, b, c, d, e, f)
  }
  outputClassifications(context)
}