Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Use of KOTEST_VERSION property #198

Merged
merged 3 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arrow-fx-coroutines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
compile "io.arrow-kt:arrow-core:$VERSION_NAME"

testImplementation "io.kotest:kotest-runner-junit5-jvm:4.0.6" // for kotest framework
testImplementation "io.kotest:kotest-assertions-core-jvm:4.0.6" // for kotest core jvm assertions
testImplementation "io.kotest:kotest-property-jvm:4.0.6" // for kotest property test
testImplementation "io.kotest:kotest-runner-console-jvm:4.0.6"
testImplementation "io.kotest:kotest-runner-junit5-jvm:$KOTEST_VERSION" // for kotest framework
testImplementation "io.kotest:kotest-assertions-core-jvm:$KOTEST_VERSION" // for kotest core jvm assertions
testImplementation "io.kotest:kotest-property-jvm:$KOTEST_VERSION" // for kotest property test
testImplementation "io.kotest:kotest-runner-console-jvm:$KOTEST_VERSION"
}

compileTestKotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import io.kotest.property.arbitrary.bind
import io.kotest.property.arbitrary.char
import io.kotest.property.arbitrary.choice
import io.kotest.property.arbitrary.constant
import io.kotest.property.arbitrary.flatMap
import io.kotest.property.arbitrary.int
import io.kotest.property.arbitrary.long
import io.kotest.property.arbitrary.map
Expand Down Expand Up @@ -111,13 +110,9 @@ fun <L, R> Arb.Companion.either(left: Arb<L>, right: Arb<R>): Arb<Either<L, R>>
return Arb.choice(failure, success)
}

fun Arb.Companion.intRange(min: Int = 0, max: Int = 1000): Arb<IntRange> =
Arb.int(min, max).flatMap { a ->
Arb.int(min, max).map { b ->
val first = min(a, b)
val last = max(a, b)
first..last
}
fun Arb.Companion.intRange(min: Int = Int.MIN_VALUE, max: Int = Int.MAX_VALUE): Arb<IntRange> =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nomisRev , thank you so much for making it work for Kotest 4.1.0 🎉 Just a small question, could this change impact on current tests? I mean, the max value changed from 1000 to 2147483647. Thanks in advance!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the min value also changes (from 0 to -2147483648).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rachelcarmena,
The reason for this change was to make the generator more accurate.
The only current usage from this Arb explicitly defines min & max, so it doesn't impact the current suite.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you so much Simon!! 🙌

Arb.bind(Arb.int(min, max), Arb.int(min, max)) { a, b ->
if (a < b) a..b else b..a
}

fun Arb.Companion.longRange(min: Long = Long.MIN_VALUE, max: Long = Long.MAX_VALUE): Arb<LongRange> =
Expand Down