File tree Expand file tree Collapse file tree 6 files changed +79
-27
lines changed
src/main/commonMain/kotlin Expand file tree Collapse file tree 6 files changed +79
-27
lines changed Original file line number Diff line number Diff line change 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+ buildscript {
6+ repositories {
7+ mavenLocal()
8+ }
9+
10+ dependencies {
11+ classpath(" org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.22.0-SNAPSHOT" )
12+ }
13+ }
14+
15+ plugins {
16+ kotlin(" multiplatform" ) version " 1.9.10"
17+ }
18+
19+ apply (plugin = " kotlinx-atomicfu" )
20+
21+ repositories {
22+ mavenLocal()
23+ mavenCentral()
24+ }
25+
26+ kotlin {
27+ jvm {
28+ jvmToolchain(8 )
29+ withJava()
30+ testRuns.named(" test" ) {
31+ executionTask.configure {
32+ useJUnitPlatform()
33+ }
34+ }
35+ }
36+ js {
37+ nodejs()
38+ }
39+ val hostOs = System .getProperty(" os.name" )
40+ val isArm64 = System .getProperty(" os.arch" ) == " aarch64"
41+ val isMingwX64 = hostOs.startsWith(" Windows" )
42+ val nativeTarget = when {
43+ hostOs == " Mac OS X" && isArm64 -> macosArm64(" native" )
44+ hostOs == " Mac OS X" && ! isArm64 -> macosX64(" native" )
45+ hostOs == " Linux" && isArm64 -> linuxArm64(" native" )
46+ hostOs == " Linux" && ! isArm64 -> linuxX64(" native" )
47+ isMingwX64 -> mingwX64(" native" )
48+ else -> throw GradleException (" Host OS is not supported in Kotlin/Native." )
49+ }
50+
51+ sourceSets {
52+ val commonMain by getting
53+ val commonTest by getting {
54+ dependencies {
55+ implementation(kotlin(" test" ))
56+ }
57+ }
58+ }
59+ }
Original file line number Diff line number Diff line change 1+ import kotlinx.atomicfu.*
2+
3+ class IntArithmetic {
4+ private val _x = atomic(0 )
5+ val x get() = _x .value
6+
7+ fun doWork (finalValue : Int ) {
8+ check(x == 0 )
9+ _x .getAndSet(3 )
10+ check(x == 3 )
11+ _x .compareAndSet(3 , finalValue)
12+ check(x == finalValue)
13+ }
14+ }
Original file line number Diff line number Diff line change 1- /*
2- * Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3- */
4-
51import kotlin.test.*
62
7- class ArithmeticTest {
3+ class IntArithmeticTest {
84
95 @Test
106 fun testInt () {
Original file line number Diff line number Diff line change 11pluginManagement {
22 repositories {
3- google()
4- gradlePluginPortal()
3+ mavenLocal()
54 mavenCentral()
5+ gradlePluginPortal()
66 }
77}
88
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ pluginManagement {
77 }
88}
99
10- rootProject. name = " kotlinx-atomicfu-integration-testing"
10+ rootProject. name = " kotlinx-atomicfu-integration-testing"
11+ include ' mpp'
12+
You can’t perform that action at this time.
0 commit comments