1 /*
2  * Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 import kotlinx.atomicfu.*
6 import kotlin.test.*
7 
8 class IntArithmetic {
9     private val _x = atomic(0)
10     val x get() = _x.value
11 
doWorknull12     fun doWork(finalValue: Int) {
13         assertEquals(0, x)
14         assertEquals(0, _x.getAndSet(3))
15         assertEquals(3, x)
16         assertTrue(_x.compareAndSet(3, finalValue))
17     }
18 }
19