Skip to content
Open
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
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ repositories {
dependencies {
implementation(libs.jacksonDatabind)
testImplementation(libs.junit)
testImplementation(libs.lincheck)

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# libraries
junit = "4.13.2"
opentest4j = "1.3.0"
lincheck = "2.37"

# plugins
changelog = "2.4.0"
Expand All @@ -15,6 +16,7 @@ jackson = "2.15.2"
junit = { group = "junit", name = "junit", version.ref = "junit" }
opentest4j = { group = "org.opentest4j", name = "opentest4j", version.ref = "opentest4j" }
jacksonDatabind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
lincheck = { group = "org.jetbrains.kotlinx", name = "lincheck", version.ref = "lincheck" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package dev.stillya.vpet.pet

import org.jetbrains.kotlinx.lincheck.annotations.Operation
import org.jetbrains.kotlinx.lincheck.check
import org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.ModelCheckingOptions
import org.jetbrains.kotlinx.lincheck.strategy.stress.StressOptions
import org.junit.Test
import java.util.concurrent.atomic.AtomicBoolean

class PetAnimatedObservingStateLincheckTest {

private val isObserving = AtomicBoolean(false)

@Operation
fun startObserving(): Boolean {
return isObserving.compareAndSet(false, true)
}

@Operation
fun exitObserving(): Boolean {
return isObserving.compareAndSet(true, false)
}

@Operation
fun isCurrentlyObserving(): Boolean {
return isObserving.get()
}

@Test
fun stressTest() = StressOptions().check(this::class)

@Test
fun modelCheckingTest() = ModelCheckingOptions().check(this::class)
}