Skip to content

Commit

Permalink
Fix deprecated warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
durban committed Jun 16, 2023
1 parent 0c767d5 commit f771d15
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,20 @@
package dev.tauri.choam
package data

import org.jetbrains.kotlinx.lincheck.LinChecker
import org.jetbrains.kotlinx.lincheck.{ LinChecker, LincheckAssertionError }
import org.jetbrains.kotlinx.lincheck.paramgen.IntGen
import org.jetbrains.kotlinx.lincheck.verifier.VerifierState
import org.jetbrains.kotlinx.lincheck.annotations.{ Operation, Param }
import org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.ModelCheckingOptions

import munit.FunSuite

@Param(name = "v", gen = classOf[IntGen], conf = "0:127")
class ManagedTestState extends VerifierState {
class ManagedTestState {

@volatile
private[this] var count: Int =
0

override def extractState(): AnyRef = {
Integer.valueOf(this.count)
}

@Operation
def incr(v: Int): Int = {
val curr = this.count
Expand All @@ -54,8 +49,14 @@ class ManagedTestState extends VerifierState {

final class ManagedTestExample extends FunSuite with BaseLinchkSpec {

test("Dummy counter test".ignore) { // expected failure
test("Dummy counter test") {
val opts = new ModelCheckingOptions()
LinChecker.check(classOf[ManagedTestState], opts)
try {
LinChecker.check(classOf[ManagedTestState], opts)
fail("expected a lincheck failure")
} catch {
case _: LincheckAssertionError =>
() // ok, expected failure
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package data

import org.jetbrains.kotlinx.lincheck.LinChecker
import org.jetbrains.kotlinx.lincheck.paramgen.StringGen
import org.jetbrains.kotlinx.lincheck.verifier.VerifierState
import org.jetbrains.kotlinx.lincheck.annotations.{ Operation, Param }

import munit.FunSuite
Expand All @@ -46,18 +45,14 @@ final object TtrieModelTest {

@Param(name = "k", gen = classOf[StringGen])
@Param(name = "v", gen = classOf[StringGen])
class TestState extends VerifierState {
class TestState {

private[this] val emcas: mcas.Mcas =
mcas.Mcas.Emcas

private[this] val m: Ttrie[String, String] =
Ttrie[String, String].unsafeRun(emcas)

override def extractState(): AnyRef = {
m.unsafeSnapshot.unsafeRun(emcas) : scala.collection.immutable.Map[String, String]
}

@Operation
def insert(k: String, v: String): Option[String] = {
m.put.unsafePerform(k -> v, emcas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package data

import org.jetbrains.kotlinx.lincheck.LinChecker
import org.jetbrains.kotlinx.lincheck.paramgen.StringGen
import org.jetbrains.kotlinx.lincheck.verifier.VerifierState
import org.jetbrains.kotlinx.lincheck.annotations.{ Operation, Param }
import org.jetbrains.kotlinx.lincheck.strategy.stress.StressOptions

Expand All @@ -43,18 +42,14 @@ final class TtrieStressTest extends FunSuite with BaseLinchkSpec {
final object TtrieStressTest {

@Param(name = "k", gen = classOf[StringGen])
class TestState extends VerifierState {
class TestState {

private[this] val emcas: mcas.Mcas =
mcas.Mcas.Emcas

private[this] val m: Ttrie[String, String] =
Ttrie[String, String].unsafeRun(emcas)

override def extractState(): AnyRef = {
m.unsafeSnapshot.unsafeRun(emcas) : scala.collection.immutable.Map[String, String]
}

@Operation
def insert(k: String): Option[String] = {
m.put.unsafePerform(k -> "dummy", emcas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package skiplist

import org.jetbrains.kotlinx.lincheck.LinChecker
import org.jetbrains.kotlinx.lincheck.paramgen.{ IntGen, StringGen }
import org.jetbrains.kotlinx.lincheck.verifier.VerifierState
import org.jetbrains.kotlinx.lincheck.annotations.{ Operation, Param, StateRepresentation }

import munit.FunSuite
Expand Down Expand Up @@ -79,15 +78,11 @@ final object SkipListModelTest {

@Param(name = "key", gen = classOf[IntGen])
@Param(name = "value", gen = classOf[StringGen])
class TestStateSequential extends VerifierState {
class TestStateSequential {

private[this] val m =
scala.collection.mutable.TreeMap.empty[Int, String]

override def extractState(): Map[Int, String] = {
m.toMap
}

@StateRepresentation
def stateRepr(): String = {
m.toList.map {
Expand Down

0 comments on commit f771d15

Please sign in to comment.