All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmTest.lincheck.ResizableAtomicArrayLincheckTest.kt Maven / Gradle / Ivy

There is a newer version: 1.10.1
Show newest version
/*
 * Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.coroutines.lincheck

import kotlinx.coroutines.*
import kotlinx.coroutines.internal.*
import org.jetbrains.kotlinx.lincheck.annotations.*
import org.jetbrains.kotlinx.lincheck.paramgen.*

@Param(name = "index", gen = IntGen::class, conf = "0:4")
@Param(name = "value", gen = IntGen::class, conf = "1:5")
@OpGroupConfig(name = "sync", nonParallel = true)
class ResizableAtomicArrayLincheckTest : AbstractLincheckTest() {
    private val a = ResizableAtomicArray(2)

    @Operation
    fun get(@Param(name = "index") index: Int): Int? = a[index]

    @Operation(group = "sync")
    fun set(@Param(name = "index") index: Int, @Param(name = "value") value: Int) {
        a.setSynchronized(index, value)
    }

    override fun extractState() = (0..4).map { a[it] }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy