How to use bounds class of io.kotest.matchers.collections package

Best Kotest code snippet using io.kotest.matchers.collections.bounds

PersistentListTest.kt

Source:PersistentListTest.kt Github

copy

Full Screen

...290 for ((index, value) in ints.withIndex()) {291 list[index] shouldBeExactly value292 }293 }294 """when index is out of bounds, it should throw295 IndexOutOfBoundsException in constant-time""" {296 val index1 = 10297 val index2 = -5298 val e1 = shouldThrowExactly<IndexOutOfBoundsException> {299 list[index1]300 }301 val e2 = shouldThrowExactly<IndexOutOfBoundsException> {302 list[index2]303 }304 e1.message shouldBe "index = $index1"305 e2.message shouldBe "index = $index2"306 }307 }308 "iterator()" {309 val list: PersistentList<Int> = Cons(1, Empty)310 val seqIter = list.iterator() as SeqIterator311 seqIter.next shouldBe list312 seqIter.next shouldBeSameInstanceAs list313 }314 "lastIndexOf(element)" - {315 val list = PersistentList(1, 1, 6, 6, 4, 5, 4)316 "when the element is not in the list, it should return -1" {317 list.lastIndexOf(10) shouldBeExactly -1318 Empty.lastIndexOf(10) shouldBeExactly -1319 }320 """|when the element is in the list,321 |it should return the index of the last occurrence322 |of the specified element323 """ {324 list.lastIndexOf(6) shouldBeExactly 3325 list.lastIndexOf(1) shouldBeExactly 1326 list.lastIndexOf(4) shouldBeExactly 6327 }328 }329 "listIterator()" {330 val list = PersistentList(1, 2, 3)331 val expected = list.toList().listIterator()332 val listIterator = list.listIterator()333 shouldThrowExactly<NoSuchElementException> {334 listIterator.previous()335 }336 listIterator.next() shouldBe expected.next()337 listIterator.next() shouldBe expected.next()338 listIterator.next() shouldBe expected.next()339 listIterator.hasNext() shouldBe expected.hasNext()340 listIterator.hasPrevious() shouldBe expected.hasPrevious()341 listIterator.nextIndex() shouldBe expected.nextIndex()342 listIterator.previousIndex() shouldBe expected.previousIndex()343 shouldThrowExactly<NoSuchElementException> {344 listIterator.next()345 }346 }347 "listIterator(index)" - {348 val list = PersistentList(1, 2, 3)349 "when index is valid, it should return a list iterator" {350 val index = 1351 val expect = list.toList().listIterator(index)352 val listIterator = list.listIterator(index)353 listIterator.previous() shouldBe expect.previous()354 listIterator.next() shouldBe expect.next()355 listIterator.next() shouldBe expect.next()356 listIterator.next() shouldBe expect.next()357 listIterator.hasNext() shouldBe expect.hasNext()358 listIterator.hasPrevious() shouldBe expect.hasPrevious()359 listIterator.nextIndex() shouldBe expect.nextIndex()360 listIterator.previousIndex() shouldBe expect.previousIndex()361 shouldThrowExactly<NoSuchElementException> {362 listIterator.next()363 }364 }365 "when index is out of bounds, it should throw" {366 shouldThrowExactly<IndexOutOfBoundsException> {367 list.listIterator(4)368 }369 }370 }371 "subList(start, end)" - {372 val list = PersistentList(1, 2, 3, 4)373 "when passing valid indices, it returns a sublist of this" {374 val expectedSub = listOf(2, 3)375 val sublist = list.subList(1, 3)376 sublist.size shouldBe 2377 sublist shouldBe expectedSub378 }379 "when passing out of bounds indices, it should throw" {380 shouldThrowExactly<IndexOutOfBoundsException> {381 list.subList(-1, 3)382 }383 shouldThrowExactly<IndexOutOfBoundsException> {384 list.subList(1, 6)385 }386 shouldThrowExactly<IndexOutOfBoundsException> {387 list.subList(-1, 6)388 }389 }390 }391 }392 }393 "l(args)" - {...

Full Screen

Full Screen

HistogramTests.kt

Source:HistogramTests.kt Github

copy

Full Screen

...82 "order" to listOf(83 mapOf("_count" to "desc"),84 mapOf("stats.std_deviation" to "asc")85 ),86 "extended_bounds" to mapOf(87 "min" to -10.0F,88 "max" to 110.0F,89 ),90 "hard_bounds" to mapOf(91 "min" to 10.0F,92 "max" to 90.0F,93 ),94 ),95 "aggs" to mapOf(96 "stats" to mapOf(97 "extended_stats" to mapOf(98 "field" to "rating"99 )100 )101 )102 )103 }104 }105 @Test106 fun dateHistogram() {107 DateHistogramAgg(108 MovieDoc.releaseDate,109 interval = DateHistogramAgg.Interval.Calendar(CalendarInterval.YEAR),110 offset = FixedInterval.Minutes(1),111 minDocCount = 1,112 missing = LocalDate(1970, 1, 1),113 format = "YYYY",114 order = listOf(BucketsOrder("_count", Sort.Order.DESC)),115 extendedBounds = HistogramBounds.to(LocalDate(2030, 1, 1)),116 hardBounds = HistogramBounds.from(LocalDate(2000, 1, 1)),117 ).let { agg ->118 agg.compile() shouldContainExactly mapOf(119 "date_histogram" to mapOf(120 "field" to "release_date",121 "calendar_interval" to "year",122 "offset" to "1m",123 "min_doc_count" to 1L,124 "missing" to "1970-01-01",125 "format" to "YYYY",126 "order" to mapOf(127 "_count" to "desc"128 ),129 "extended_bounds" to mapOf(130 "max" to "2030-01-01",131 ),132 "hard_bounds" to mapOf(133 "min" to "2000-01-01",134 )135 )136 )137 shouldThrow<IllegalStateException> {138 process(agg, emptyMap())139 }140 process(141 agg,142 mapOf(143 "buckets" to listOf(144 mapOf(145 "key" to 1388534460000L,146 "key_as_string" to "2014",...

Full Screen

Full Screen

EvolutionaryExtensionsTest.kt

Source:EvolutionaryExtensionsTest.kt Github

copy

Full Screen

1package pl.edu.agh.kemo.tools2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.core.spec.style.StringSpec4import io.kotest.inspectors.forAll5import io.kotest.matchers.collections.shouldContainAll6import io.kotest.matchers.collections.shouldHaveSize7import io.kotest.matchers.doubles.plusOrMinus8import io.kotest.matchers.shouldBe9import io.kotest.matchers.shouldNotBe10import org.moeaframework.analysis.collector.Accumulator11import org.moeaframework.core.Population12import org.moeaframework.core.Solution13import org.moeaframework.core.variable.RealVariable14import java.lang.IndexOutOfBoundsException15class EvolutionaryExtensionsTest : StringSpec({16 "choose random elements from a list" {17 // given18 val elements = listOf(1, 2, 3, 4, 5)19 // when20 val sampled = elements.sample(3)21 // then22 println(sampled)23 sampled.size shouldBe 324 elements shouldContainAll sampled25 }26 "attempt to sample more elements than size of a a list should end with an error" {27 // given28 val elements = listOf(1, 2, 3, 4, 5)29 // when list is sampled with more than 5 elements30 // then31 shouldThrow<IndexOutOfBoundsException> { elements.sample(10) }32 }33 "calculate mean value of population" {34 // given35 val lowerBound = 0.036 val upperBound = 7.037 val solution1 = createSolution(listOf(1.0, 2.0, 3.0), lowerBound, upperBound)38 val solution2 = createSolution(listOf(4.0, 5.0, 6.0), lowerBound, upperBound)39 val population = Population(listOf(solution1, solution2))40 // when41 val meanSolution = population.average()42 // then43 meanSolution shouldNotBe null44 meanSolution?.shouldHaveSize(3)45 meanSolution?.get(0)?.value shouldBe 2.546 meanSolution?.get(1)?.value shouldBe 3.547 meanSolution?.get(2)?.value shouldBe 4.548 meanSolution?.forAll {49 it.lowerBound shouldBe lowerBound50 it.upperBound shouldBe upperBound51 }52 }53 "redundant variables check (with respect to min distance" {54 // given55 val lowerBound = 0.056 val upperBound = 7.057 val variables1 = createVariables(listOf(1.0, 2.0, 3.0), lowerBound, upperBound)58 val variables2 = createVariables(listOf(4.0, 5.0, 6.0), lowerBound, upperBound)59 // when distance is ~5.196160 val notRedundantDistance = variables1.redundant(variables2, 5.0)61 val redundantDistance = variables1.redundant(variables2, 5.2)62 // then63 notRedundantDistance shouldBe false64 redundantDistance shouldBe true65 }66 "mean Accumulator value is calculated correctly (preserving min NFE metric)" {67 // given68 val accumulator1 =69 createAccumulator(70 mapOf(71 "Hypervolume" to listOf(1.0, 2.0, 3.0, 4.0),72 "IGD" to listOf(4.0, 5.0, 6.0),73 "NFE" to listOf(1001.0, 2000.0, 3002.0)74 )75 )76 val accumulator2 =77 createAccumulator(78 mapOf(79 "Hypervolume" to listOf(4.0, 5.0, 6.0),80 "IGD" to listOf(7.0, 8.0, 10.0),81 "NFE" to listOf(1000.0, 2005.0, 3000.0)82 )83 )84 val accumulators = listOf(accumulator1, accumulator2)85 // when86 val meanAccumulator = accumulators.average()87 // then88 meanAccumulator.size("Hypervolume") shouldBe 389 meanAccumulator["Hypervolume", 0] shouldBe 2.590 meanAccumulator["Hypervolume", 1] shouldBe 3.591 meanAccumulator["Hypervolume", 2] shouldBe 4.592 meanAccumulator.size("IGD") shouldBe 393 meanAccumulator["IGD", 0] shouldBe 5.594 meanAccumulator["IGD", 1] shouldBe 6.595 meanAccumulator["IGD", 2] shouldBe 896 meanAccumulator.size("NFE") shouldBe 397 meanAccumulator["NFE", 0] shouldBe 1000.098 meanAccumulator["NFE", 1] shouldBe 2000.099 meanAccumulator["NFE", 2] shouldBe 3000.0100 }101})102fun createAccumulator(resultsData: Map<String, List<Double>>): Accumulator {103 val accumulator = Accumulator()104 resultsData.keys.forEach { metric ->105 resultsData[metric]?.forEach { accumulator.add(metric, it) }106 }107 return accumulator108}109fun createSolution(values: List<Double>, lowerBound: Double, upperBound: Double): Solution =110 createVariables(values, lowerBound, upperBound)111 .let { variables ->112 Solution(3, 0).apply {113 variables.indices.forEach { setVariable(it, variables[it]) }114 }115 }116private fun createVariables(117 values: List<Double>,118 lowerBound: Double,119 upperBound: Double120) = values.map { RealVariable(it, lowerBound, upperBound) }...

Full Screen

Full Screen

GroupSpec.kt

Source:GroupSpec.kt Github

copy

Full Screen

1package test.model.shapes2import io.kotest.core.spec.style.FunSpec3import io.kotest.matchers.collections.shouldBeEmpty4import io.kotest.matchers.collections.shouldContain5import io.kotest.matchers.nulls.shouldBeNull6import io.kotest.matchers.nulls.shouldNotBeNull7import io.kotest.matchers.shouldBe8import io.kotest.matchers.types.shouldBeInstanceOf9import krater.geometry.*10import krater.model.shapes.Group11import krater.model.Ray12import krater.model.shapes.BoundingBox13import krater.model.shapes.Cylinder14import krater.model.shapes.Sphere15import kotlin.math.PI16class GroupSpec : FunSpec({17 test("Creating a group") {18 val g = Group()19 g.transform.shouldBe(IDENTITY_4X4_MATRIX)20 }21 test("Adding a child to a group") {22 val s = TestShape()23 val g = Group(shapes = listOf(s))24 g.shapes.shouldContain(s)25 s.parent.shouldBe(g)26 }27 test("Intersecting a ray with an empty group") {28 val g = Group()29 val r = Ray(point(0, 0, 0), vector(0, 0, 1))30 val xs = g.localIntersect(r)31 xs.shouldBeEmpty()32 }33 test("Intersecting a ray with a non-empty group") {34 val s1 = Sphere()35 val s2 = Sphere(transform = translation(0, 0, -3))36 val s3 = Sphere(transform = translation(5, 0, 0))37 val g = Group(shapes = listOf(s1, s2, s3))38 val r = Ray(point(0, 0, -5), vector(0, 0, 1))39 val xs = g.localIntersect(r)40 xs.size.shouldBe(4)41 xs[0].shape.shouldBe(s2)42 xs[1].shape.shouldBe(s2)43 xs[2].shape.shouldBe(s1)44 xs[3].shape.shouldBe(s1)45 }46 test("Intersecting a transformed group") {47 val s = Sphere(transform = translation(5, 0, 0))48 val g = Group(shapes = listOf(s), transform = scaling(2, 2, 2))49 val r = Ray(point(10, 0, -10), vector(0, 0, 1))50 val xs = g.intersect(r)51 xs.size.shouldBe(2)52 }53 test("A group has a bounding box that contains its children") {54 val s = Sphere(transform = translation(2, 5, -3) * scaling(2, 2, 2))55 val c = Cylinder(minimum = -2.0, maximum = 2.0, transform = translation(-4, -1, 4) * scaling(0.5, 1, 0.5))56 val shape = Group(shapes = listOf(s, c))57 shape.boundingBox.min.shouldBe(point(-4.5, -3, -5))58 shape.boundingBox.max.shouldBe(point(4, 7, 4.5))59 }60 test("Intersecting ray+group doesn't test children if box is missed") {61 val child = TestShape()62 val shape = Group(shapes = listOf(child))63 val r = Ray(point(0, 0, -5), vector(0, 1, 0))64 val xs = shape.intersect(r)65 child.savedRay.shouldBeNull()66 }67 test("Intersecting ray+group tests children if box is hit") {68 val child = TestShape()69 val shape = Group(shapes = listOf(child))70 val r = Ray(point(0, 0, -5), vector(0, 0, 1))71 val xs = shape.intersect(r)72 child.savedRay.shouldNotBeNull()73 }74 test("Parent bounding box of an empty transformed group is empty") {75 val group = Group(transform = rotationX(PI / 4))76 group.parentSpaceBounds.shouldBe(BoundingBox())77 }78 test("Partitioning a group into sub-groups") {79 val s1 = Sphere(transform = translation(-2, 0, 0))80 val s2 = Sphere(transform = translation(2, 0, 0))81 val s3 = Sphere()82 val transform = rotationX(PI /4)83 val g = Group(shapes = listOf(s1, s2, s3), transform = transform)84 val partitioned = g.partition()85 partitioned.transform.shouldBe(transform)86 val (left, right, remainder) = partitioned.shapes87 left as Group88 right as Group89 remainder as Group90 left.shapes.shouldBe(listOf(s1))91 right.shapes.shouldBe(listOf(s2))92 remainder.shapes.shouldBe(listOf(s3))93 }94 test("Subdividing a group partitions its children") {95 val s1 = Sphere(transform = translation(-2, -2, 0))96 val s2 = Sphere(transform = translation(-2, 2, 0))97 val s3 = Sphere(transform = scaling(4, 4, 4))98 val g = Group(shapes = listOf(s1, s2, s3), transform = rotationX(PI / 4))99 val divide1 = g.divide(1) as Group100 divide1.shapes.forEach { println(it) }101 divide1.transform.shouldBe(g.transform)102 divide1.shapes.size.shouldBe(2)103 divide1.shapes.forEach { it.shouldBeInstanceOf<Group>() }104 divide1.shapes.map {105 it as Group106 it.shapes.size107 }.sum().shouldBe(3)108 val divide3 = g.divide(3) as Group109 divide3.shapes.forEach { println(it) }110 divide3.transform.shouldBe(g.transform)111 divide3.shapes.size.shouldBe(3)112 divide3.shapes.forEach { it.shouldBeInstanceOf<Sphere>() }113 }114})...

Full Screen

Full Screen

SignTest.kt

Source:SignTest.kt Github

copy

Full Screen

...53 should("success") {54 sign.line(0, Component.text("some text"))55 sign.line(0) shouldBe Component.text("some text")56 }57 should("index outbounds") {58 shouldThrow<IndexOutOfBoundsException> {59 sign.line(10)60 }61 }62 }63 context("line(Int, Component)") {64 should("success") {65 sign.line(0, Component.text("some text"))66 sign.line(0) shouldBe Component.text("some text")67 }68 should("index outbounds") {69 shouldThrow<IndexOutOfBoundsException> {70 sign.line(10, Component.text("some text"))71 }72 }73 }74 context("getLines") {75 should("default empty strings") {76 sign.lines shouldHaveSize 477 sign.lines shouldContainExactly arrayOf("", "", "", "")78 }79 @Suppress("DEPRECATION")80 should("line added") {81 sign.setLine(0, "some text")82 sign.lines shouldHaveSize 483 sign.lines shouldContainExactly arrayOf("some text", "", "", "")84 }85 }86 context("getLine(Int)") {87 @Suppress("DEPRECATION")88 should("success") {89 sign.setLine(0, "some text")90 sign.lines shouldHaveSize 491 sign.lines shouldContainExactly arrayOf("some text", "", "", "")92 }93 should("index outbounds") {94 @Suppress("DEPRECATION")95 shouldThrow<IndexOutOfBoundsException> {96 sign.getLine(10)97 }98 }99 }100 @Suppress("DEPRECATION")101 context("setLine(Int, String)") {102 should("success") {103 sign.setLine(0, "some text")104 sign.lines shouldHaveSize 4105 sign.lines shouldContainExactly arrayOf("some text", "", "", "")106 }107 should("index outbounds") {108 shouldThrow<IndexOutOfBoundsException> {109 sign.setLine(10, "some text")110 }111 }112 }113 should("isEditable is not implemented yet") {114 shouldThrow<UnimplementedOperationException> {115 sign.isEditable116 }117 }118 should("setEditable is not implemented yet") {119 shouldThrowUnit<UnimplementedOperationException> {120 sign.isEditable = true121 }...

Full Screen

Full Screen

MinHeapTest.kt

Source:MinHeapTest.kt Github

copy

Full Screen

1package datastructures2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.matchers.collections.shouldContainAll4import io.kotest.matchers.shouldBe5import org.junit.jupiter.api.Test6import org.junit.jupiter.params.ParameterizedTest7import org.junit.jupiter.params.provider.Arguments8import org.junit.jupiter.params.provider.MethodSource9class MinHeapTest {10 @ParameterizedTest11 @MethodSource("providesInsertValues")12 fun `insert success`(inputs: List<Int>, expectedValues: List<Int>) {13 val minHeap = MinHeap<Int>()14 for(i in inputs) {15 minHeap.insert(i)16 }17 validate(minHeap, expectedValues)18 }19 @ParameterizedTest20 @MethodSource("providesRemoveValues")21 fun `remove success`(inputs: List<Int>, repeatRemove: Int, expectedValues: List<Int>) {22 val minHeap = MinHeap<Int>()23 for(i in inputs) {24 minHeap.insert(i)25 }26 repeat(repeatRemove) {27 minHeap.remove()28 }29 validate(minHeap, expectedValues)30 }31 @Test32 fun `remove throws NotSuchElementException`() {33 val minHeap = MinHeap<Int>()34 shouldThrow<NoSuchElementException> {35 minHeap.remove()36 }37 }38 @ParameterizedTest39 @MethodSource("providesRemoveIndexValues")40 fun `remove by index success`(inputs: List<Int>, removeInputs: List<Int>, expectedValues: List<Int>) {41 val minHeap = MinHeap<Int>()42 for(i in inputs) {43 minHeap.insert(i)44 }45 for(i in removeInputs) {46 minHeap.remove(i)47 }48 validate(minHeap, expectedValues)49 }50 @Test51 fun `remove by index throws IndexOutOfBoundsException`() {52 val minHeap = MinHeap<Int>()53 shouldThrow<IndexOutOfBoundsException> {54 minHeap.remove(10)55 }56 }57 private fun <E: Comparable<E>> validate(heap: MinHeap<E>, expectedValues: List<Int>) {58 heap.size shouldBe expectedValues.size59 heap.elements shouldContainAll expectedValues60 }61 companion object {62 @JvmStatic63 fun providesInsertValues() = listOf(64 Arguments.of(listOf(5,4,3,2,1), listOf(1,2,3,4,5)),65 Arguments.of(listOf(3,2,5,4,1), listOf(1,2,3,4,5)),66 Arguments.of(listOf(1,2), listOf(1,2)),67 )68 @JvmStatic69 fun providesRemoveValues() = listOf(70 Arguments.of(listOf(5,4,3,2,1), 1, listOf(2,3,5,4)),71 Arguments.of(listOf(3,2,5,4,1), 2, listOf(3,4,5)),72 )73 @JvmStatic74 fun providesRemoveIndexValues() = listOf(75 Arguments.of(listOf(5,4,3,2,1), listOf(2), listOf(1,2,5,4)),76 Arguments.of(listOf(3,2,5,4,1), listOf(0,3), listOf(2,3,5)),77 )78 }79}...

Full Screen

Full Screen

DoubleShrinkerTest.kt

Source:DoubleShrinkerTest.kt Github

copy

Full Screen

...15import io.kotest.property.arbitrary.numericDouble16import io.kotest.property.internal.doShrinking17class DoubleShrinkerTest : FunSpec() {18 init {19 test("shrunk Arb.numericDouble values should stay within bounds") {20 val min = 12363.021 val max = 772183.022 val generator = Arb.numericDouble(min = min, max = max)23 val (v, s) = generator.sample(RandomSource.seeded(39084345))24 val collector = mutableListOf(v)25 doShrinking(s, ShrinkingMode.Bounded(100)) {26 collector.add(it)27 1.0 shouldBe 0.0 // failing assertion to keep on shrinking28 }29 collector shouldHaveLowerBound min30 collector shouldHaveUpperBound max31 }32 test("special values that cannot be shrunk") {33 val values = listOf(...

Full Screen

Full Screen

MapEntryTest.kt

Source:MapEntryTest.kt Github

copy

Full Screen

1package com.github.whyrising.y.collections.map2import com.github.whyrising.y.collections.concretions.map.MapEntry3import com.github.whyrising.y.collections.concretions.vector.PersistentVector4import com.github.whyrising.y.collections.concretions.vector.PersistentVector.EmptyVector5import io.kotest.assertions.throwables.shouldThrowExactly6import io.kotest.core.spec.style.FreeSpec7import io.kotest.matchers.booleans.shouldBeFalse8import io.kotest.matchers.booleans.shouldBeTrue9import io.kotest.matchers.ints.shouldBeExactly10import io.kotest.matchers.shouldBe11import io.kotest.matchers.types.shouldBeSameInstanceAs12class MapEntryTest : FreeSpec({13 "key/value" {14 val entry: IMapEntry<String, Int> = MapEntry("a", 1)15 entry.key shouldBe "a"16 entry.value shouldBeExactly 117 }18 "nth(index)" {19 val entry = MapEntry("a", 1)20 entry.nth(0) shouldBe "a"21 entry.nth(1) shouldBe 122 val e = shouldThrowExactly<IndexOutOfBoundsException> {23 entry.nth(2)24 }25 e.message shouldBe "index = 2"26 }27 "count" {28 MapEntry("a", 1).count shouldBeExactly 229 }30 "empty()" {31 val entry = MapEntry("a", 1)32 entry.empty() shouldBeSameInstanceAs EmptyVector33 }34 "conj(e)" {35 val entry = MapEntry("a", 1)36 val vec = entry.conj(15)37 vec.count shouldBeExactly 338 vec.nth(0) shouldBe "a"39 vec.nth(1) shouldBe 140 vec.nth(2) shouldBe 1541 }42 "assocN(index, value)" {43 val entry = MapEntry("a", 1)44 entry.assocN(0, "b").nth(0) shouldBe "b"45 entry.assocN(1, 15).nth(1) shouldBe 1546 entry.assocN(2, 15).nth(2) shouldBe 1547 val e = shouldThrowExactly<IndexOutOfBoundsException> {48 entry.assocN(3, 15)49 }50 e.message shouldBe "index = 3"51 }52 "iterator()" {53 val entry = MapEntry("a", 1)54 val iter = entry.iterator()55 iter.hasNext().shouldBeTrue()56 iter.next() shouldBe "a"57 iter.next() shouldBe 158 iter.hasNext().shouldBeFalse()59 shouldThrowExactly<NoSuchElementException> { iter.next() }60 }61 @Suppress("UNCHECKED_CAST")62 "pop()" {63 val entry = MapEntry("a", 1)64 val r = entry.pop() as PersistentVector<String>65 r.count shouldBeExactly 166 r[0] shouldBe "a"67 }68})...

Full Screen

Full Screen

bounds

Using AI Code Generation

copy

Full Screen

1 import io.kotest.matchers.collections.*2 import io.kotest.matchers.doubles.*3 import io.kotest.matchers.ints.*4 import io.kotest.matchers.longs.*5 import io.kotest.matchers.maps.*6 import io.kotest.matchers.numerics.*7 import io.kotest.matchers.optionals.*8 import io.kotest.matchers.sequences.*9 import io.kotest.matchers.shorts.*10 import io.kotest.matchers.strings.*11 import io.kotest.matchers.throwable.*12 import io.kotest.matchers.types.*13 import io.kotest.matchers.withClue.*14 import io.kotest.property.Arb.*15 import io.kotest.property.Gen.*16 import io.kotest.property.PropTestConfig.*17 import io.kotest.property.PropertyTesting.*

Full Screen

Full Screen

bounds

Using AI Code Generation

copy

Full Screen

1val list = listOf(1, 2, 3, 4)2list should haveSize(between(3, 5))3list should haveSize(greaterThan(3))4list should haveSize(greaterThanOrEqual(3))5list should haveSize(lessThan(5))6list should haveSize(lessThanOrEqual(5))7list should haveSize(not(1))8list should haveSize(inRange(3..5))9list should haveSize(inRange(3 until 5))10list should haveSize(not(inRange(1..2)))11list should haveSize(atLeast(3))12list should haveSize(atMost(5))13list should haveSize(atLeast(3) and lessThan(5))14list should haveSize(atLeast(3) or lessThan(5))15int should be(between(1, 5))16int should be(greaterThan(1))17int should be(greaterThanOrEqual(1))18int should be(lessThan(5))19int should be(lessThanOrEqual(5))20int should be(not(1))21int should be(inRange(1..5))22int should be(inRange(1 until 5))23int should be(not(inRange(1..2)))24int should be(atLeast(1))25int should be(atMost(5))26int should be(atLeast(1) and lessThan(5))27int should be(atLeast(1) or lessThan(5))28long should be(between(1L, 5L))29long should be(greaterThan(1L))30long should be(greaterThanOrEqual(1L))31long should be(lessThan(5L))32long should be(lessThanOrEqual(5L))33long should be(not(1L))34long should be(inRange(1L..5L))35long should be(inRange(3L until 5L))36long should be(not(inRange(1L..2L)))37long should be(atLeast(1L))38long should be(atMost(5L))39long should be(atLeast(1L) and lessThan(5L))40long should be(atLeast(1L) or lessThan(5L))

Full Screen

Full Screen

bounds

Using AI Code Generation

copy

Full Screen

1 val bounds = bounds(1..10)2 bounds should contain(5)3 bounds should containAll(1, 2, 3, 4, 5)4 bounds should containAll(1..5)5 bounds should containExactly(1, 2, 3, 4, 5)6 bounds should containExactly(1..5)7 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)8 bounds should containExactlyInAnyOrder(5 downTo 1)9 bounds should containNone(0, 11)10 bounds should containNone(0..11)11 bounds should containOnly(1, 2, 3, 4, 5)12 bounds should containOnly(1..5)13 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)14 bounds should containExactlyInAnyOrder(5 downTo 1)15 bounds should containNone(0, 11)16 bounds should containNone(0..11)17 bounds should containOnly(1, 2, 3, 4, 5)18 bounds should containOnly(1..5)19 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)20 bounds should containExactlyInAnyOrder(5 downTo 1)21 bounds should containNone(0, 11)22 bounds should containNone(0..11)23 bounds should containOnly(1, 2, 3, 4, 5)24 bounds should containOnly(1..5)25 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)26 bounds should containExactlyInAnyOrder(5 downTo 1)27 bounds should containNone(0, 11)28 bounds should containNone(0..11)29 bounds should containOnly(1, 2, 3, 4, 5)30 bounds should containOnly(1..5)31 val list = listOf(1, 2, 3, 4, 5)32 list should contain(5)33 list should containAll(1, 2, 3, 4, 5)

Full Screen

Full Screen

bounds

Using AI Code Generation

copy

Full Screen

1 import io.kotest.matchers.collections.*2 import io.kotest.matchers.doubles.*3 import io.kotest.matchers.ints.*4 import io.kotest.matchers.longs.*5 import io.kotest.matchers.maps.*6 import io.kotest.matchers.numerics.*7 import io.kotest.matchers.optionals.*8 import io.kotest.matchers.sequences.*9 import io.kotest.matchers.shorts.*10 import io.kotest.matchers.strings.*11 import io.kotest.matchers.throwable.*12 import io.kotest.matchers.types.*13 import io.kotest.matchers.withClue.*14 import io.kotest.property.Arb.*15 import io.kotest.property.Gen.*16 import io.kotest.property.PropTestConfig.*17 import io.kotest.property.PropertyTesting.*

Full Screen

Full Screen

bounds

Using AI Code Generation

copy

Full Screen

1 val bounds = bounds(1..10)2 bounds should contain(5)3 bounds should containAll(1, 2, 3, 4, 5)4 bounds should containAll(1..5)5 bounds should containExactly(1, 2, 3, 4, 5)6 bounds should containExactly(1..5)7 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)8 bounds should containExactlyInAnyOrder(5 downTo 1)9 bounds should containNone(0, 11)10 bounds should containNone(0..11)11 bounds should containOnly(1, 2, 3, 4, 5)12 bounds should containOnly(1..5)13 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)14 bounds should containExactlyInAnyOrder(5 downTo 1)15 bounds should containNone(0, 11)16 bounds should containNone(0..11)17 bounds should containOnly(1, 2, 3, 4, 5)18 bounds should containOnly(1..5)19 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)20 bounds should containExactlyInAnyOrder(5 downTo 1)21 bounds should containNone(0, 11)22 bounds should containNone(0..11)23 bounds should containOnly(1, 2, 3, 4, 5)24 bounds should containOnly(1..5)25 bounds should containExactlyInAnyOrder(5, 4, 3, 2, 1)26 bounds should containExactlyInAnyOrder(5 downTo 1)27 bounds should containNone(0, 11)28 bounds should containNone(0..11)29 bounds should containOnly(1, 2, 3, 4, 5)30 bounds should containOnly(1..5)31 val list = listOf(1, 2, 3, 4, 5)32 list should contain(5)33 list should containAll(1, 2, 3, 4, 5)

Full Screen

Full Screen

bounds

Using AI Code Generation

copy

Full Screen

1val bounds = Bounds(1..5)2bounds.shouldContain(2)3bounds.shouldNotContain(6)4bounds.shouldContainAll(1, 2, 3)5bounds.shouldNotContainAll(6, 7, 8)6bounds.shouldBeEmpty()7bounds.shouldBeNonEmpty()8bounds.shouldHaveSize(5)9bounds.shouldBeSingleton(2)10bounds.shouldBeIn(1..5)11bounds.shouldNotBeIn(6..10)12val collection = Collection(listOf(1, 2, 3))13collection.shouldContain(1)14collection.shouldNotContain(4)15collection.shouldContainAll(1, 2, 3)16collection.shouldNotContainAll(4, 5, 6)17collection.shouldBeEmpty()18collection.shouldBeNonEmpty()19collection.shouldHaveSize(3)20collection.shouldBeSingleton(2)21collection.shouldBeIn(listOf(1, 2, 3))22collection.shouldNotBeIn(listOf(4, 5, 6))23val map = Map(mapOf("a" to "b", "c" to "d"))24map.shouldContain("a" to "b")25map.shouldNotContain("x" to "y")26map.shouldContainAll("a" to "b", "c" to "d")27map.shouldNotContainAll("x" to "y", "z" to "t")28map.shouldBeEmpty()29map.shouldBeNonEmpty()30map.shouldHaveSize(2)31map.shouldBeSingleton("a" to "b")32map.shouldBeIn(mapOf("a" to "b", "c" to "d"))33map.shouldNotBeIn(mapOf("x" to "y", "z" to "t"))34val sequence = Sequence(sequenceOf(1, 2, 3))35sequence.shouldContain(1)36sequence.shouldNotContain(4)37sequence.shouldContainAll(1, 2, 3)38sequence.shouldNotContainAll(4, 5, 6)39sequence.shouldBeEmpty()40sequence.shouldBeNonEmpty()41sequence.shouldHaveSize(3)42sequence.shouldBeSingleton(2)43sequence.shouldBeIn(sequenceOf(1, 2, 3))

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in bounds

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful