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

Commit

Permalink
chore: merge kotlin-1.4 to main
Browse files Browse the repository at this point in the history
  • Loading branch information
jcornaz authored Aug 15, 2020
2 parents e4fdc42 + 027ef29 commit 40b93e2
Show file tree
Hide file tree
Showing 51 changed files with 275 additions and 254 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
tags:
- '*'

pull_request:
paths:
- '.github/workflows/publish.yml'

jobs:
publish:

Expand Down
3 changes: 3 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"header": "# Changelog\n\nAll notable changes to this project are documented in this file.\n\nThis project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n",
"preMajor": true,
"bumpFiles": [
{ "filename": "VERSION", "type": "plain-text" }
],
"types": [
{"type": "feat", "section": "Features"},
{"type": "stable", "section": "Stabilization"},
Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Kwik
.. image:: https://badges.gitter.im/kwik-test/community.svg
:target: https://gitter.im/kwik-test/community

.. image:: https://img.shields.io/badge/kotlin-1.4-informational
:target: https://kotl.in

.. image:: https://api.bintray.com/packages/kwik/stable/kwik/images/download.svg
:target: https://bintray.com/kwik/stable/kwik

Expand Down Expand Up @@ -105,6 +108,8 @@ The known alternatives either:
Setup
-----

**NOTE: Since version 0.7.0 kwik requires Kotlin 1.4!**

Example of setup using gradle.

.. startGradleSetup
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.6.2
43 changes: 9 additions & 34 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,18 @@ import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.BintrayPlugin
import kr.motd.gradle.sphinx.gradle.SphinxTask
import org.codehaus.plexus.util.Os
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
import java.util.*

plugins {
`maven-publish`
id("org.jetbrains.kotlin.multiplatform") version "1.3.72"
id("org.ajoberstar.reckon") version "0.12.0"
id("org.jetbrains.kotlin.multiplatform") version "1.4.0"
id("org.jetbrains.dokka") version "1.4.0-rc"
id("com.github.ben-manes.versions") version "0.29.0"
id("io.gitlab.arturbosch.detekt") version "1.11.0"
id("com.jfrog.bintray") version "1.8.5" apply false
id("kr.motd.sphinx") version "2.9.0"
id("org.jetbrains.dokka") version "0.10.1"
}

reckon {
scopeFromProp()
stageFromProp("alpha", "beta", "rc", "final")
}

detekt {
Expand All @@ -38,15 +31,21 @@ detekt {
config = files("$rootDir/detekt-config.yml")
}

val currentVersion = rootDir.resolve("VERSION").readText().trim()

allprojects {
group = "com.github.jcornaz.kwik"
version = currentVersion

repositories {
mavenCentral()
jcenter()
}
}

// Hack so that we can configure all subprojects from this file
kotlin { jvm() }

subprojects {
apply(plugin = "org.jetbrains.kotlin.multiplatform")
apply(plugin = "org.jetbrains.dokka")
Expand All @@ -61,25 +60,13 @@ subprojects {
mingwX64("windows")

sourceSets {
commonMain {
dependencies {
api(kotlin("stdlib-common"))
}
}

commonTest {
dependencies {
api(kotlin("test-common"))
api(kotlin("test-annotations-common"))
}
}

val jvmMain by existing {
dependencies {
implementation(kotlin("stdlib"))
}
}

val jvmTest by existing {
dependencies {
implementation(kotlin("test"))
Expand Down Expand Up @@ -122,7 +109,6 @@ subprojects {
userOrg = "kwik"
name = "kwik"
repo = when {
'+' in project.version.toString() -> "dev"
'-' in project.version.toString() -> "preview"
else -> "stable"
}
Expand Down Expand Up @@ -221,19 +207,8 @@ tasks {
mustRunAfter(subprojects.flatMap { it.tasks.withType(Test::class) })
}

val dokka by existing(DokkaTask::class) {
subProjects = subprojects.map { it.name }

multiplatform {
val common by creating
val jvm by creating
val linux by creating
val windows by creating
}
}

val check by existing {
dependsOn(dokka, sphinx)
dependsOn(sphinx)

finalizedBy(testReport)
}
Expand Down
6 changes: 3 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ coverage:
status:
project:
default:
target: 81%
target: 79%

generator:
target: 87%
target: 86%
paths:
- generator/

Expand All @@ -23,7 +23,7 @@ coverage:
- fuzzer/

evaluator:
target: 61%
target: 56%
paths:
- evaluator/

Expand Down
3 changes: 3 additions & 0 deletions detekt-config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
build:
maxIssues: 2

comments:
active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt,**/examples/**"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract class AbstractRunnerTest {

@Test
fun canSkipEvaluation() {
Generator.create { it.nextInt() }
Generator { it: Random -> it.nextInt() }

val values = mutableSetOf<Int>()
var invocations = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.github.jcornaz.kwik.evaluator

import com.github.jcornaz.kwik.generator.api.Generator
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue

class CheckForAll1Test : AbstractRunnerTest() {

private val testGenerator = Generator.create { it.nextInt() }
private val testGenerator = Generator { it: Random -> it.nextInt() }

override fun evaluate(iterations: Int, seed: Long, invocation: PropertyEvaluationContext.() -> Boolean) {
checkForAll(testGenerator, iterations, seed) { assertTrue(invocation()) }
Expand All @@ -19,7 +20,7 @@ class CheckForAll1Test : AbstractRunnerTest() {
val exception = assertFailsWith<FalsifiedPropertyError> {
var i = 0
checkForAll<Int>(
Generator.create { 42 },
Generator { it: Random -> 42 },
iterations = 123,
seed = 78
) { assertTrue(++i < 12) }
Expand All @@ -46,7 +47,7 @@ class CheckForAll1Test : AbstractRunnerTest() {

@Test
fun isPredictable() {
val gen = Generator.create { it.nextInt() }
val gen = Generator { it: Random -> it.nextInt() }

val pass1 = mutableListOf<Int>()
val pass2 = mutableListOf<Int>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.github.jcornaz.kwik.evaluator

import com.github.jcornaz.kwik.generator.api.Generator
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue

class CheckForAll2Test : AbstractRunnerTest() {

private val testGenerator1 = Generator.create { it.nextInt() }
private val testGenerator2 = Generator.create { it.nextDouble() }
private val testGenerator1 = Generator { it: Random -> it.nextInt() }
private val testGenerator2 = Generator { it: Random -> it.nextDouble() }

override fun evaluate(iterations: Int, seed: Long, invocation: PropertyEvaluationContext.() -> Boolean) {
checkForAll(testGenerator1, testGenerator2, iterations, seed) { _, _ -> assertTrue(invocation()) }
Expand All @@ -20,8 +21,8 @@ class CheckForAll2Test : AbstractRunnerTest() {
val exception = assertFailsWith<FalsifiedPropertyError> {
var i = 0
checkForAll(
Generator.create { 42 },
Generator.create { -4.1 },
Generator { it: Random -> 42 },
Generator { it: Random -> -4.1 },
iterations = 123, seed = 78
) { _, _ ->
if (++i >= 12) error("failed")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package com.github.jcornaz.kwik.evaluator

import com.github.jcornaz.kwik.generator.api.Generator
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue

class CheckForAll3Test : AbstractRunnerTest() {

private val testGenerator1 = Generator.create { it.nextInt() }
private val testGenerator2 = Generator.create { it.nextDouble() }
private val testGenerator3 = Generator.create { it.nextLong() }
private val testGenerator1 = Generator { it: Random -> it.nextInt() }
private val testGenerator2 = Generator { it: Random -> it.nextDouble() }
private val testGenerator3 = Generator { it: Random -> it.nextLong() }

override fun evaluate(iterations: Int, seed: Long, invocation: PropertyEvaluationContext.() -> Boolean) {
checkForAll(
Expand All @@ -27,9 +28,9 @@ class CheckForAll3Test : AbstractRunnerTest() {
val exception = assertFailsWith<FalsifiedPropertyError> {
var i = 0
checkForAll(
Generator.create { 42 },
Generator.create { -4.1 },
Generator.create { 100L },
Generator { it: Random -> 42 },
Generator { it: Random -> -4.1 },
Generator { it: Random -> 100L },
iterations = 123, seed = 78
) { _, _, _ ->
if (++i >= 12 ) error("failed")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.github.jcornaz.kwik.evaluator

import com.github.jcornaz.kwik.generator.api.Generator
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue

class CheckForAll4Test : AbstractRunnerTest() {

private val testGenerator1 = Generator.create { it.nextInt() }
private val testGenerator2 = Generator.create { it.nextDouble() }
private val testGenerator3 = Generator.create { it.nextLong() }
private val testGenerator4 = Generator.create { it.nextFloat() }
private val testGenerator1 = Generator { it: Random -> it.nextInt() }
private val testGenerator2 = Generator { it: Random -> it.nextDouble() }
private val testGenerator3 = Generator { it: Random -> it.nextLong() }
private val testGenerator4 = Generator { it: Random -> it.nextFloat() }

override fun evaluate(iterations: Int, seed: Long, invocation: PropertyEvaluationContext.() -> Boolean) {
checkForAll(
Expand All @@ -31,10 +32,10 @@ class CheckForAll4Test : AbstractRunnerTest() {
val exception = assertFailsWith<FalsifiedPropertyError> {
var i = 0
checkForAll(
Generator.create { 42 },
Generator.create { -4.1 },
Generator.create { 100L },
Generator.create { "hello world" },
Generator { it: Random -> 42 },
Generator { it: Random -> -4.1 },
Generator { it: Random -> 100L },
Generator { it: Random -> "hello world" },
iterations = 123, seed = 78
) { _, _, _, _ ->
if (++i >= 12) error("failed")
Expand Down
Loading

0 comments on commit 40b93e2

Please sign in to comment.