Skip to content

Commit 8fb0f92

Browse files
committed
updated kotest
1 parent 7001301 commit 8fb0f92

File tree

7 files changed

+62
-45
lines changed

7 files changed

+62
-45
lines changed

.idea/jarRepositories.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,61 @@
11
plugins {
22
java
33
kotlin("jvm") version "1.3.72"
4+
id("org.jetbrains.dokka") version "0.10.1"
45
}
56

67
val moduleName = "com.github.kotlin_graphics.kotlin_unsigned"
78
val kot = "org.jetbrains.kotlin:kotlin"
8-
val kotlintest_version = "3.4.2"
9+
val kotlintest_version = "4.0.5"
910

1011
repositories {
1112
mavenCentral()
13+
jcenter()
1214
maven { url = uri("https://jitpack.io") }
1315
}
1416

1517
dependencies {
18+
implementation(kotlin("stdlib"))
1619
implementation(kotlin("stdlib-jdk8"))
1720

1821
attributesSchema.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE).compatibilityRules.add(ModularJarCompatibilityRule::class)
22+
components { withModule<ModularKotlinRule>(kotlin("stdlib")) }
1923
components { withModule<ModularKotlinRule>(kotlin("stdlib-jdk8")) }
2024

21-
testImplementation("io.kotlintest:kotlintest-runner-junit5:$kotlintest_version")
25+
listOf("runner-junit5", "assertions-core"/*, "property"*/).forEach {
26+
testImplementation("io.kotest:kotest-$it-jvm:$kotlintest_version")
27+
}
2228
}
2329

2430
java {
2531
modularity.inferModulePath.set(true)
2632
}
2733

28-
//java {
29-
// withJavadocJar()
30-
// withSourcesJar()
31-
//}
32-
33-
//task sourcesJar(type: Jar, dependsOn: classes) {
34-
// archiveClassifier = 'sources'
35-
// from sourceSets.main.allSource
36-
//}
37-
//
38-
//task javadocJar(type: Jar, dependsOn: javadoc) {
39-
// archiveClassifier = 'javadoc'
40-
// from javadoc.destinationDir
41-
//}
42-
//
43-
//artifacts {
44-
// archives sourcesJar
45-
//// archives javadocJar
46-
//}
47-
//
34+
tasks {
35+
val dokka by getting(org.jetbrains.dokka.gradle.DokkaTask::class) {
36+
outputFormat = "html"
37+
outputDirectory = "$buildDir/dokka"
38+
}
39+
}
40+
41+
val dokkaJar by tasks.creating(Jar::class) {
42+
group = JavaBasePlugin.DOCUMENTATION_GROUP
43+
description = "Assembles Kotlin docs with Dokka"
44+
archiveClassifier.set("javadoc")
45+
from(tasks.dokka)
46+
}
47+
48+
val sourceJar = task("sourceJar", Jar::class) {
49+
dependsOn(tasks["classes"])
50+
archiveClassifier.set("sources")
51+
from(sourceSets.main.get().allSource)
52+
}
53+
54+
artifacts {
55+
archives(sourceJar)
56+
archives(dokkaJar)
57+
}
58+
4859

