Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Jun 12, 2024
1 parent fc2a9e8 commit b5cce68
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Tests/VergeTests/StoreTaskTests.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
import Verge
import XCTest
import Atomics

final class StoreTaskTests: XCTestCase {

func test() {

let atomic = ManagedAtomic<Bool>.init(false)

do {
let r = atomic.compareExchange(expected: true, desired: true, ordering: .sequentiallyConsistent).exchanged
print(r)
}

do {
let r = atomic.compareExchange(expected: true, desired: false, ordering: .sequentiallyConsistent).exchanged
print(r)
}

do {
let r = atomic.compareExchange(expected: false, desired: true, ordering: .sequentiallyConsistent).exchanged
print(r)
}

}

@MainActor
func testActorContext_onMainActor() async throws {

Expand Down

0 comments on commit b5cce68

Please sign in to comment.