blob: ceedd0e9838dccd1625bc47def5f0c2def4cec27 [file] [log] [blame]
package kotlinx.atomicfu.test
import kotlinx.atomicfu.*
import kotlin.test.*
/**
* Tests atomic fields that work as replacement to volatiles (only getValue/setValue)
*/
class VolatileOnlyTest {
private val _ref = atomic<String?>(null)
private val _int = atomic(0)
@Test
fun testVolatileOnly() {
_ref.value = "OK"
assertEquals("OK", _ref.value)
_int.value = 42
assertEquals(42, _int.value)
}
}