4960
tasks.compileKotlin {
5061
// Enable Kotlin compilation to Java 8 class files with method parameter name metadata
@@ -70,8 +81,9 @@ tasks.compileJava {
7081
options.compilerArgs = listOf("--patch-module", "$moduleName=${sourceSets.main.get().output.asPath}")
7182
}
7283

73-
74-
//test.useJUnitPlatform()
84+
tasks.withType<Test> {
85+
useJUnitPlatform()
86+
}
7587

7688
// == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
7789
configurations.all {

src/test/kotlin/unsigned/test.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package unsigned
22

3-
import io.kotlintest.matchers.beLessThan
4-
import io.kotlintest.should
5-
import io.kotlintest.shouldBe
6-
import io.kotlintest.specs.StringSpec
3+
import io.kotest.core.spec.style.StringSpec
4+
import io.kotest.matchers.ints.shouldBeLessThan
5+
import io.kotest.matchers.should
6+
import io.kotest.matchers.shouldBe
77
import java.math.BigInteger
88

99
/**
@@ -46,24 +46,24 @@ class Unsigned : StringSpec() {
4646

4747
250.b udiv 50.b shouldBe 5.b
4848
250.b urem 200.b shouldBe 50.b
49-
250.b ucmp 251.b should beLessThan(1)
50-
(250.b ucmp 250.b) shouldBe 0
49+
250.b ucmp 251.b shouldBeLessThan 1
50+
250.b ucmp 250.b shouldBe 0
5151
0b1010_1010.b ushr 4 shouldBe 0b1010.b
5252

5353
65500.s udiv 500.s shouldBe 131.s
5454
65500.s urem 65000.s shouldBe 500.s
55-
65500.s ucmp 65501.s should beLessThan(1)
55+
65500.s ucmp 65501.s shouldBeLessThan 1
5656
65500.s ucmp 65500.s shouldBe 0
5757
0b0100_1100_0011_1101.s ushr 8 shouldBe 0b100_1100.s
5858

5959
4_000_000_000.i udiv 2 shouldBe 2_000_000_000
6060
2_750_000_000.i urem 2_000_000_000 shouldBe 750_000_000
61-
4_000_000_000.i ucmp 4_000_000_001.i should beLessThan(1)
61+
4_000_000_000.i ucmp 4_000_000_001.i shouldBeLessThan 1
6262
4_000_000_000.i ucmp 4_000_000_000.i shouldBe 0
6363

6464
"18_000_000_000_000_000_000".L udiv 2L shouldBe "9'000'000'000'000'000'000".L
6565
"17'000'000'000'000'000'000".L urem "9'000'000'000'000'000'000".L shouldBe "8'000'000'000'000'000'000".L
66-
"18'000'000'000'000'000'000".L ucmp "18'000'000'000'000'000'001".L should beLessThan(1)
66+
"18'000'000'000'000'000'000".L ucmp "18'000'000'000'000'000'001".L shouldBeLessThan 1
6767
"18'000'000'000'000'000'001".L ucmp "18'000'000'000'000'000'001".L shouldBe 0
6868
}
6969

src/test/kotlin/unsigned/ubyte.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package unsigned
22

3-
import io.kotlintest.shouldBe
4-
import io.kotlintest.specs.StringSpec
3+
import io.kotest.core.spec.style.StringSpec
4+
import io.kotest.matchers.shouldBe
55
import java.math.BigInteger
66
import kotlin.experimental.inv
77

src/test/kotlin/unsigned/uint.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package unsigned
22

3-
import io.kotlintest.shouldBe
4-
import io.kotlintest.specs.StringSpec
3+
import io.kotest.core.spec.style.StringSpec
4+
import io.kotest.matchers.shouldBe
55
import java.math.BigInteger
66

77
class `Uint test` : StringSpec() {

src/test/kotlin/unsigned/ulong.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package unsigned
22

3-
import io.kotlintest.matchers.beLessThan
4-
import io.kotlintest.should
5-
import io.kotlintest.shouldBe
6-
import io.kotlintest.specs.StringSpec
3+
import io.kotest.core.spec.style.StringSpec
4+
import io.kotest.matchers.ints.shouldBeLessThan
5+
import io.kotest.matchers.shouldBe
6+
77

88
class `Ulong test` : StringSpec() {
99

@@ -12,7 +12,7 @@ class `Ulong test` : StringSpec() {
1212

1313
val max = "ffff_ffff__ffff_ffff".hL
1414

15-
Ulong(Ulong.Companion.MAX_VALUE).v shouldBe max
15+
Ulong(Ulong.MAX_VALUE).v shouldBe max
1616
Ulong("18446744073709551615").v shouldBe max
1717

1818
var a = Ulong(Ulong.Companion.MAX_VALUE)
@@ -117,7 +117,7 @@ class `Ulong test` : StringSpec() {
117117
d = "0100_1100__0111_0000__1111_0000__0111_1100__0000_1111__1100_0000__0111_1111__0000_0000".bL
118118
d shl Ulong(32).toInt() shouldBe "0000_1111__1100_0000__0111_1111__0000_0000__0000_0000__0000_0000__0000_0000__0000_0000".bL
119119
d shr Ulong(32).toInt() shouldBe "0000_0000__0000_0000__0000_0000__0000_0000__0100_1100__0111_0000__1111_0000__0111_1100".bL
120-
(d ucmp Ulong("1010_1010__1010_1010__1010_1010__1010_1010__1010_1010__1010_1010__1010_1010__1010_1011", 2)) should beLessThan(0)
120+
(d ucmp Ulong("1010_1010__1010_1010__1010_1010__1010_1010__1010_1010__1010_1010__1010_1010__1010_1011", 2)) shouldBeLessThan 0
121121
(d ucmp Ulong(d)) shouldBe 0
122122
}
123123
}

src/test/kotlin/unsigned/ushort.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package unsigned
22

3-
import io.kotlintest.shouldBe
4-
import io.kotlintest.specs.StringSpec
3+
import io.kotest.core.spec.style.StringSpec
4+
import io.kotest.matchers.shouldBe
55
import java.math.BigInteger
66
import kotlin.experimental.inv
77

0 commit comments

Comments
 (0)