atMost

fun <E, T : Iterable<E>> Assert<T>.atMost(times: Int, f: (Assert<E>) -> Unit)

Asserts on each item in the iterable, passing if at most times items pass. The given lambda will be run for each item.

assert(listOf(-2, -1, 1)).atMost(2) { it.isPositive() }

fun <E, T : Sequence<E>> Assert<T>.atMost(times: Int, f: (Assert<E>) -> Unit)

Asserts on each item in the sequence, passing if at most times items pass. The given lambda will be run for each item.

assert(sequenceOf(-2, -1, 1)).atMost(2) { it.isPositive() }