diff --git a/Package.swift b/Package.swift index 739fa6d..fa2fd6d 100644 --- a/Package.swift +++ b/Package.swift @@ -24,8 +24,7 @@ let package = Package( .target(name: "_AtomicsShims"), .target( name: "Atomics", - dependencies: ["_AtomicsShims"], - path: "Sources/Atomics" + dependencies: ["_AtomicsShims"] ), .testTarget( name: "AtomicsTests", diff --git a/README.md b/README.md index b1e929c..963a9f7 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,20 @@ Of particular note is full support for atomic strong references. This provides a All atomic operations exposed by this package are guaranteed to have lock-free implementations. However, we do not guarantee wait-free operation -- depending on the capabilities of the target platform, some of the exposed operations may be implemented by compare-and-exchange loops. That said, all atomic operations map directly to dedicated CPU instructions where available -- to the extent supported by llvm & Clang. +## Portability Concerns + +Lock-free double-wide atomics requires support for such things from the underlying target platform. Where such support isn't available, this package doesn't implement `DoubleWord` atomics or atomic strong references. While modern multiprocessing CPUs have been providing double-wide atomic instructions for a number of years now, some platforms still target older architectures by default; these require a special compiler option to enable double-wide atomic instructions. This currently includes Linux operating systems running on x86_64 processors, where the `cmpxchg16b` instruction isn't considered a baseline requirement. + +To enable double-wide atomics on Linux/x86_64, you currently have to manually supply a couple of additional options on the SPM build invocation: + +``` +$ swift build -Xcc -mcx16 -Xswiftc -DENABLE_DOUBLEWIDE_ATOMICS -c release +``` + +(`-mcx16` turns on support for `cmpxchg16b` in Clang, and `-DENABLE_DOUBLEWIDE_ATOMICS` makes Swift aware that double-wide atomics are available. Note that the resulting binaries won't run on some older AMD64 CPUs.) + +The package cannot currently configure this automatically. + ## Memory Management Atomic access is implemented in terms of dedicated atomic storage representations that are kept distinct from the corresponding regular (non-atomic) type. (E.g., the actual integer value underlying the counter above isn't directly accessible.) This has several advantages: diff --git a/Sources/Atomics/AtomicStrongReference.swift b/Sources/Atomics/AtomicStrongReference.swift index 2128b98..4a33710 100644 --- a/Sources/Atomics/AtomicStrongReference.swift +++ b/Sources/Atomics/AtomicStrongReference.swift @@ -12,6 +12,10 @@ import _AtomicsShims +// Double-wide atomic primitives on x86_64 CPUs aren't available by default +// on Linux distributions, and we cannot currently enable them automatically. +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS + /// A class type that supports atomic strong references. public protocol AtomicReference: AnyObject, AtomicOptionalWrappable where @@ -569,3 +573,4 @@ extension AtomicOptionalReferenceStorage: AtomicStorage { } } +#endif // ENABLE_DOUBLEWIDE_ATOMICS diff --git a/Sources/Atomics/IntegerConformances.swift.gyb b/Sources/Atomics/IntegerConformances.swift.gyb index 9e1b2c7..6df520d 100644 --- a/Sources/Atomics/IntegerConformances.swift.gyb +++ b/Sources/Atomics/IntegerConformances.swift.gyb @@ -24,6 +24,11 @@ ${autogenerated_warning()} import _AtomicsShims % for swiftType in atomicTypes(): +% if swiftType == "DoubleWord": +// Double-wide atomic primitives on x86_64 CPUs aren't available by default +// on Linux distributions, and we cannot currently enable them automatically. +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +% end extension ${swiftType}: AtomicValue { public struct AtomicRepresentation { public typealias Value = ${swiftType} @@ -219,4 +224,7 @@ extension ${swiftType}.AtomicRepresentation: AtomicIntegerStorage { } % end +% if swiftType == "DoubleWord": +#endif // ENABLE_DOUBLEWIDE_ATOMICS +% end % end diff --git a/Sources/Atomics/autogenerated/IntegerConformances.swift b/Sources/Atomics/autogenerated/IntegerConformances.swift index d7bd0a4..04b01b1 100644 --- a/Sources/Atomics/autogenerated/IntegerConformances.swift +++ b/Sources/Atomics/autogenerated/IntegerConformances.swift @@ -4939,6 +4939,9 @@ extension UInt8.AtomicRepresentation: AtomicIntegerStorage { } } +// Double-wide atomic primitives on x86_64 CPUs aren't available by default +// on Linux distributions, and we cannot currently enable them automatically. +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS extension DoubleWord: AtomicValue { public struct AtomicRepresentation { public typealias Value = DoubleWord @@ -5262,3 +5265,4 @@ extension DoubleWord.AtomicRepresentation: AtomicStorage { } +#endif // ENABLE_DOUBLEWIDE_ATOMICS diff --git a/Sources/_AtomicsShims/include/_AtomicsShims.h b/Sources/_AtomicsShims/include/_AtomicsShims.h index 9d10a2f..47c2c61 100644 --- a/Sources/_AtomicsShims/include/_AtomicsShims.h +++ b/Sources/_AtomicsShims/include/_AtomicsShims.h @@ -59,6 +59,20 @@ #include #include +// For now, assume double-wide atomics are available everywhere, +// except on Linux/x86_64, where they need to be manually enabled +// by the `cx16` target attribute. (Unfortunately we cannot currently +// turn that on in our package description.) +#ifdef __APPLE__ +# define ENABLE_DOUBLEWIDE_ATOMICS 1 +#elif defined(_WIN32) +# define ENABLE_DOUBLEWIDE_ATOMICS 1 +#elif defined(__linux__) +# if !defined(__x86_64__) || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) +# define ENABLE_DOUBLEWIDE_ATOMICS 1 +# endif +#endif + #define SWIFTATOMIC_INLINE static inline __attribute__((__always_inline__)) #define SWIFTATOMIC_SWIFT_NAME(name) __attribute__((swift_name(#name))) @@ -320,9 +334,13 @@ _sa_dword _sa_decode_dword(__uint128_t value) { return result; } +#if ENABLE_DOUBLEWIDE_ATOMICS #define SWIFTATOMIC_ENCODE_DoubleWord(_value) (_value).value #define SWIFTATOMIC_DECODE_DoubleWord(value) _sa_decode_dword(value) SWIFTATOMIC_DEFINE_TYPE(COMPLEX, DoubleWord, _sa_dword, __uint128_t) +#else +SWIFTATOMIC_STORAGE_TYPE(DoubleWord, _sa_dword, __uint128_t) +#endif #elif __INTPTR_WIDTH__ == 32 @@ -352,15 +370,21 @@ _sa_dword _sa_decode_dword(uint64_t value) { return result; } +#if ENABLE_DOUBLEWIDE_ATOMICS #define SWIFTATOMIC_ENCODE_DoubleWord(_value) (_value).value #define SWIFTATOMIC_DECODE_DoubleWord(value) _sa_decode_dword(value) SWIFTATOMIC_DEFINE_TYPE(COMPLEX, DoubleWord, _sa_dword, uint64_t) +#else +SWIFTATOMIC_STORAGE_TYPE(DoubleWord, _sa_dword, uint64_t) +#endif // ENABLE_DOUBLEWIDE_ATOMICS #else #error "Unsupported intptr_t bit width" #endif // __INTPTR_WIDTH +#if ENABLE_DOUBLEWIDE_ATOMICS extern void _sa_retain_n(void *object, uint32_t n); extern void _sa_release_n(void *object, uint32_t n); +#endif #endif //SWIFTATOMIC_HEADER_INCLUDED diff --git a/Sources/_AtomicsShims/src/_AtomicsShims.c b/Sources/_AtomicsShims/src/_AtomicsShims.c index 39a744b..ee26e1a 100644 --- a/Sources/_AtomicsShims/src/_AtomicsShims.c +++ b/Sources/_AtomicsShims/src/_AtomicsShims.c @@ -10,14 +10,23 @@ // //===----------------------------------------------------------------------===// +#include #include "_AtomicsShims.h" -void _sa_retain_n(void *object, uint32_t n) { +#if ENABLE_DOUBLEWIDE_ATOMICS +// FIXME: These should be static inline header-only shims, but Swift 5.3 doesn't +// like calls to swift_retain_n/swift_release_n appearing in Swift code, not +// even when imported through C. (See https://bugs.swift.org/browse/SR-13708) + +void _sa_retain_n(void *object, uint32_t n) +{ extern void *swift_retain_n(void *object, uint32_t n); swift_retain_n(object, n); } -void _sa_release_n(void *object, uint32_t n) { +void _sa_release_n(void *object, uint32_t n) +{ extern void swift_release_n(void *object, uint32_t n); swift_release_n(object, n); } +#endif diff --git a/Tests/AtomicsTests/Basics.swift.gyb b/Tests/AtomicsTests/Basics.swift.gyb index 31bd72e..99a4772 100644 --- a/Tests/AtomicsTests/Basics.swift.gyb +++ b/Tests/AtomicsTests/Basics.swift.gyb @@ -28,22 +28,26 @@ ("UInt64", "UInt64", "12", "23"), ("Bool", "Bool", "true", "false"), - ("DoubleWord", "DoubleWord", "DoubleWord(high: 100, low: 64)", "DoubleWord(high: 50, low: 32)"), - ("Pointer", "UnsafePointer", "_foo1", "_foo2"), - ("OptionalPointer", "UnsafePointer?", "nil", "_foo2"), - ("MutablePointer", "UnsafeMutablePointer", "_mfoo1", "_mfoo2"), - ("OptionalMutablePointer", "UnsafeMutablePointer?", "nil", "_mfoo2"), - ("RawPointer", "UnsafeMutableRawPointer", "_raw1", "_raw2"), - ("OptionalRawPointer", "UnsafeMutableRawPointer?", "nil", "_raw2"), + ("Pointer", "UnsafePointer", "_foo1", "_foo2"), + ("OptionalPointer", "UnsafePointer?", "nil", "_foo2"), + ("MutablePointer", "UnsafeMutablePointer", "_mfoo1", "_mfoo2"), + ("OptionalMutablePointer", "UnsafeMutablePointer?", "nil", "_mfoo2"), + + ("RawPointer", "UnsafeRawPointer", "_raw1", "_raw2"), + ("OptionalRawPointer", "UnsafeRawPointer?", "nil", "_raw2"), + ("MutableRawPointer", "UnsafeMutableRawPointer", "_mraw1", "_mraw2"), + ("OptionalMutableRawPointer", "UnsafeMutableRawPointer?", "nil", "_mraw2"), - ("Unmanaged", "Unmanaged", "_bar1", "_bar2"), - ("OptionalUnmanaged", "Unmanaged?", "nil", "_bar2"), + ("Unmanaged", "Unmanaged", "_bar1", "_bar2"), + ("OptionalUnmanaged", "Unmanaged?", "nil", "_bar2"), - ("Reference", "Baz", "_baz1", "_baz2"), - ("OptionalReference", "Baz?", "nil", "_baz2"), + ("RawRepresentable", "Fred", "Fred.one", "Fred.two"), + + ("DoubleWord", "DoubleWord", "DoubleWord(high: 100, low: 64)", "DoubleWord(high: 50, low: 32)"), - ("RawRepresentable", "Fred", "Fred.one", "Fred.two"), + ("Reference", "Baz", "_baz1", "_baz2"), + ("OptionalReference", "Baz?", "nil", "_baz2"), ] }% ${autogenerated_warning()} @@ -72,6 +76,7 @@ private class Bar: Equatable, CustomStringConvertible { } } +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS private class Baz: Equatable, CustomStringConvertible, AtomicReference { var value: Int init(_ value: Int) { self.value = value } @@ -80,21 +85,28 @@ private class Baz: Equatable, CustomStringConvertible, AtomicReference { left === right } } +#endif private enum Fred: Int, AtomicValue { case one case two } +% for label, type, a, b in types: +% if label == "DoubleWord" or label == "Reference" or label == "OptionalReference": +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +% else: +#if true +% end /// Exercises all operations in a single-threaded context, verifying /// they provide the expected results. -class BasicAtomicTests: XCTestCase { +class BasicAtomic${label}Tests: XCTestCase { +% if label == "Pointer" or label == "OptionalPointer" or label == "MutablePointer" or label == "OptionalMutablePointer": private let _mfoo1: UnsafeMutablePointer = { let p = UnsafeMutablePointer.allocate(capacity: 1) p.initialize(to: Foo(1)) return p }() - private let _mfoo2: UnsafeMutablePointer = { let p = UnsafeMutablePointer.allocate(capacity: 1) p.initialize(to: Foo(2)) @@ -104,29 +116,38 @@ class BasicAtomicTests: XCTestCase { private var _foo1: UnsafePointer { UnsafePointer(_mfoo1) } private var _foo2: UnsafePointer { UnsafePointer(_mfoo2) } - private let _raw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) - private let _raw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) - private let _bar1 = Unmanaged.passRetained(Bar(1)) - private let _bar2 = Unmanaged.passRetained(Bar(2)) - private let _baz1 = Baz(1) - private let _baz2 = Baz(2) - deinit { _mfoo1.deinitialize(count: 1) _mfoo1.deallocate() _mfoo2.deinitialize(count: 1) _mfoo2.deallocate() + } +% elif label == "RawPointer" or label == "OptionalRawPointer" or label == "MutableRawPointer" or label == "OptionalMutableRawPointer": + private let _mraw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private let _mraw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) - _raw1.deallocate() - _raw2.deallocate() + private var _raw1: UnsafeRawPointer { UnsafeRawPointer(_mraw1) } + private var _raw2: UnsafeRawPointer { UnsafeRawPointer(_mraw2) } + deinit { + _mraw1.deallocate() + _mraw2.deallocate() + } +% elif label == "Unmanaged" or label == "OptionalUnmanaged": + private let _bar1 = Unmanaged.passRetained(Bar(1)) + private let _bar2 = Unmanaged.passRetained(Bar(2)) + + deinit { _bar1.release() _bar2.release() } +% elif label == "Reference" or label == "OptionalReference": + private let _baz1 = Baz(1) + private let _baz2 = Baz(2) +% end -% for label, type, a, b in types: - func test_${label}_create_destroy() { + func test_create_destroy() { let v = UnsafeAtomic<${type}>.create(${a}) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), ${a}) @@ -137,7 +158,7 @@ class BasicAtomicTests: XCTestCase { } % for (order, _) in loadOrderings: - func test_${label}_load_${order}() { + func test_load_${order}() { let v = UnsafeAtomic<${type}>.create(${a}) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .${order}), ${a}) @@ -149,7 +170,7 @@ class BasicAtomicTests: XCTestCase { % end % for (order, _) in storeOrderings: - func test_${label}_store_${order}() { + func test_store_${order}() { let v = UnsafeAtomic<${type}>.create(${a}) defer { v.destroy() } v.store(${b}, ordering: .${order}) @@ -163,7 +184,7 @@ class BasicAtomicTests: XCTestCase { % end % for (order, _, _) in updateOrderings: - func test_${label}_exchange_${order}() { + func test_exchange_${order}() { let v = UnsafeAtomic<${type}>.create(${a}) defer { v.destroy() } @@ -179,7 +200,7 @@ class BasicAtomicTests: XCTestCase { % end % for (order, _, _) in updateOrderings: - func test_${label}_compareExchange_${order}() { + func test_compareExchange_${order}() { let v = UnsafeAtomic<${type}>.create(${a}) defer { v.destroy() } @@ -220,7 +241,7 @@ class BasicAtomicTests: XCTestCase { % for operation in ["compareExchange", "weakCompareExchange"]: % for (successorder, _, _) in updateOrderings: % for (failorder, _) in loadOrderings: - func test_${label}_${operation}_${successorder}_${failorder}() { + func test_${operation}_${successorder}_${failorder}() { let v = UnsafeAtomic<${type}>.create(${a}) defer { v.destroy() } @@ -265,12 +286,11 @@ class BasicAtomicTests: XCTestCase { % end -// Bool operations - % if type == "Bool": + // Bool operations % for (name, _, operator, arglabel, _) in boolOperations: % for (order, _, _) in updateOrderings: - func test_${label}_loadThen${name}_${order}() { + func test_loadThen${name}_${order}() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -292,7 +312,7 @@ class BasicAtomicTests: XCTestCase { % for (name, _, operator, arglabel, _) in boolOperations: % for (order, _, _) in updateOrderings: - func test_${label}_${lowerFirst(name)}ThenLoad_${order}() { + func test_${lowerFirst(name)}ThenLoad_${order}() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -315,12 +335,11 @@ class BasicAtomicTests: XCTestCase { % end % end -// Integer operations - % if type.startswith("Int") or type.startswith("UInt"): +// Integer operations % for (name, _, operator, arglabel, _) in integerOperations: % for (order, _, _) in updateOrderings: - func test_${label}_loadThen${name}_${order}() { + func test_loadThen${name}_${order}() { let a: ${type} = 3 let b: ${type} = 8 let c: ${type} = 12 @@ -343,7 +362,7 @@ class BasicAtomicTests: XCTestCase { % for (name, _, operator, arglabel, _) in integerOperations: % for (order, _, _) in updateOrderings: - func test_${label}_${lowerFirst(name)}ThenLoad_${order}() { + func test_${lowerFirst(name)}ThenLoad_${order}() { let a: ${type} = 3 let b: ${type} = 8 let c: ${type} = 12 @@ -365,5 +384,6 @@ class BasicAtomicTests: XCTestCase { % end % end -% end } +#endif +% end diff --git a/Tests/AtomicsTests/LockFreeQueue.swift b/Tests/AtomicsTests/LockFreeQueue.swift index bfc0b56..3180075 100644 --- a/Tests/AtomicsTests/LockFreeQueue.swift +++ b/Tests/AtomicsTests/LockFreeQueue.swift @@ -28,6 +28,9 @@ import XCTest import Dispatch import Atomics +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +private let nodeCount = ManagedAtomic(0) + class LockFreeQueue { class Node: AtomicReference { let next: ManagedAtomic @@ -36,6 +39,7 @@ class LockFreeQueue { init(value: Element?, next: Node?) { self.value = value self.next = ManagedAtomic(next) + nodeCount.wrappingIncrement(ordering: .relaxed) } deinit { @@ -52,6 +56,7 @@ class LockFreeQueue { if values > 0 { print(values) } + nodeCount.wrappingDecrement(ordering: .relaxed) } } @@ -128,6 +133,10 @@ class LockFreeQueue { } class QueueTests: XCTestCase { + override func tearDown() { + XCTAssertEqual(nodeCount.load(ordering: .relaxed), 0) + } + func check(readers: Int, writers: Int, count: Int) { let queue = LockFreeQueue<(writer: Int, value: Int)>() let num = ManagedAtomic(0) @@ -169,3 +178,4 @@ class QueueTests: XCTestCase { } } +#endif diff --git a/Tests/AtomicsTests/StrongReferenceRace.swift b/Tests/AtomicsTests/StrongReferenceRace.swift index 79ad6db..3889f58 100644 --- a/Tests/AtomicsTests/StrongReferenceRace.swift +++ b/Tests/AtomicsTests/StrongReferenceRace.swift @@ -14,6 +14,7 @@ import XCTest import Atomics import Dispatch +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS let iterations = 1_000_000 private class Node: AtomicReference { @@ -227,3 +228,4 @@ class StrongReferenceRace: XCTestCase { func testLifetimes_08() { checkLifetimes(count: 8, iterations: iterations) } func testLifetimes_16() { checkLifetimes(count: 16, iterations: iterations) } } +#endif diff --git a/Tests/AtomicsTests/StrongReferenceShuffle.swift b/Tests/AtomicsTests/StrongReferenceShuffle.swift index 1d14739..a739ee8 100644 --- a/Tests/AtomicsTests/StrongReferenceShuffle.swift +++ b/Tests/AtomicsTests/StrongReferenceShuffle.swift @@ -19,7 +19,8 @@ import XCTest import Atomics import Dispatch -let nodeCount = ManagedAtomic(0) +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +private let nodeCount = ManagedAtomic(0) private class List { class Node: AtomicReference { @@ -256,3 +257,4 @@ class StrongReferenceShuffleTests: XCTestCase { func test_sink_04_08() { checkSink(writers: 4, readers: 8, iterations: iterations) } func test_sink_08_08() { checkSink(writers: 8, readers: 8, iterations: iterations) } } +#endif diff --git a/Tests/AtomicsTests/XCTestManifests.swift b/Tests/AtomicsTests/XCTestManifests.swift deleted file mode 100644 index 8d9dec5..0000000 --- a/Tests/AtomicsTests/XCTestManifests.swift +++ /dev/null @@ -1,1765 +0,0 @@ -#if !canImport(ObjectiveC) -import XCTest - -extension BasicAtomicTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__BasicAtomicTests = [ - ("test_Bool_compareExchange_acquiring", test_Bool_compareExchange_acquiring), - ("test_Bool_compareExchange_acquiring_acquiring", test_Bool_compareExchange_acquiring_acquiring), - ("test_Bool_compareExchange_acquiring_relaxed", test_Bool_compareExchange_acquiring_relaxed), - ("test_Bool_compareExchange_acquiring_sequentiallyConsistent", test_Bool_compareExchange_acquiring_sequentiallyConsistent), - ("test_Bool_compareExchange_acquiringAndReleasing", test_Bool_compareExchange_acquiringAndReleasing), - ("test_Bool_compareExchange_acquiringAndReleasing_acquiring", test_Bool_compareExchange_acquiringAndReleasing_acquiring), - ("test_Bool_compareExchange_acquiringAndReleasing_relaxed", test_Bool_compareExchange_acquiringAndReleasing_relaxed), - ("test_Bool_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Bool_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Bool_compareExchange_relaxed", test_Bool_compareExchange_relaxed), - ("test_Bool_compareExchange_relaxed_acquiring", test_Bool_compareExchange_relaxed_acquiring), - ("test_Bool_compareExchange_relaxed_relaxed", test_Bool_compareExchange_relaxed_relaxed), - ("test_Bool_compareExchange_relaxed_sequentiallyConsistent", test_Bool_compareExchange_relaxed_sequentiallyConsistent), - ("test_Bool_compareExchange_releasing", test_Bool_compareExchange_releasing), - ("test_Bool_compareExchange_releasing_acquiring", test_Bool_compareExchange_releasing_acquiring), - ("test_Bool_compareExchange_releasing_relaxed", test_Bool_compareExchange_releasing_relaxed), - ("test_Bool_compareExchange_releasing_sequentiallyConsistent", test_Bool_compareExchange_releasing_sequentiallyConsistent), - ("test_Bool_compareExchange_sequentiallyConsistent", test_Bool_compareExchange_sequentiallyConsistent), - ("test_Bool_compareExchange_sequentiallyConsistent_acquiring", test_Bool_compareExchange_sequentiallyConsistent_acquiring), - ("test_Bool_compareExchange_sequentiallyConsistent_relaxed", test_Bool_compareExchange_sequentiallyConsistent_relaxed), - ("test_Bool_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Bool_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Bool_create_destroy", test_Bool_create_destroy), - ("test_Bool_exchange_acquiring", test_Bool_exchange_acquiring), - ("test_Bool_exchange_acquiringAndReleasing", test_Bool_exchange_acquiringAndReleasing), - ("test_Bool_exchange_relaxed", test_Bool_exchange_relaxed), - ("test_Bool_exchange_releasing", test_Bool_exchange_releasing), - ("test_Bool_exchange_sequentiallyConsistent", test_Bool_exchange_sequentiallyConsistent), - ("test_Bool_load_acquiring", test_Bool_load_acquiring), - ("test_Bool_load_relaxed", test_Bool_load_relaxed), - ("test_Bool_load_sequentiallyConsistent", test_Bool_load_sequentiallyConsistent), - ("test_Bool_loadThenLogicalAnd_acquiring", test_Bool_loadThenLogicalAnd_acquiring), - ("test_Bool_loadThenLogicalAnd_acquiringAndReleasing", test_Bool_loadThenLogicalAnd_acquiringAndReleasing), - ("test_Bool_loadThenLogicalAnd_relaxed", test_Bool_loadThenLogicalAnd_relaxed), - ("test_Bool_loadThenLogicalAnd_releasing", test_Bool_loadThenLogicalAnd_releasing), - ("test_Bool_loadThenLogicalAnd_sequentiallyConsistent", test_Bool_loadThenLogicalAnd_sequentiallyConsistent), - ("test_Bool_loadThenLogicalOr_acquiring", test_Bool_loadThenLogicalOr_acquiring), - ("test_Bool_loadThenLogicalOr_acquiringAndReleasing", test_Bool_loadThenLogicalOr_acquiringAndReleasing), - ("test_Bool_loadThenLogicalOr_relaxed", test_Bool_loadThenLogicalOr_relaxed), - ("test_Bool_loadThenLogicalOr_releasing", test_Bool_loadThenLogicalOr_releasing), - ("test_Bool_loadThenLogicalOr_sequentiallyConsistent", test_Bool_loadThenLogicalOr_sequentiallyConsistent), - ("test_Bool_loadThenLogicalXor_acquiring", test_Bool_loadThenLogicalXor_acquiring), - ("test_Bool_loadThenLogicalXor_acquiringAndReleasing", test_Bool_loadThenLogicalXor_acquiringAndReleasing), - ("test_Bool_loadThenLogicalXor_relaxed", test_Bool_loadThenLogicalXor_relaxed), - ("test_Bool_loadThenLogicalXor_releasing", test_Bool_loadThenLogicalXor_releasing), - ("test_Bool_loadThenLogicalXor_sequentiallyConsistent", test_Bool_loadThenLogicalXor_sequentiallyConsistent), - ("test_Bool_logicalAndThenLoad_acquiring", test_Bool_logicalAndThenLoad_acquiring), - ("test_Bool_logicalAndThenLoad_acquiringAndReleasing", test_Bool_logicalAndThenLoad_acquiringAndReleasing), - ("test_Bool_logicalAndThenLoad_relaxed", test_Bool_logicalAndThenLoad_relaxed), - ("test_Bool_logicalAndThenLoad_releasing", test_Bool_logicalAndThenLoad_releasing), - ("test_Bool_logicalAndThenLoad_sequentiallyConsistent", test_Bool_logicalAndThenLoad_sequentiallyConsistent), - ("test_Bool_logicalOrThenLoad_acquiring", test_Bool_logicalOrThenLoad_acquiring), - ("test_Bool_logicalOrThenLoad_acquiringAndReleasing", test_Bool_logicalOrThenLoad_acquiringAndReleasing), - ("test_Bool_logicalOrThenLoad_relaxed", test_Bool_logicalOrThenLoad_relaxed), - ("test_Bool_logicalOrThenLoad_releasing", test_Bool_logicalOrThenLoad_releasing), - ("test_Bool_logicalOrThenLoad_sequentiallyConsistent", test_Bool_logicalOrThenLoad_sequentiallyConsistent), - ("test_Bool_logicalXorThenLoad_acquiring", test_Bool_logicalXorThenLoad_acquiring), - ("test_Bool_logicalXorThenLoad_acquiringAndReleasing", test_Bool_logicalXorThenLoad_acquiringAndReleasing), - ("test_Bool_logicalXorThenLoad_relaxed", test_Bool_logicalXorThenLoad_relaxed), - ("test_Bool_logicalXorThenLoad_releasing", test_Bool_logicalXorThenLoad_releasing), - ("test_Bool_logicalXorThenLoad_sequentiallyConsistent", test_Bool_logicalXorThenLoad_sequentiallyConsistent), - ("test_Bool_store_relaxed", test_Bool_store_relaxed), - ("test_Bool_store_releasing", test_Bool_store_releasing), - ("test_Bool_store_sequentiallyConsistent", test_Bool_store_sequentiallyConsistent), - ("test_Bool_weakCompareExchange_acquiring_acquiring", test_Bool_weakCompareExchange_acquiring_acquiring), - ("test_Bool_weakCompareExchange_acquiring_relaxed", test_Bool_weakCompareExchange_acquiring_relaxed), - ("test_Bool_weakCompareExchange_acquiring_sequentiallyConsistent", test_Bool_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Bool_weakCompareExchange_acquiringAndReleasing_acquiring", test_Bool_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Bool_weakCompareExchange_acquiringAndReleasing_relaxed", test_Bool_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Bool_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Bool_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Bool_weakCompareExchange_relaxed_acquiring", test_Bool_weakCompareExchange_relaxed_acquiring), - ("test_Bool_weakCompareExchange_relaxed_relaxed", test_Bool_weakCompareExchange_relaxed_relaxed), - ("test_Bool_weakCompareExchange_relaxed_sequentiallyConsistent", test_Bool_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Bool_weakCompareExchange_releasing_acquiring", test_Bool_weakCompareExchange_releasing_acquiring), - ("test_Bool_weakCompareExchange_releasing_relaxed", test_Bool_weakCompareExchange_releasing_relaxed), - ("test_Bool_weakCompareExchange_releasing_sequentiallyConsistent", test_Bool_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Bool_weakCompareExchange_sequentiallyConsistent_acquiring", test_Bool_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Bool_weakCompareExchange_sequentiallyConsistent_relaxed", test_Bool_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Bool_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Bool_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_DoubleWord_compareExchange_acquiring", test_DoubleWord_compareExchange_acquiring), - ("test_DoubleWord_compareExchange_acquiring_acquiring", test_DoubleWord_compareExchange_acquiring_acquiring), - ("test_DoubleWord_compareExchange_acquiring_relaxed", test_DoubleWord_compareExchange_acquiring_relaxed), - ("test_DoubleWord_compareExchange_acquiring_sequentiallyConsistent", test_DoubleWord_compareExchange_acquiring_sequentiallyConsistent), - ("test_DoubleWord_compareExchange_acquiringAndReleasing", test_DoubleWord_compareExchange_acquiringAndReleasing), - ("test_DoubleWord_compareExchange_acquiringAndReleasing_acquiring", test_DoubleWord_compareExchange_acquiringAndReleasing_acquiring), - ("test_DoubleWord_compareExchange_acquiringAndReleasing_relaxed", test_DoubleWord_compareExchange_acquiringAndReleasing_relaxed), - ("test_DoubleWord_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_DoubleWord_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_DoubleWord_compareExchange_relaxed", test_DoubleWord_compareExchange_relaxed), - ("test_DoubleWord_compareExchange_relaxed_acquiring", test_DoubleWord_compareExchange_relaxed_acquiring), - ("test_DoubleWord_compareExchange_relaxed_relaxed", test_DoubleWord_compareExchange_relaxed_relaxed), - ("test_DoubleWord_compareExchange_relaxed_sequentiallyConsistent", test_DoubleWord_compareExchange_relaxed_sequentiallyConsistent), - ("test_DoubleWord_compareExchange_releasing", test_DoubleWord_compareExchange_releasing), - ("test_DoubleWord_compareExchange_releasing_acquiring", test_DoubleWord_compareExchange_releasing_acquiring), - ("test_DoubleWord_compareExchange_releasing_relaxed", test_DoubleWord_compareExchange_releasing_relaxed), - ("test_DoubleWord_compareExchange_releasing_sequentiallyConsistent", test_DoubleWord_compareExchange_releasing_sequentiallyConsistent), - ("test_DoubleWord_compareExchange_sequentiallyConsistent", test_DoubleWord_compareExchange_sequentiallyConsistent), - ("test_DoubleWord_compareExchange_sequentiallyConsistent_acquiring", test_DoubleWord_compareExchange_sequentiallyConsistent_acquiring), - ("test_DoubleWord_compareExchange_sequentiallyConsistent_relaxed", test_DoubleWord_compareExchange_sequentiallyConsistent_relaxed), - ("test_DoubleWord_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_DoubleWord_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_DoubleWord_create_destroy", test_DoubleWord_create_destroy), - ("test_DoubleWord_exchange_acquiring", test_DoubleWord_exchange_acquiring), - ("test_DoubleWord_exchange_acquiringAndReleasing", test_DoubleWord_exchange_acquiringAndReleasing), - ("test_DoubleWord_exchange_relaxed", test_DoubleWord_exchange_relaxed), - ("test_DoubleWord_exchange_releasing", test_DoubleWord_exchange_releasing), - ("test_DoubleWord_exchange_sequentiallyConsistent", test_DoubleWord_exchange_sequentiallyConsistent), - ("test_DoubleWord_load_acquiring", test_DoubleWord_load_acquiring), - ("test_DoubleWord_load_relaxed", test_DoubleWord_load_relaxed), - ("test_DoubleWord_load_sequentiallyConsistent", test_DoubleWord_load_sequentiallyConsistent), - ("test_DoubleWord_store_relaxed", test_DoubleWord_store_relaxed), - ("test_DoubleWord_store_releasing", test_DoubleWord_store_releasing), - ("test_DoubleWord_store_sequentiallyConsistent", test_DoubleWord_store_sequentiallyConsistent), - ("test_DoubleWord_weakCompareExchange_acquiring_acquiring", test_DoubleWord_weakCompareExchange_acquiring_acquiring), - ("test_DoubleWord_weakCompareExchange_acquiring_relaxed", test_DoubleWord_weakCompareExchange_acquiring_relaxed), - ("test_DoubleWord_weakCompareExchange_acquiring_sequentiallyConsistent", test_DoubleWord_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_DoubleWord_weakCompareExchange_acquiringAndReleasing_acquiring", test_DoubleWord_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_DoubleWord_weakCompareExchange_acquiringAndReleasing_relaxed", test_DoubleWord_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_DoubleWord_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_DoubleWord_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_DoubleWord_weakCompareExchange_relaxed_acquiring", test_DoubleWord_weakCompareExchange_relaxed_acquiring), - ("test_DoubleWord_weakCompareExchange_relaxed_relaxed", test_DoubleWord_weakCompareExchange_relaxed_relaxed), - ("test_DoubleWord_weakCompareExchange_relaxed_sequentiallyConsistent", test_DoubleWord_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_DoubleWord_weakCompareExchange_releasing_acquiring", test_DoubleWord_weakCompareExchange_releasing_acquiring), - ("test_DoubleWord_weakCompareExchange_releasing_relaxed", test_DoubleWord_weakCompareExchange_releasing_relaxed), - ("test_DoubleWord_weakCompareExchange_releasing_sequentiallyConsistent", test_DoubleWord_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_DoubleWord_weakCompareExchange_sequentiallyConsistent_acquiring", test_DoubleWord_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_DoubleWord_weakCompareExchange_sequentiallyConsistent_relaxed", test_DoubleWord_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_DoubleWord_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_DoubleWord_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int16_bitwiseAndThenLoad_acquiring", test_Int16_bitwiseAndThenLoad_acquiring), - ("test_Int16_bitwiseAndThenLoad_acquiringAndReleasing", test_Int16_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_Int16_bitwiseAndThenLoad_relaxed", test_Int16_bitwiseAndThenLoad_relaxed), - ("test_Int16_bitwiseAndThenLoad_releasing", test_Int16_bitwiseAndThenLoad_releasing), - ("test_Int16_bitwiseAndThenLoad_sequentiallyConsistent", test_Int16_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_Int16_bitwiseOrThenLoad_acquiring", test_Int16_bitwiseOrThenLoad_acquiring), - ("test_Int16_bitwiseOrThenLoad_acquiringAndReleasing", test_Int16_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_Int16_bitwiseOrThenLoad_relaxed", test_Int16_bitwiseOrThenLoad_relaxed), - ("test_Int16_bitwiseOrThenLoad_releasing", test_Int16_bitwiseOrThenLoad_releasing), - ("test_Int16_bitwiseOrThenLoad_sequentiallyConsistent", test_Int16_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_Int16_bitwiseXorThenLoad_acquiring", test_Int16_bitwiseXorThenLoad_acquiring), - ("test_Int16_bitwiseXorThenLoad_acquiringAndReleasing", test_Int16_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_Int16_bitwiseXorThenLoad_relaxed", test_Int16_bitwiseXorThenLoad_relaxed), - ("test_Int16_bitwiseXorThenLoad_releasing", test_Int16_bitwiseXorThenLoad_releasing), - ("test_Int16_bitwiseXorThenLoad_sequentiallyConsistent", test_Int16_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_Int16_compareExchange_acquiring", test_Int16_compareExchange_acquiring), - ("test_Int16_compareExchange_acquiring_acquiring", test_Int16_compareExchange_acquiring_acquiring), - ("test_Int16_compareExchange_acquiring_relaxed", test_Int16_compareExchange_acquiring_relaxed), - ("test_Int16_compareExchange_acquiring_sequentiallyConsistent", test_Int16_compareExchange_acquiring_sequentiallyConsistent), - ("test_Int16_compareExchange_acquiringAndReleasing", test_Int16_compareExchange_acquiringAndReleasing), - ("test_Int16_compareExchange_acquiringAndReleasing_acquiring", test_Int16_compareExchange_acquiringAndReleasing_acquiring), - ("test_Int16_compareExchange_acquiringAndReleasing_relaxed", test_Int16_compareExchange_acquiringAndReleasing_relaxed), - ("test_Int16_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int16_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int16_compareExchange_relaxed", test_Int16_compareExchange_relaxed), - ("test_Int16_compareExchange_relaxed_acquiring", test_Int16_compareExchange_relaxed_acquiring), - ("test_Int16_compareExchange_relaxed_relaxed", test_Int16_compareExchange_relaxed_relaxed), - ("test_Int16_compareExchange_relaxed_sequentiallyConsistent", test_Int16_compareExchange_relaxed_sequentiallyConsistent), - ("test_Int16_compareExchange_releasing", test_Int16_compareExchange_releasing), - ("test_Int16_compareExchange_releasing_acquiring", test_Int16_compareExchange_releasing_acquiring), - ("test_Int16_compareExchange_releasing_relaxed", test_Int16_compareExchange_releasing_relaxed), - ("test_Int16_compareExchange_releasing_sequentiallyConsistent", test_Int16_compareExchange_releasing_sequentiallyConsistent), - ("test_Int16_compareExchange_sequentiallyConsistent", test_Int16_compareExchange_sequentiallyConsistent), - ("test_Int16_compareExchange_sequentiallyConsistent_acquiring", test_Int16_compareExchange_sequentiallyConsistent_acquiring), - ("test_Int16_compareExchange_sequentiallyConsistent_relaxed", test_Int16_compareExchange_sequentiallyConsistent_relaxed), - ("test_Int16_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int16_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int16_create_destroy", test_Int16_create_destroy), - ("test_Int16_exchange_acquiring", test_Int16_exchange_acquiring), - ("test_Int16_exchange_acquiringAndReleasing", test_Int16_exchange_acquiringAndReleasing), - ("test_Int16_exchange_relaxed", test_Int16_exchange_relaxed), - ("test_Int16_exchange_releasing", test_Int16_exchange_releasing), - ("test_Int16_exchange_sequentiallyConsistent", test_Int16_exchange_sequentiallyConsistent), - ("test_Int16_load_acquiring", test_Int16_load_acquiring), - ("test_Int16_load_relaxed", test_Int16_load_relaxed), - ("test_Int16_load_sequentiallyConsistent", test_Int16_load_sequentiallyConsistent), - ("test_Int16_loadThenBitwiseAnd_acquiring", test_Int16_loadThenBitwiseAnd_acquiring), - ("test_Int16_loadThenBitwiseAnd_acquiringAndReleasing", test_Int16_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_Int16_loadThenBitwiseAnd_relaxed", test_Int16_loadThenBitwiseAnd_relaxed), - ("test_Int16_loadThenBitwiseAnd_releasing", test_Int16_loadThenBitwiseAnd_releasing), - ("test_Int16_loadThenBitwiseAnd_sequentiallyConsistent", test_Int16_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_Int16_loadThenBitwiseOr_acquiring", test_Int16_loadThenBitwiseOr_acquiring), - ("test_Int16_loadThenBitwiseOr_acquiringAndReleasing", test_Int16_loadThenBitwiseOr_acquiringAndReleasing), - ("test_Int16_loadThenBitwiseOr_relaxed", test_Int16_loadThenBitwiseOr_relaxed), - ("test_Int16_loadThenBitwiseOr_releasing", test_Int16_loadThenBitwiseOr_releasing), - ("test_Int16_loadThenBitwiseOr_sequentiallyConsistent", test_Int16_loadThenBitwiseOr_sequentiallyConsistent), - ("test_Int16_loadThenBitwiseXor_acquiring", test_Int16_loadThenBitwiseXor_acquiring), - ("test_Int16_loadThenBitwiseXor_acquiringAndReleasing", test_Int16_loadThenBitwiseXor_acquiringAndReleasing), - ("test_Int16_loadThenBitwiseXor_relaxed", test_Int16_loadThenBitwiseXor_relaxed), - ("test_Int16_loadThenBitwiseXor_releasing", test_Int16_loadThenBitwiseXor_releasing), - ("test_Int16_loadThenBitwiseXor_sequentiallyConsistent", test_Int16_loadThenBitwiseXor_sequentiallyConsistent), - ("test_Int16_loadThenWrappingDecrement_acquiring", test_Int16_loadThenWrappingDecrement_acquiring), - ("test_Int16_loadThenWrappingDecrement_acquiringAndReleasing", test_Int16_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_Int16_loadThenWrappingDecrement_relaxed", test_Int16_loadThenWrappingDecrement_relaxed), - ("test_Int16_loadThenWrappingDecrement_releasing", test_Int16_loadThenWrappingDecrement_releasing), - ("test_Int16_loadThenWrappingDecrement_sequentiallyConsistent", test_Int16_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_Int16_loadThenWrappingIncrement_acquiring", test_Int16_loadThenWrappingIncrement_acquiring), - ("test_Int16_loadThenWrappingIncrement_acquiringAndReleasing", test_Int16_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_Int16_loadThenWrappingIncrement_relaxed", test_Int16_loadThenWrappingIncrement_relaxed), - ("test_Int16_loadThenWrappingIncrement_releasing", test_Int16_loadThenWrappingIncrement_releasing), - ("test_Int16_loadThenWrappingIncrement_sequentiallyConsistent", test_Int16_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_Int16_store_relaxed", test_Int16_store_relaxed), - ("test_Int16_store_releasing", test_Int16_store_releasing), - ("test_Int16_store_sequentiallyConsistent", test_Int16_store_sequentiallyConsistent), - ("test_Int16_weakCompareExchange_acquiring_acquiring", test_Int16_weakCompareExchange_acquiring_acquiring), - ("test_Int16_weakCompareExchange_acquiring_relaxed", test_Int16_weakCompareExchange_acquiring_relaxed), - ("test_Int16_weakCompareExchange_acquiring_sequentiallyConsistent", test_Int16_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Int16_weakCompareExchange_acquiringAndReleasing_acquiring", test_Int16_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Int16_weakCompareExchange_acquiringAndReleasing_relaxed", test_Int16_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Int16_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int16_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int16_weakCompareExchange_relaxed_acquiring", test_Int16_weakCompareExchange_relaxed_acquiring), - ("test_Int16_weakCompareExchange_relaxed_relaxed", test_Int16_weakCompareExchange_relaxed_relaxed), - ("test_Int16_weakCompareExchange_relaxed_sequentiallyConsistent", test_Int16_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Int16_weakCompareExchange_releasing_acquiring", test_Int16_weakCompareExchange_releasing_acquiring), - ("test_Int16_weakCompareExchange_releasing_relaxed", test_Int16_weakCompareExchange_releasing_relaxed), - ("test_Int16_weakCompareExchange_releasing_sequentiallyConsistent", test_Int16_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Int16_weakCompareExchange_sequentiallyConsistent_acquiring", test_Int16_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Int16_weakCompareExchange_sequentiallyConsistent_relaxed", test_Int16_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Int16_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int16_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int16_wrappingDecrementThenLoad_acquiring", test_Int16_wrappingDecrementThenLoad_acquiring), - ("test_Int16_wrappingDecrementThenLoad_acquiringAndReleasing", test_Int16_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_Int16_wrappingDecrementThenLoad_relaxed", test_Int16_wrappingDecrementThenLoad_relaxed), - ("test_Int16_wrappingDecrementThenLoad_releasing", test_Int16_wrappingDecrementThenLoad_releasing), - ("test_Int16_wrappingDecrementThenLoad_sequentiallyConsistent", test_Int16_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_Int16_wrappingIncrementThenLoad_acquiring", test_Int16_wrappingIncrementThenLoad_acquiring), - ("test_Int16_wrappingIncrementThenLoad_acquiringAndReleasing", test_Int16_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_Int16_wrappingIncrementThenLoad_relaxed", test_Int16_wrappingIncrementThenLoad_relaxed), - ("test_Int16_wrappingIncrementThenLoad_releasing", test_Int16_wrappingIncrementThenLoad_releasing), - ("test_Int16_wrappingIncrementThenLoad_sequentiallyConsistent", test_Int16_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_Int32_bitwiseAndThenLoad_acquiring", test_Int32_bitwiseAndThenLoad_acquiring), - ("test_Int32_bitwiseAndThenLoad_acquiringAndReleasing", test_Int32_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_Int32_bitwiseAndThenLoad_relaxed", test_Int32_bitwiseAndThenLoad_relaxed), - ("test_Int32_bitwiseAndThenLoad_releasing", test_Int32_bitwiseAndThenLoad_releasing), - ("test_Int32_bitwiseAndThenLoad_sequentiallyConsistent", test_Int32_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_Int32_bitwiseOrThenLoad_acquiring", test_Int32_bitwiseOrThenLoad_acquiring), - ("test_Int32_bitwiseOrThenLoad_acquiringAndReleasing", test_Int32_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_Int32_bitwiseOrThenLoad_relaxed", test_Int32_bitwiseOrThenLoad_relaxed), - ("test_Int32_bitwiseOrThenLoad_releasing", test_Int32_bitwiseOrThenLoad_releasing), - ("test_Int32_bitwiseOrThenLoad_sequentiallyConsistent", test_Int32_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_Int32_bitwiseXorThenLoad_acquiring", test_Int32_bitwiseXorThenLoad_acquiring), - ("test_Int32_bitwiseXorThenLoad_acquiringAndReleasing", test_Int32_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_Int32_bitwiseXorThenLoad_relaxed", test_Int32_bitwiseXorThenLoad_relaxed), - ("test_Int32_bitwiseXorThenLoad_releasing", test_Int32_bitwiseXorThenLoad_releasing), - ("test_Int32_bitwiseXorThenLoad_sequentiallyConsistent", test_Int32_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_Int32_compareExchange_acquiring", test_Int32_compareExchange_acquiring), - ("test_Int32_compareExchange_acquiring_acquiring", test_Int32_compareExchange_acquiring_acquiring), - ("test_Int32_compareExchange_acquiring_relaxed", test_Int32_compareExchange_acquiring_relaxed), - ("test_Int32_compareExchange_acquiring_sequentiallyConsistent", test_Int32_compareExchange_acquiring_sequentiallyConsistent), - ("test_Int32_compareExchange_acquiringAndReleasing", test_Int32_compareExchange_acquiringAndReleasing), - ("test_Int32_compareExchange_acquiringAndReleasing_acquiring", test_Int32_compareExchange_acquiringAndReleasing_acquiring), - ("test_Int32_compareExchange_acquiringAndReleasing_relaxed", test_Int32_compareExchange_acquiringAndReleasing_relaxed), - ("test_Int32_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int32_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int32_compareExchange_relaxed", test_Int32_compareExchange_relaxed), - ("test_Int32_compareExchange_relaxed_acquiring", test_Int32_compareExchange_relaxed_acquiring), - ("test_Int32_compareExchange_relaxed_relaxed", test_Int32_compareExchange_relaxed_relaxed), - ("test_Int32_compareExchange_relaxed_sequentiallyConsistent", test_Int32_compareExchange_relaxed_sequentiallyConsistent), - ("test_Int32_compareExchange_releasing", test_Int32_compareExchange_releasing), - ("test_Int32_compareExchange_releasing_acquiring", test_Int32_compareExchange_releasing_acquiring), - ("test_Int32_compareExchange_releasing_relaxed", test_Int32_compareExchange_releasing_relaxed), - ("test_Int32_compareExchange_releasing_sequentiallyConsistent", test_Int32_compareExchange_releasing_sequentiallyConsistent), - ("test_Int32_compareExchange_sequentiallyConsistent", test_Int32_compareExchange_sequentiallyConsistent), - ("test_Int32_compareExchange_sequentiallyConsistent_acquiring", test_Int32_compareExchange_sequentiallyConsistent_acquiring), - ("test_Int32_compareExchange_sequentiallyConsistent_relaxed", test_Int32_compareExchange_sequentiallyConsistent_relaxed), - ("test_Int32_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int32_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int32_create_destroy", test_Int32_create_destroy), - ("test_Int32_exchange_acquiring", test_Int32_exchange_acquiring), - ("test_Int32_exchange_acquiringAndReleasing", test_Int32_exchange_acquiringAndReleasing), - ("test_Int32_exchange_relaxed", test_Int32_exchange_relaxed), - ("test_Int32_exchange_releasing", test_Int32_exchange_releasing), - ("test_Int32_exchange_sequentiallyConsistent", test_Int32_exchange_sequentiallyConsistent), - ("test_Int32_load_acquiring", test_Int32_load_acquiring), - ("test_Int32_load_relaxed", test_Int32_load_relaxed), - ("test_Int32_load_sequentiallyConsistent", test_Int32_load_sequentiallyConsistent), - ("test_Int32_loadThenBitwiseAnd_acquiring", test_Int32_loadThenBitwiseAnd_acquiring), - ("test_Int32_loadThenBitwiseAnd_acquiringAndReleasing", test_Int32_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_Int32_loadThenBitwiseAnd_relaxed", test_Int32_loadThenBitwiseAnd_relaxed), - ("test_Int32_loadThenBitwiseAnd_releasing", test_Int32_loadThenBitwiseAnd_releasing), - ("test_Int32_loadThenBitwiseAnd_sequentiallyConsistent", test_Int32_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_Int32_loadThenBitwiseOr_acquiring", test_Int32_loadThenBitwiseOr_acquiring), - ("test_Int32_loadThenBitwiseOr_acquiringAndReleasing", test_Int32_loadThenBitwiseOr_acquiringAndReleasing), - ("test_Int32_loadThenBitwiseOr_relaxed", test_Int32_loadThenBitwiseOr_relaxed), - ("test_Int32_loadThenBitwiseOr_releasing", test_Int32_loadThenBitwiseOr_releasing), - ("test_Int32_loadThenBitwiseOr_sequentiallyConsistent", test_Int32_loadThenBitwiseOr_sequentiallyConsistent), - ("test_Int32_loadThenBitwiseXor_acquiring", test_Int32_loadThenBitwiseXor_acquiring), - ("test_Int32_loadThenBitwiseXor_acquiringAndReleasing", test_Int32_loadThenBitwiseXor_acquiringAndReleasing), - ("test_Int32_loadThenBitwiseXor_relaxed", test_Int32_loadThenBitwiseXor_relaxed), - ("test_Int32_loadThenBitwiseXor_releasing", test_Int32_loadThenBitwiseXor_releasing), - ("test_Int32_loadThenBitwiseXor_sequentiallyConsistent", test_Int32_loadThenBitwiseXor_sequentiallyConsistent), - ("test_Int32_loadThenWrappingDecrement_acquiring", test_Int32_loadThenWrappingDecrement_acquiring), - ("test_Int32_loadThenWrappingDecrement_acquiringAndReleasing", test_Int32_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_Int32_loadThenWrappingDecrement_relaxed", test_Int32_loadThenWrappingDecrement_relaxed), - ("test_Int32_loadThenWrappingDecrement_releasing", test_Int32_loadThenWrappingDecrement_releasing), - ("test_Int32_loadThenWrappingDecrement_sequentiallyConsistent", test_Int32_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_Int32_loadThenWrappingIncrement_acquiring", test_Int32_loadThenWrappingIncrement_acquiring), - ("test_Int32_loadThenWrappingIncrement_acquiringAndReleasing", test_Int32_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_Int32_loadThenWrappingIncrement_relaxed", test_Int32_loadThenWrappingIncrement_relaxed), - ("test_Int32_loadThenWrappingIncrement_releasing", test_Int32_loadThenWrappingIncrement_releasing), - ("test_Int32_loadThenWrappingIncrement_sequentiallyConsistent", test_Int32_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_Int32_store_relaxed", test_Int32_store_relaxed), - ("test_Int32_store_releasing", test_Int32_store_releasing), - ("test_Int32_store_sequentiallyConsistent", test_Int32_store_sequentiallyConsistent), - ("test_Int32_weakCompareExchange_acquiring_acquiring", test_Int32_weakCompareExchange_acquiring_acquiring), - ("test_Int32_weakCompareExchange_acquiring_relaxed", test_Int32_weakCompareExchange_acquiring_relaxed), - ("test_Int32_weakCompareExchange_acquiring_sequentiallyConsistent", test_Int32_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Int32_weakCompareExchange_acquiringAndReleasing_acquiring", test_Int32_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Int32_weakCompareExchange_acquiringAndReleasing_relaxed", test_Int32_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Int32_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int32_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int32_weakCompareExchange_relaxed_acquiring", test_Int32_weakCompareExchange_relaxed_acquiring), - ("test_Int32_weakCompareExchange_relaxed_relaxed", test_Int32_weakCompareExchange_relaxed_relaxed), - ("test_Int32_weakCompareExchange_relaxed_sequentiallyConsistent", test_Int32_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Int32_weakCompareExchange_releasing_acquiring", test_Int32_weakCompareExchange_releasing_acquiring), - ("test_Int32_weakCompareExchange_releasing_relaxed", test_Int32_weakCompareExchange_releasing_relaxed), - ("test_Int32_weakCompareExchange_releasing_sequentiallyConsistent", test_Int32_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Int32_weakCompareExchange_sequentiallyConsistent_acquiring", test_Int32_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Int32_weakCompareExchange_sequentiallyConsistent_relaxed", test_Int32_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Int32_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int32_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int32_wrappingDecrementThenLoad_acquiring", test_Int32_wrappingDecrementThenLoad_acquiring), - ("test_Int32_wrappingDecrementThenLoad_acquiringAndReleasing", test_Int32_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_Int32_wrappingDecrementThenLoad_relaxed", test_Int32_wrappingDecrementThenLoad_relaxed), - ("test_Int32_wrappingDecrementThenLoad_releasing", test_Int32_wrappingDecrementThenLoad_releasing), - ("test_Int32_wrappingDecrementThenLoad_sequentiallyConsistent", test_Int32_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_Int32_wrappingIncrementThenLoad_acquiring", test_Int32_wrappingIncrementThenLoad_acquiring), - ("test_Int32_wrappingIncrementThenLoad_acquiringAndReleasing", test_Int32_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_Int32_wrappingIncrementThenLoad_relaxed", test_Int32_wrappingIncrementThenLoad_relaxed), - ("test_Int32_wrappingIncrementThenLoad_releasing", test_Int32_wrappingIncrementThenLoad_releasing), - ("test_Int32_wrappingIncrementThenLoad_sequentiallyConsistent", test_Int32_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_Int64_bitwiseAndThenLoad_acquiring", test_Int64_bitwiseAndThenLoad_acquiring), - ("test_Int64_bitwiseAndThenLoad_acquiringAndReleasing", test_Int64_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_Int64_bitwiseAndThenLoad_relaxed", test_Int64_bitwiseAndThenLoad_relaxed), - ("test_Int64_bitwiseAndThenLoad_releasing", test_Int64_bitwiseAndThenLoad_releasing), - ("test_Int64_bitwiseAndThenLoad_sequentiallyConsistent", test_Int64_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_Int64_bitwiseOrThenLoad_acquiring", test_Int64_bitwiseOrThenLoad_acquiring), - ("test_Int64_bitwiseOrThenLoad_acquiringAndReleasing", test_Int64_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_Int64_bitwiseOrThenLoad_relaxed", test_Int64_bitwiseOrThenLoad_relaxed), - ("test_Int64_bitwiseOrThenLoad_releasing", test_Int64_bitwiseOrThenLoad_releasing), - ("test_Int64_bitwiseOrThenLoad_sequentiallyConsistent", test_Int64_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_Int64_bitwiseXorThenLoad_acquiring", test_Int64_bitwiseXorThenLoad_acquiring), - ("test_Int64_bitwiseXorThenLoad_acquiringAndReleasing", test_Int64_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_Int64_bitwiseXorThenLoad_relaxed", test_Int64_bitwiseXorThenLoad_relaxed), - ("test_Int64_bitwiseXorThenLoad_releasing", test_Int64_bitwiseXorThenLoad_releasing), - ("test_Int64_bitwiseXorThenLoad_sequentiallyConsistent", test_Int64_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_Int64_compareExchange_acquiring", test_Int64_compareExchange_acquiring), - ("test_Int64_compareExchange_acquiring_acquiring", test_Int64_compareExchange_acquiring_acquiring), - ("test_Int64_compareExchange_acquiring_relaxed", test_Int64_compareExchange_acquiring_relaxed), - ("test_Int64_compareExchange_acquiring_sequentiallyConsistent", test_Int64_compareExchange_acquiring_sequentiallyConsistent), - ("test_Int64_compareExchange_acquiringAndReleasing", test_Int64_compareExchange_acquiringAndReleasing), - ("test_Int64_compareExchange_acquiringAndReleasing_acquiring", test_Int64_compareExchange_acquiringAndReleasing_acquiring), - ("test_Int64_compareExchange_acquiringAndReleasing_relaxed", test_Int64_compareExchange_acquiringAndReleasing_relaxed), - ("test_Int64_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int64_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int64_compareExchange_relaxed", test_Int64_compareExchange_relaxed), - ("test_Int64_compareExchange_relaxed_acquiring", test_Int64_compareExchange_relaxed_acquiring), - ("test_Int64_compareExchange_relaxed_relaxed", test_Int64_compareExchange_relaxed_relaxed), - ("test_Int64_compareExchange_relaxed_sequentiallyConsistent", test_Int64_compareExchange_relaxed_sequentiallyConsistent), - ("test_Int64_compareExchange_releasing", test_Int64_compareExchange_releasing), - ("test_Int64_compareExchange_releasing_acquiring", test_Int64_compareExchange_releasing_acquiring), - ("test_Int64_compareExchange_releasing_relaxed", test_Int64_compareExchange_releasing_relaxed), - ("test_Int64_compareExchange_releasing_sequentiallyConsistent", test_Int64_compareExchange_releasing_sequentiallyConsistent), - ("test_Int64_compareExchange_sequentiallyConsistent", test_Int64_compareExchange_sequentiallyConsistent), - ("test_Int64_compareExchange_sequentiallyConsistent_acquiring", test_Int64_compareExchange_sequentiallyConsistent_acquiring), - ("test_Int64_compareExchange_sequentiallyConsistent_relaxed", test_Int64_compareExchange_sequentiallyConsistent_relaxed), - ("test_Int64_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int64_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int64_create_destroy", test_Int64_create_destroy), - ("test_Int64_exchange_acquiring", test_Int64_exchange_acquiring), - ("test_Int64_exchange_acquiringAndReleasing", test_Int64_exchange_acquiringAndReleasing), - ("test_Int64_exchange_relaxed", test_Int64_exchange_relaxed), - ("test_Int64_exchange_releasing", test_Int64_exchange_releasing), - ("test_Int64_exchange_sequentiallyConsistent", test_Int64_exchange_sequentiallyConsistent), - ("test_Int64_load_acquiring", test_Int64_load_acquiring), - ("test_Int64_load_relaxed", test_Int64_load_relaxed), - ("test_Int64_load_sequentiallyConsistent", test_Int64_load_sequentiallyConsistent), - ("test_Int64_loadThenBitwiseAnd_acquiring", test_Int64_loadThenBitwiseAnd_acquiring), - ("test_Int64_loadThenBitwiseAnd_acquiringAndReleasing", test_Int64_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_Int64_loadThenBitwiseAnd_relaxed", test_Int64_loadThenBitwiseAnd_relaxed), - ("test_Int64_loadThenBitwiseAnd_releasing", test_Int64_loadThenBitwiseAnd_releasing), - ("test_Int64_loadThenBitwiseAnd_sequentiallyConsistent", test_Int64_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_Int64_loadThenBitwiseOr_acquiring", test_Int64_loadThenBitwiseOr_acquiring), - ("test_Int64_loadThenBitwiseOr_acquiringAndReleasing", test_Int64_loadThenBitwiseOr_acquiringAndReleasing), - ("test_Int64_loadThenBitwiseOr_relaxed", test_Int64_loadThenBitwiseOr_relaxed), - ("test_Int64_loadThenBitwiseOr_releasing", test_Int64_loadThenBitwiseOr_releasing), - ("test_Int64_loadThenBitwiseOr_sequentiallyConsistent", test_Int64_loadThenBitwiseOr_sequentiallyConsistent), - ("test_Int64_loadThenBitwiseXor_acquiring", test_Int64_loadThenBitwiseXor_acquiring), - ("test_Int64_loadThenBitwiseXor_acquiringAndReleasing", test_Int64_loadThenBitwiseXor_acquiringAndReleasing), - ("test_Int64_loadThenBitwiseXor_relaxed", test_Int64_loadThenBitwiseXor_relaxed), - ("test_Int64_loadThenBitwiseXor_releasing", test_Int64_loadThenBitwiseXor_releasing), - ("test_Int64_loadThenBitwiseXor_sequentiallyConsistent", test_Int64_loadThenBitwiseXor_sequentiallyConsistent), - ("test_Int64_loadThenWrappingDecrement_acquiring", test_Int64_loadThenWrappingDecrement_acquiring), - ("test_Int64_loadThenWrappingDecrement_acquiringAndReleasing", test_Int64_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_Int64_loadThenWrappingDecrement_relaxed", test_Int64_loadThenWrappingDecrement_relaxed), - ("test_Int64_loadThenWrappingDecrement_releasing", test_Int64_loadThenWrappingDecrement_releasing), - ("test_Int64_loadThenWrappingDecrement_sequentiallyConsistent", test_Int64_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_Int64_loadThenWrappingIncrement_acquiring", test_Int64_loadThenWrappingIncrement_acquiring), - ("test_Int64_loadThenWrappingIncrement_acquiringAndReleasing", test_Int64_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_Int64_loadThenWrappingIncrement_relaxed", test_Int64_loadThenWrappingIncrement_relaxed), - ("test_Int64_loadThenWrappingIncrement_releasing", test_Int64_loadThenWrappingIncrement_releasing), - ("test_Int64_loadThenWrappingIncrement_sequentiallyConsistent", test_Int64_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_Int64_store_relaxed", test_Int64_store_relaxed), - ("test_Int64_store_releasing", test_Int64_store_releasing), - ("test_Int64_store_sequentiallyConsistent", test_Int64_store_sequentiallyConsistent), - ("test_Int64_weakCompareExchange_acquiring_acquiring", test_Int64_weakCompareExchange_acquiring_acquiring), - ("test_Int64_weakCompareExchange_acquiring_relaxed", test_Int64_weakCompareExchange_acquiring_relaxed), - ("test_Int64_weakCompareExchange_acquiring_sequentiallyConsistent", test_Int64_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Int64_weakCompareExchange_acquiringAndReleasing_acquiring", test_Int64_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Int64_weakCompareExchange_acquiringAndReleasing_relaxed", test_Int64_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Int64_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int64_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int64_weakCompareExchange_relaxed_acquiring", test_Int64_weakCompareExchange_relaxed_acquiring), - ("test_Int64_weakCompareExchange_relaxed_relaxed", test_Int64_weakCompareExchange_relaxed_relaxed), - ("test_Int64_weakCompareExchange_relaxed_sequentiallyConsistent", test_Int64_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Int64_weakCompareExchange_releasing_acquiring", test_Int64_weakCompareExchange_releasing_acquiring), - ("test_Int64_weakCompareExchange_releasing_relaxed", test_Int64_weakCompareExchange_releasing_relaxed), - ("test_Int64_weakCompareExchange_releasing_sequentiallyConsistent", test_Int64_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Int64_weakCompareExchange_sequentiallyConsistent_acquiring", test_Int64_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Int64_weakCompareExchange_sequentiallyConsistent_relaxed", test_Int64_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Int64_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int64_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int64_wrappingDecrementThenLoad_acquiring", test_Int64_wrappingDecrementThenLoad_acquiring), - ("test_Int64_wrappingDecrementThenLoad_acquiringAndReleasing", test_Int64_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_Int64_wrappingDecrementThenLoad_relaxed", test_Int64_wrappingDecrementThenLoad_relaxed), - ("test_Int64_wrappingDecrementThenLoad_releasing", test_Int64_wrappingDecrementThenLoad_releasing), - ("test_Int64_wrappingDecrementThenLoad_sequentiallyConsistent", test_Int64_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_Int64_wrappingIncrementThenLoad_acquiring", test_Int64_wrappingIncrementThenLoad_acquiring), - ("test_Int64_wrappingIncrementThenLoad_acquiringAndReleasing", test_Int64_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_Int64_wrappingIncrementThenLoad_relaxed", test_Int64_wrappingIncrementThenLoad_relaxed), - ("test_Int64_wrappingIncrementThenLoad_releasing", test_Int64_wrappingIncrementThenLoad_releasing), - ("test_Int64_wrappingIncrementThenLoad_sequentiallyConsistent", test_Int64_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_Int8_bitwiseAndThenLoad_acquiring", test_Int8_bitwiseAndThenLoad_acquiring), - ("test_Int8_bitwiseAndThenLoad_acquiringAndReleasing", test_Int8_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_Int8_bitwiseAndThenLoad_relaxed", test_Int8_bitwiseAndThenLoad_relaxed), - ("test_Int8_bitwiseAndThenLoad_releasing", test_Int8_bitwiseAndThenLoad_releasing), - ("test_Int8_bitwiseAndThenLoad_sequentiallyConsistent", test_Int8_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_Int8_bitwiseOrThenLoad_acquiring", test_Int8_bitwiseOrThenLoad_acquiring), - ("test_Int8_bitwiseOrThenLoad_acquiringAndReleasing", test_Int8_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_Int8_bitwiseOrThenLoad_relaxed", test_Int8_bitwiseOrThenLoad_relaxed), - ("test_Int8_bitwiseOrThenLoad_releasing", test_Int8_bitwiseOrThenLoad_releasing), - ("test_Int8_bitwiseOrThenLoad_sequentiallyConsistent", test_Int8_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_Int8_bitwiseXorThenLoad_acquiring", test_Int8_bitwiseXorThenLoad_acquiring), - ("test_Int8_bitwiseXorThenLoad_acquiringAndReleasing", test_Int8_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_Int8_bitwiseXorThenLoad_relaxed", test_Int8_bitwiseXorThenLoad_relaxed), - ("test_Int8_bitwiseXorThenLoad_releasing", test_Int8_bitwiseXorThenLoad_releasing), - ("test_Int8_bitwiseXorThenLoad_sequentiallyConsistent", test_Int8_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_Int8_compareExchange_acquiring", test_Int8_compareExchange_acquiring), - ("test_Int8_compareExchange_acquiring_acquiring", test_Int8_compareExchange_acquiring_acquiring), - ("test_Int8_compareExchange_acquiring_relaxed", test_Int8_compareExchange_acquiring_relaxed), - ("test_Int8_compareExchange_acquiring_sequentiallyConsistent", test_Int8_compareExchange_acquiring_sequentiallyConsistent), - ("test_Int8_compareExchange_acquiringAndReleasing", test_Int8_compareExchange_acquiringAndReleasing), - ("test_Int8_compareExchange_acquiringAndReleasing_acquiring", test_Int8_compareExchange_acquiringAndReleasing_acquiring), - ("test_Int8_compareExchange_acquiringAndReleasing_relaxed", test_Int8_compareExchange_acquiringAndReleasing_relaxed), - ("test_Int8_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int8_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int8_compareExchange_relaxed", test_Int8_compareExchange_relaxed), - ("test_Int8_compareExchange_relaxed_acquiring", test_Int8_compareExchange_relaxed_acquiring), - ("test_Int8_compareExchange_relaxed_relaxed", test_Int8_compareExchange_relaxed_relaxed), - ("test_Int8_compareExchange_relaxed_sequentiallyConsistent", test_Int8_compareExchange_relaxed_sequentiallyConsistent), - ("test_Int8_compareExchange_releasing", test_Int8_compareExchange_releasing), - ("test_Int8_compareExchange_releasing_acquiring", test_Int8_compareExchange_releasing_acquiring), - ("test_Int8_compareExchange_releasing_relaxed", test_Int8_compareExchange_releasing_relaxed), - ("test_Int8_compareExchange_releasing_sequentiallyConsistent", test_Int8_compareExchange_releasing_sequentiallyConsistent), - ("test_Int8_compareExchange_sequentiallyConsistent", test_Int8_compareExchange_sequentiallyConsistent), - ("test_Int8_compareExchange_sequentiallyConsistent_acquiring", test_Int8_compareExchange_sequentiallyConsistent_acquiring), - ("test_Int8_compareExchange_sequentiallyConsistent_relaxed", test_Int8_compareExchange_sequentiallyConsistent_relaxed), - ("test_Int8_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int8_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int8_create_destroy", test_Int8_create_destroy), - ("test_Int8_exchange_acquiring", test_Int8_exchange_acquiring), - ("test_Int8_exchange_acquiringAndReleasing", test_Int8_exchange_acquiringAndReleasing), - ("test_Int8_exchange_relaxed", test_Int8_exchange_relaxed), - ("test_Int8_exchange_releasing", test_Int8_exchange_releasing), - ("test_Int8_exchange_sequentiallyConsistent", test_Int8_exchange_sequentiallyConsistent), - ("test_Int8_load_acquiring", test_Int8_load_acquiring), - ("test_Int8_load_relaxed", test_Int8_load_relaxed), - ("test_Int8_load_sequentiallyConsistent", test_Int8_load_sequentiallyConsistent), - ("test_Int8_loadThenBitwiseAnd_acquiring", test_Int8_loadThenBitwiseAnd_acquiring), - ("test_Int8_loadThenBitwiseAnd_acquiringAndReleasing", test_Int8_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_Int8_loadThenBitwiseAnd_relaxed", test_Int8_loadThenBitwiseAnd_relaxed), - ("test_Int8_loadThenBitwiseAnd_releasing", test_Int8_loadThenBitwiseAnd_releasing), - ("test_Int8_loadThenBitwiseAnd_sequentiallyConsistent", test_Int8_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_Int8_loadThenBitwiseOr_acquiring", test_Int8_loadThenBitwiseOr_acquiring), - ("test_Int8_loadThenBitwiseOr_acquiringAndReleasing", test_Int8_loadThenBitwiseOr_acquiringAndReleasing), - ("test_Int8_loadThenBitwiseOr_relaxed", test_Int8_loadThenBitwiseOr_relaxed), - ("test_Int8_loadThenBitwiseOr_releasing", test_Int8_loadThenBitwiseOr_releasing), - ("test_Int8_loadThenBitwiseOr_sequentiallyConsistent", test_Int8_loadThenBitwiseOr_sequentiallyConsistent), - ("test_Int8_loadThenBitwiseXor_acquiring", test_Int8_loadThenBitwiseXor_acquiring), - ("test_Int8_loadThenBitwiseXor_acquiringAndReleasing", test_Int8_loadThenBitwiseXor_acquiringAndReleasing), - ("test_Int8_loadThenBitwiseXor_relaxed", test_Int8_loadThenBitwiseXor_relaxed), - ("test_Int8_loadThenBitwiseXor_releasing", test_Int8_loadThenBitwiseXor_releasing), - ("test_Int8_loadThenBitwiseXor_sequentiallyConsistent", test_Int8_loadThenBitwiseXor_sequentiallyConsistent), - ("test_Int8_loadThenWrappingDecrement_acquiring", test_Int8_loadThenWrappingDecrement_acquiring), - ("test_Int8_loadThenWrappingDecrement_acquiringAndReleasing", test_Int8_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_Int8_loadThenWrappingDecrement_relaxed", test_Int8_loadThenWrappingDecrement_relaxed), - ("test_Int8_loadThenWrappingDecrement_releasing", test_Int8_loadThenWrappingDecrement_releasing), - ("test_Int8_loadThenWrappingDecrement_sequentiallyConsistent", test_Int8_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_Int8_loadThenWrappingIncrement_acquiring", test_Int8_loadThenWrappingIncrement_acquiring), - ("test_Int8_loadThenWrappingIncrement_acquiringAndReleasing", test_Int8_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_Int8_loadThenWrappingIncrement_relaxed", test_Int8_loadThenWrappingIncrement_relaxed), - ("test_Int8_loadThenWrappingIncrement_releasing", test_Int8_loadThenWrappingIncrement_releasing), - ("test_Int8_loadThenWrappingIncrement_sequentiallyConsistent", test_Int8_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_Int8_store_relaxed", test_Int8_store_relaxed), - ("test_Int8_store_releasing", test_Int8_store_releasing), - ("test_Int8_store_sequentiallyConsistent", test_Int8_store_sequentiallyConsistent), - ("test_Int8_weakCompareExchange_acquiring_acquiring", test_Int8_weakCompareExchange_acquiring_acquiring), - ("test_Int8_weakCompareExchange_acquiring_relaxed", test_Int8_weakCompareExchange_acquiring_relaxed), - ("test_Int8_weakCompareExchange_acquiring_sequentiallyConsistent", test_Int8_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Int8_weakCompareExchange_acquiringAndReleasing_acquiring", test_Int8_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Int8_weakCompareExchange_acquiringAndReleasing_relaxed", test_Int8_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Int8_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int8_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int8_weakCompareExchange_relaxed_acquiring", test_Int8_weakCompareExchange_relaxed_acquiring), - ("test_Int8_weakCompareExchange_relaxed_relaxed", test_Int8_weakCompareExchange_relaxed_relaxed), - ("test_Int8_weakCompareExchange_relaxed_sequentiallyConsistent", test_Int8_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Int8_weakCompareExchange_releasing_acquiring", test_Int8_weakCompareExchange_releasing_acquiring), - ("test_Int8_weakCompareExchange_releasing_relaxed", test_Int8_weakCompareExchange_releasing_relaxed), - ("test_Int8_weakCompareExchange_releasing_sequentiallyConsistent", test_Int8_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Int8_weakCompareExchange_sequentiallyConsistent_acquiring", test_Int8_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Int8_weakCompareExchange_sequentiallyConsistent_relaxed", test_Int8_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Int8_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int8_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int8_wrappingDecrementThenLoad_acquiring", test_Int8_wrappingDecrementThenLoad_acquiring), - ("test_Int8_wrappingDecrementThenLoad_acquiringAndReleasing", test_Int8_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_Int8_wrappingDecrementThenLoad_relaxed", test_Int8_wrappingDecrementThenLoad_relaxed), - ("test_Int8_wrappingDecrementThenLoad_releasing", test_Int8_wrappingDecrementThenLoad_releasing), - ("test_Int8_wrappingDecrementThenLoad_sequentiallyConsistent", test_Int8_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_Int8_wrappingIncrementThenLoad_acquiring", test_Int8_wrappingIncrementThenLoad_acquiring), - ("test_Int8_wrappingIncrementThenLoad_acquiringAndReleasing", test_Int8_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_Int8_wrappingIncrementThenLoad_relaxed", test_Int8_wrappingIncrementThenLoad_relaxed), - ("test_Int8_wrappingIncrementThenLoad_releasing", test_Int8_wrappingIncrementThenLoad_releasing), - ("test_Int8_wrappingIncrementThenLoad_sequentiallyConsistent", test_Int8_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_Int_bitwiseAndThenLoad_acquiring", test_Int_bitwiseAndThenLoad_acquiring), - ("test_Int_bitwiseAndThenLoad_acquiringAndReleasing", test_Int_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_Int_bitwiseAndThenLoad_relaxed", test_Int_bitwiseAndThenLoad_relaxed), - ("test_Int_bitwiseAndThenLoad_releasing", test_Int_bitwiseAndThenLoad_releasing), - ("test_Int_bitwiseAndThenLoad_sequentiallyConsistent", test_Int_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_Int_bitwiseOrThenLoad_acquiring", test_Int_bitwiseOrThenLoad_acquiring), - ("test_Int_bitwiseOrThenLoad_acquiringAndReleasing", test_Int_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_Int_bitwiseOrThenLoad_relaxed", test_Int_bitwiseOrThenLoad_relaxed), - ("test_Int_bitwiseOrThenLoad_releasing", test_Int_bitwiseOrThenLoad_releasing), - ("test_Int_bitwiseOrThenLoad_sequentiallyConsistent", test_Int_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_Int_bitwiseXorThenLoad_acquiring", test_Int_bitwiseXorThenLoad_acquiring), - ("test_Int_bitwiseXorThenLoad_acquiringAndReleasing", test_Int_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_Int_bitwiseXorThenLoad_relaxed", test_Int_bitwiseXorThenLoad_relaxed), - ("test_Int_bitwiseXorThenLoad_releasing", test_Int_bitwiseXorThenLoad_releasing), - ("test_Int_bitwiseXorThenLoad_sequentiallyConsistent", test_Int_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_Int_compareExchange_acquiring", test_Int_compareExchange_acquiring), - ("test_Int_compareExchange_acquiring_acquiring", test_Int_compareExchange_acquiring_acquiring), - ("test_Int_compareExchange_acquiring_relaxed", test_Int_compareExchange_acquiring_relaxed), - ("test_Int_compareExchange_acquiring_sequentiallyConsistent", test_Int_compareExchange_acquiring_sequentiallyConsistent), - ("test_Int_compareExchange_acquiringAndReleasing", test_Int_compareExchange_acquiringAndReleasing), - ("test_Int_compareExchange_acquiringAndReleasing_acquiring", test_Int_compareExchange_acquiringAndReleasing_acquiring), - ("test_Int_compareExchange_acquiringAndReleasing_relaxed", test_Int_compareExchange_acquiringAndReleasing_relaxed), - ("test_Int_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int_compareExchange_relaxed", test_Int_compareExchange_relaxed), - ("test_Int_compareExchange_relaxed_acquiring", test_Int_compareExchange_relaxed_acquiring), - ("test_Int_compareExchange_relaxed_relaxed", test_Int_compareExchange_relaxed_relaxed), - ("test_Int_compareExchange_relaxed_sequentiallyConsistent", test_Int_compareExchange_relaxed_sequentiallyConsistent), - ("test_Int_compareExchange_releasing", test_Int_compareExchange_releasing), - ("test_Int_compareExchange_releasing_acquiring", test_Int_compareExchange_releasing_acquiring), - ("test_Int_compareExchange_releasing_relaxed", test_Int_compareExchange_releasing_relaxed), - ("test_Int_compareExchange_releasing_sequentiallyConsistent", test_Int_compareExchange_releasing_sequentiallyConsistent), - ("test_Int_compareExchange_sequentiallyConsistent", test_Int_compareExchange_sequentiallyConsistent), - ("test_Int_compareExchange_sequentiallyConsistent_acquiring", test_Int_compareExchange_sequentiallyConsistent_acquiring), - ("test_Int_compareExchange_sequentiallyConsistent_relaxed", test_Int_compareExchange_sequentiallyConsistent_relaxed), - ("test_Int_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int_create_destroy", test_Int_create_destroy), - ("test_Int_exchange_acquiring", test_Int_exchange_acquiring), - ("test_Int_exchange_acquiringAndReleasing", test_Int_exchange_acquiringAndReleasing), - ("test_Int_exchange_relaxed", test_Int_exchange_relaxed), - ("test_Int_exchange_releasing", test_Int_exchange_releasing), - ("test_Int_exchange_sequentiallyConsistent", test_Int_exchange_sequentiallyConsistent), - ("test_Int_load_acquiring", test_Int_load_acquiring), - ("test_Int_load_relaxed", test_Int_load_relaxed), - ("test_Int_load_sequentiallyConsistent", test_Int_load_sequentiallyConsistent), - ("test_Int_loadThenBitwiseAnd_acquiring", test_Int_loadThenBitwiseAnd_acquiring), - ("test_Int_loadThenBitwiseAnd_acquiringAndReleasing", test_Int_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_Int_loadThenBitwiseAnd_relaxed", test_Int_loadThenBitwiseAnd_relaxed), - ("test_Int_loadThenBitwiseAnd_releasing", test_Int_loadThenBitwiseAnd_releasing), - ("test_Int_loadThenBitwiseAnd_sequentiallyConsistent", test_Int_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_Int_loadThenBitwiseOr_acquiring", test_Int_loadThenBitwiseOr_acquiring), - ("test_Int_loadThenBitwiseOr_acquiringAndReleasing", test_Int_loadThenBitwiseOr_acquiringAndReleasing), - ("test_Int_loadThenBitwiseOr_relaxed", test_Int_loadThenBitwiseOr_relaxed), - ("test_Int_loadThenBitwiseOr_releasing", test_Int_loadThenBitwiseOr_releasing), - ("test_Int_loadThenBitwiseOr_sequentiallyConsistent", test_Int_loadThenBitwiseOr_sequentiallyConsistent), - ("test_Int_loadThenBitwiseXor_acquiring", test_Int_loadThenBitwiseXor_acquiring), - ("test_Int_loadThenBitwiseXor_acquiringAndReleasing", test_Int_loadThenBitwiseXor_acquiringAndReleasing), - ("test_Int_loadThenBitwiseXor_relaxed", test_Int_loadThenBitwiseXor_relaxed), - ("test_Int_loadThenBitwiseXor_releasing", test_Int_loadThenBitwiseXor_releasing), - ("test_Int_loadThenBitwiseXor_sequentiallyConsistent", test_Int_loadThenBitwiseXor_sequentiallyConsistent), - ("test_Int_loadThenWrappingDecrement_acquiring", test_Int_loadThenWrappingDecrement_acquiring), - ("test_Int_loadThenWrappingDecrement_acquiringAndReleasing", test_Int_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_Int_loadThenWrappingDecrement_relaxed", test_Int_loadThenWrappingDecrement_relaxed), - ("test_Int_loadThenWrappingDecrement_releasing", test_Int_loadThenWrappingDecrement_releasing), - ("test_Int_loadThenWrappingDecrement_sequentiallyConsistent", test_Int_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_Int_loadThenWrappingIncrement_acquiring", test_Int_loadThenWrappingIncrement_acquiring), - ("test_Int_loadThenWrappingIncrement_acquiringAndReleasing", test_Int_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_Int_loadThenWrappingIncrement_relaxed", test_Int_loadThenWrappingIncrement_relaxed), - ("test_Int_loadThenWrappingIncrement_releasing", test_Int_loadThenWrappingIncrement_releasing), - ("test_Int_loadThenWrappingIncrement_sequentiallyConsistent", test_Int_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_Int_store_relaxed", test_Int_store_relaxed), - ("test_Int_store_releasing", test_Int_store_releasing), - ("test_Int_store_sequentiallyConsistent", test_Int_store_sequentiallyConsistent), - ("test_Int_weakCompareExchange_acquiring_acquiring", test_Int_weakCompareExchange_acquiring_acquiring), - ("test_Int_weakCompareExchange_acquiring_relaxed", test_Int_weakCompareExchange_acquiring_relaxed), - ("test_Int_weakCompareExchange_acquiring_sequentiallyConsistent", test_Int_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Int_weakCompareExchange_acquiringAndReleasing_acquiring", test_Int_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Int_weakCompareExchange_acquiringAndReleasing_relaxed", test_Int_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Int_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Int_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Int_weakCompareExchange_relaxed_acquiring", test_Int_weakCompareExchange_relaxed_acquiring), - ("test_Int_weakCompareExchange_relaxed_relaxed", test_Int_weakCompareExchange_relaxed_relaxed), - ("test_Int_weakCompareExchange_relaxed_sequentiallyConsistent", test_Int_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Int_weakCompareExchange_releasing_acquiring", test_Int_weakCompareExchange_releasing_acquiring), - ("test_Int_weakCompareExchange_releasing_relaxed", test_Int_weakCompareExchange_releasing_relaxed), - ("test_Int_weakCompareExchange_releasing_sequentiallyConsistent", test_Int_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Int_weakCompareExchange_sequentiallyConsistent_acquiring", test_Int_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Int_weakCompareExchange_sequentiallyConsistent_relaxed", test_Int_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Int_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Int_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Int_wrappingDecrementThenLoad_acquiring", test_Int_wrappingDecrementThenLoad_acquiring), - ("test_Int_wrappingDecrementThenLoad_acquiringAndReleasing", test_Int_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_Int_wrappingDecrementThenLoad_relaxed", test_Int_wrappingDecrementThenLoad_relaxed), - ("test_Int_wrappingDecrementThenLoad_releasing", test_Int_wrappingDecrementThenLoad_releasing), - ("test_Int_wrappingDecrementThenLoad_sequentiallyConsistent", test_Int_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_Int_wrappingIncrementThenLoad_acquiring", test_Int_wrappingIncrementThenLoad_acquiring), - ("test_Int_wrappingIncrementThenLoad_acquiringAndReleasing", test_Int_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_Int_wrappingIncrementThenLoad_relaxed", test_Int_wrappingIncrementThenLoad_relaxed), - ("test_Int_wrappingIncrementThenLoad_releasing", test_Int_wrappingIncrementThenLoad_releasing), - ("test_Int_wrappingIncrementThenLoad_sequentiallyConsistent", test_Int_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_MutablePointer_compareExchange_acquiring", test_MutablePointer_compareExchange_acquiring), - ("test_MutablePointer_compareExchange_acquiring_acquiring", test_MutablePointer_compareExchange_acquiring_acquiring), - ("test_MutablePointer_compareExchange_acquiring_relaxed", test_MutablePointer_compareExchange_acquiring_relaxed), - ("test_MutablePointer_compareExchange_acquiring_sequentiallyConsistent", test_MutablePointer_compareExchange_acquiring_sequentiallyConsistent), - ("test_MutablePointer_compareExchange_acquiringAndReleasing", test_MutablePointer_compareExchange_acquiringAndReleasing), - ("test_MutablePointer_compareExchange_acquiringAndReleasing_acquiring", test_MutablePointer_compareExchange_acquiringAndReleasing_acquiring), - ("test_MutablePointer_compareExchange_acquiringAndReleasing_relaxed", test_MutablePointer_compareExchange_acquiringAndReleasing_relaxed), - ("test_MutablePointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_MutablePointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_MutablePointer_compareExchange_relaxed", test_MutablePointer_compareExchange_relaxed), - ("test_MutablePointer_compareExchange_relaxed_acquiring", test_MutablePointer_compareExchange_relaxed_acquiring), - ("test_MutablePointer_compareExchange_relaxed_relaxed", test_MutablePointer_compareExchange_relaxed_relaxed), - ("test_MutablePointer_compareExchange_relaxed_sequentiallyConsistent", test_MutablePointer_compareExchange_relaxed_sequentiallyConsistent), - ("test_MutablePointer_compareExchange_releasing", test_MutablePointer_compareExchange_releasing), - ("test_MutablePointer_compareExchange_releasing_acquiring", test_MutablePointer_compareExchange_releasing_acquiring), - ("test_MutablePointer_compareExchange_releasing_relaxed", test_MutablePointer_compareExchange_releasing_relaxed), - ("test_MutablePointer_compareExchange_releasing_sequentiallyConsistent", test_MutablePointer_compareExchange_releasing_sequentiallyConsistent), - ("test_MutablePointer_compareExchange_sequentiallyConsistent", test_MutablePointer_compareExchange_sequentiallyConsistent), - ("test_MutablePointer_compareExchange_sequentiallyConsistent_acquiring", test_MutablePointer_compareExchange_sequentiallyConsistent_acquiring), - ("test_MutablePointer_compareExchange_sequentiallyConsistent_relaxed", test_MutablePointer_compareExchange_sequentiallyConsistent_relaxed), - ("test_MutablePointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_MutablePointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_MutablePointer_create_destroy", test_MutablePointer_create_destroy), - ("test_MutablePointer_exchange_acquiring", test_MutablePointer_exchange_acquiring), - ("test_MutablePointer_exchange_acquiringAndReleasing", test_MutablePointer_exchange_acquiringAndReleasing), - ("test_MutablePointer_exchange_relaxed", test_MutablePointer_exchange_relaxed), - ("test_MutablePointer_exchange_releasing", test_MutablePointer_exchange_releasing), - ("test_MutablePointer_exchange_sequentiallyConsistent", test_MutablePointer_exchange_sequentiallyConsistent), - ("test_MutablePointer_load_acquiring", test_MutablePointer_load_acquiring), - ("test_MutablePointer_load_relaxed", test_MutablePointer_load_relaxed), - ("test_MutablePointer_load_sequentiallyConsistent", test_MutablePointer_load_sequentiallyConsistent), - ("test_MutablePointer_store_relaxed", test_MutablePointer_store_relaxed), - ("test_MutablePointer_store_releasing", test_MutablePointer_store_releasing), - ("test_MutablePointer_store_sequentiallyConsistent", test_MutablePointer_store_sequentiallyConsistent), - ("test_MutablePointer_weakCompareExchange_acquiring_acquiring", test_MutablePointer_weakCompareExchange_acquiring_acquiring), - ("test_MutablePointer_weakCompareExchange_acquiring_relaxed", test_MutablePointer_weakCompareExchange_acquiring_relaxed), - ("test_MutablePointer_weakCompareExchange_acquiring_sequentiallyConsistent", test_MutablePointer_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_MutablePointer_weakCompareExchange_acquiringAndReleasing_acquiring", test_MutablePointer_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_MutablePointer_weakCompareExchange_acquiringAndReleasing_relaxed", test_MutablePointer_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_MutablePointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_MutablePointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_MutablePointer_weakCompareExchange_relaxed_acquiring", test_MutablePointer_weakCompareExchange_relaxed_acquiring), - ("test_MutablePointer_weakCompareExchange_relaxed_relaxed", test_MutablePointer_weakCompareExchange_relaxed_relaxed), - ("test_MutablePointer_weakCompareExchange_relaxed_sequentiallyConsistent", test_MutablePointer_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_MutablePointer_weakCompareExchange_releasing_acquiring", test_MutablePointer_weakCompareExchange_releasing_acquiring), - ("test_MutablePointer_weakCompareExchange_releasing_relaxed", test_MutablePointer_weakCompareExchange_releasing_relaxed), - ("test_MutablePointer_weakCompareExchange_releasing_sequentiallyConsistent", test_MutablePointer_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_MutablePointer_weakCompareExchange_sequentiallyConsistent_acquiring", test_MutablePointer_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_MutablePointer_weakCompareExchange_sequentiallyConsistent_relaxed", test_MutablePointer_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_MutablePointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_MutablePointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalMutablePointer_compareExchange_acquiring", test_OptionalMutablePointer_compareExchange_acquiring), - ("test_OptionalMutablePointer_compareExchange_acquiring_acquiring", test_OptionalMutablePointer_compareExchange_acquiring_acquiring), - ("test_OptionalMutablePointer_compareExchange_acquiring_relaxed", test_OptionalMutablePointer_compareExchange_acquiring_relaxed), - ("test_OptionalMutablePointer_compareExchange_acquiring_sequentiallyConsistent", test_OptionalMutablePointer_compareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalMutablePointer_compareExchange_acquiringAndReleasing", test_OptionalMutablePointer_compareExchange_acquiringAndReleasing), - ("test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_acquiring", test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_relaxed", test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalMutablePointer_compareExchange_relaxed", test_OptionalMutablePointer_compareExchange_relaxed), - ("test_OptionalMutablePointer_compareExchange_relaxed_acquiring", test_OptionalMutablePointer_compareExchange_relaxed_acquiring), - ("test_OptionalMutablePointer_compareExchange_relaxed_relaxed", test_OptionalMutablePointer_compareExchange_relaxed_relaxed), - ("test_OptionalMutablePointer_compareExchange_relaxed_sequentiallyConsistent", test_OptionalMutablePointer_compareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalMutablePointer_compareExchange_releasing", test_OptionalMutablePointer_compareExchange_releasing), - ("test_OptionalMutablePointer_compareExchange_releasing_acquiring", test_OptionalMutablePointer_compareExchange_releasing_acquiring), - ("test_OptionalMutablePointer_compareExchange_releasing_relaxed", test_OptionalMutablePointer_compareExchange_releasing_relaxed), - ("test_OptionalMutablePointer_compareExchange_releasing_sequentiallyConsistent", test_OptionalMutablePointer_compareExchange_releasing_sequentiallyConsistent), - ("test_OptionalMutablePointer_compareExchange_sequentiallyConsistent", test_OptionalMutablePointer_compareExchange_sequentiallyConsistent), - ("test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_acquiring", test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_relaxed", test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalMutablePointer_create_destroy", test_OptionalMutablePointer_create_destroy), - ("test_OptionalMutablePointer_exchange_acquiring", test_OptionalMutablePointer_exchange_acquiring), - ("test_OptionalMutablePointer_exchange_acquiringAndReleasing", test_OptionalMutablePointer_exchange_acquiringAndReleasing), - ("test_OptionalMutablePointer_exchange_relaxed", test_OptionalMutablePointer_exchange_relaxed), - ("test_OptionalMutablePointer_exchange_releasing", test_OptionalMutablePointer_exchange_releasing), - ("test_OptionalMutablePointer_exchange_sequentiallyConsistent", test_OptionalMutablePointer_exchange_sequentiallyConsistent), - ("test_OptionalMutablePointer_load_acquiring", test_OptionalMutablePointer_load_acquiring), - ("test_OptionalMutablePointer_load_relaxed", test_OptionalMutablePointer_load_relaxed), - ("test_OptionalMutablePointer_load_sequentiallyConsistent", test_OptionalMutablePointer_load_sequentiallyConsistent), - ("test_OptionalMutablePointer_store_relaxed", test_OptionalMutablePointer_store_relaxed), - ("test_OptionalMutablePointer_store_releasing", test_OptionalMutablePointer_store_releasing), - ("test_OptionalMutablePointer_store_sequentiallyConsistent", test_OptionalMutablePointer_store_sequentiallyConsistent), - ("test_OptionalMutablePointer_weakCompareExchange_acquiring_acquiring", test_OptionalMutablePointer_weakCompareExchange_acquiring_acquiring), - ("test_OptionalMutablePointer_weakCompareExchange_acquiring_relaxed", test_OptionalMutablePointer_weakCompareExchange_acquiring_relaxed), - ("test_OptionalMutablePointer_weakCompareExchange_acquiring_sequentiallyConsistent", test_OptionalMutablePointer_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_acquiring", test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_relaxed", test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalMutablePointer_weakCompareExchange_relaxed_acquiring", test_OptionalMutablePointer_weakCompareExchange_relaxed_acquiring), - ("test_OptionalMutablePointer_weakCompareExchange_relaxed_relaxed", test_OptionalMutablePointer_weakCompareExchange_relaxed_relaxed), - ("test_OptionalMutablePointer_weakCompareExchange_relaxed_sequentiallyConsistent", test_OptionalMutablePointer_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalMutablePointer_weakCompareExchange_releasing_acquiring", test_OptionalMutablePointer_weakCompareExchange_releasing_acquiring), - ("test_OptionalMutablePointer_weakCompareExchange_releasing_relaxed", test_OptionalMutablePointer_weakCompareExchange_releasing_relaxed), - ("test_OptionalMutablePointer_weakCompareExchange_releasing_sequentiallyConsistent", test_OptionalMutablePointer_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_acquiring", test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_relaxed", test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalPointer_compareExchange_acquiring", test_OptionalPointer_compareExchange_acquiring), - ("test_OptionalPointer_compareExchange_acquiring_acquiring", test_OptionalPointer_compareExchange_acquiring_acquiring), - ("test_OptionalPointer_compareExchange_acquiring_relaxed", test_OptionalPointer_compareExchange_acquiring_relaxed), - ("test_OptionalPointer_compareExchange_acquiring_sequentiallyConsistent", test_OptionalPointer_compareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalPointer_compareExchange_acquiringAndReleasing", test_OptionalPointer_compareExchange_acquiringAndReleasing), - ("test_OptionalPointer_compareExchange_acquiringAndReleasing_acquiring", test_OptionalPointer_compareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalPointer_compareExchange_acquiringAndReleasing_relaxed", test_OptionalPointer_compareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalPointer_compareExchange_relaxed", test_OptionalPointer_compareExchange_relaxed), - ("test_OptionalPointer_compareExchange_relaxed_acquiring", test_OptionalPointer_compareExchange_relaxed_acquiring), - ("test_OptionalPointer_compareExchange_relaxed_relaxed", test_OptionalPointer_compareExchange_relaxed_relaxed), - ("test_OptionalPointer_compareExchange_relaxed_sequentiallyConsistent", test_OptionalPointer_compareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalPointer_compareExchange_releasing", test_OptionalPointer_compareExchange_releasing), - ("test_OptionalPointer_compareExchange_releasing_acquiring", test_OptionalPointer_compareExchange_releasing_acquiring), - ("test_OptionalPointer_compareExchange_releasing_relaxed", test_OptionalPointer_compareExchange_releasing_relaxed), - ("test_OptionalPointer_compareExchange_releasing_sequentiallyConsistent", test_OptionalPointer_compareExchange_releasing_sequentiallyConsistent), - ("test_OptionalPointer_compareExchange_sequentiallyConsistent", test_OptionalPointer_compareExchange_sequentiallyConsistent), - ("test_OptionalPointer_compareExchange_sequentiallyConsistent_acquiring", test_OptionalPointer_compareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalPointer_compareExchange_sequentiallyConsistent_relaxed", test_OptionalPointer_compareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalPointer_create_destroy", test_OptionalPointer_create_destroy), - ("test_OptionalPointer_exchange_acquiring", test_OptionalPointer_exchange_acquiring), - ("test_OptionalPointer_exchange_acquiringAndReleasing", test_OptionalPointer_exchange_acquiringAndReleasing), - ("test_OptionalPointer_exchange_relaxed", test_OptionalPointer_exchange_relaxed), - ("test_OptionalPointer_exchange_releasing", test_OptionalPointer_exchange_releasing), - ("test_OptionalPointer_exchange_sequentiallyConsistent", test_OptionalPointer_exchange_sequentiallyConsistent), - ("test_OptionalPointer_load_acquiring", test_OptionalPointer_load_acquiring), - ("test_OptionalPointer_load_relaxed", test_OptionalPointer_load_relaxed), - ("test_OptionalPointer_load_sequentiallyConsistent", test_OptionalPointer_load_sequentiallyConsistent), - ("test_OptionalPointer_store_relaxed", test_OptionalPointer_store_relaxed), - ("test_OptionalPointer_store_releasing", test_OptionalPointer_store_releasing), - ("test_OptionalPointer_store_sequentiallyConsistent", test_OptionalPointer_store_sequentiallyConsistent), - ("test_OptionalPointer_weakCompareExchange_acquiring_acquiring", test_OptionalPointer_weakCompareExchange_acquiring_acquiring), - ("test_OptionalPointer_weakCompareExchange_acquiring_relaxed", test_OptionalPointer_weakCompareExchange_acquiring_relaxed), - ("test_OptionalPointer_weakCompareExchange_acquiring_sequentiallyConsistent", test_OptionalPointer_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_acquiring", test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_relaxed", test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalPointer_weakCompareExchange_relaxed_acquiring", test_OptionalPointer_weakCompareExchange_relaxed_acquiring), - ("test_OptionalPointer_weakCompareExchange_relaxed_relaxed", test_OptionalPointer_weakCompareExchange_relaxed_relaxed), - ("test_OptionalPointer_weakCompareExchange_relaxed_sequentiallyConsistent", test_OptionalPointer_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalPointer_weakCompareExchange_releasing_acquiring", test_OptionalPointer_weakCompareExchange_releasing_acquiring), - ("test_OptionalPointer_weakCompareExchange_releasing_relaxed", test_OptionalPointer_weakCompareExchange_releasing_relaxed), - ("test_OptionalPointer_weakCompareExchange_releasing_sequentiallyConsistent", test_OptionalPointer_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_acquiring", test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_relaxed", test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalRawPointer_compareExchange_acquiring", test_OptionalRawPointer_compareExchange_acquiring), - ("test_OptionalRawPointer_compareExchange_acquiring_acquiring", test_OptionalRawPointer_compareExchange_acquiring_acquiring), - ("test_OptionalRawPointer_compareExchange_acquiring_relaxed", test_OptionalRawPointer_compareExchange_acquiring_relaxed), - ("test_OptionalRawPointer_compareExchange_acquiring_sequentiallyConsistent", test_OptionalRawPointer_compareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalRawPointer_compareExchange_acquiringAndReleasing", test_OptionalRawPointer_compareExchange_acquiringAndReleasing), - ("test_OptionalRawPointer_compareExchange_acquiringAndReleasing_acquiring", test_OptionalRawPointer_compareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalRawPointer_compareExchange_acquiringAndReleasing_relaxed", test_OptionalRawPointer_compareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalRawPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalRawPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalRawPointer_compareExchange_relaxed", test_OptionalRawPointer_compareExchange_relaxed), - ("test_OptionalRawPointer_compareExchange_relaxed_acquiring", test_OptionalRawPointer_compareExchange_relaxed_acquiring), - ("test_OptionalRawPointer_compareExchange_relaxed_relaxed", test_OptionalRawPointer_compareExchange_relaxed_relaxed), - ("test_OptionalRawPointer_compareExchange_relaxed_sequentiallyConsistent", test_OptionalRawPointer_compareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalRawPointer_compareExchange_releasing", test_OptionalRawPointer_compareExchange_releasing), - ("test_OptionalRawPointer_compareExchange_releasing_acquiring", test_OptionalRawPointer_compareExchange_releasing_acquiring), - ("test_OptionalRawPointer_compareExchange_releasing_relaxed", test_OptionalRawPointer_compareExchange_releasing_relaxed), - ("test_OptionalRawPointer_compareExchange_releasing_sequentiallyConsistent", test_OptionalRawPointer_compareExchange_releasing_sequentiallyConsistent), - ("test_OptionalRawPointer_compareExchange_sequentiallyConsistent", test_OptionalRawPointer_compareExchange_sequentiallyConsistent), - ("test_OptionalRawPointer_compareExchange_sequentiallyConsistent_acquiring", test_OptionalRawPointer_compareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalRawPointer_compareExchange_sequentiallyConsistent_relaxed", test_OptionalRawPointer_compareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalRawPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalRawPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalRawPointer_create_destroy", test_OptionalRawPointer_create_destroy), - ("test_OptionalRawPointer_exchange_acquiring", test_OptionalRawPointer_exchange_acquiring), - ("test_OptionalRawPointer_exchange_acquiringAndReleasing", test_OptionalRawPointer_exchange_acquiringAndReleasing), - ("test_OptionalRawPointer_exchange_relaxed", test_OptionalRawPointer_exchange_relaxed), - ("test_OptionalRawPointer_exchange_releasing", test_OptionalRawPointer_exchange_releasing), - ("test_OptionalRawPointer_exchange_sequentiallyConsistent", test_OptionalRawPointer_exchange_sequentiallyConsistent), - ("test_OptionalRawPointer_load_acquiring", test_OptionalRawPointer_load_acquiring), - ("test_OptionalRawPointer_load_relaxed", test_OptionalRawPointer_load_relaxed), - ("test_OptionalRawPointer_load_sequentiallyConsistent", test_OptionalRawPointer_load_sequentiallyConsistent), - ("test_OptionalRawPointer_store_relaxed", test_OptionalRawPointer_store_relaxed), - ("test_OptionalRawPointer_store_releasing", test_OptionalRawPointer_store_releasing), - ("test_OptionalRawPointer_store_sequentiallyConsistent", test_OptionalRawPointer_store_sequentiallyConsistent), - ("test_OptionalRawPointer_weakCompareExchange_acquiring_acquiring", test_OptionalRawPointer_weakCompareExchange_acquiring_acquiring), - ("test_OptionalRawPointer_weakCompareExchange_acquiring_relaxed", test_OptionalRawPointer_weakCompareExchange_acquiring_relaxed), - ("test_OptionalRawPointer_weakCompareExchange_acquiring_sequentiallyConsistent", test_OptionalRawPointer_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_acquiring", test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_relaxed", test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalRawPointer_weakCompareExchange_relaxed_acquiring", test_OptionalRawPointer_weakCompareExchange_relaxed_acquiring), - ("test_OptionalRawPointer_weakCompareExchange_relaxed_relaxed", test_OptionalRawPointer_weakCompareExchange_relaxed_relaxed), - ("test_OptionalRawPointer_weakCompareExchange_relaxed_sequentiallyConsistent", test_OptionalRawPointer_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalRawPointer_weakCompareExchange_releasing_acquiring", test_OptionalRawPointer_weakCompareExchange_releasing_acquiring), - ("test_OptionalRawPointer_weakCompareExchange_releasing_relaxed", test_OptionalRawPointer_weakCompareExchange_releasing_relaxed), - ("test_OptionalRawPointer_weakCompareExchange_releasing_sequentiallyConsistent", test_OptionalRawPointer_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_acquiring", test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_relaxed", test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalReference_compareExchange_acquiring", test_OptionalReference_compareExchange_acquiring), - ("test_OptionalReference_compareExchange_acquiring_acquiring", test_OptionalReference_compareExchange_acquiring_acquiring), - ("test_OptionalReference_compareExchange_acquiring_relaxed", test_OptionalReference_compareExchange_acquiring_relaxed), - ("test_OptionalReference_compareExchange_acquiring_sequentiallyConsistent", test_OptionalReference_compareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalReference_compareExchange_acquiringAndReleasing", test_OptionalReference_compareExchange_acquiringAndReleasing), - ("test_OptionalReference_compareExchange_acquiringAndReleasing_acquiring", test_OptionalReference_compareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalReference_compareExchange_acquiringAndReleasing_relaxed", test_OptionalReference_compareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalReference_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalReference_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalReference_compareExchange_relaxed", test_OptionalReference_compareExchange_relaxed), - ("test_OptionalReference_compareExchange_relaxed_acquiring", test_OptionalReference_compareExchange_relaxed_acquiring), - ("test_OptionalReference_compareExchange_relaxed_relaxed", test_OptionalReference_compareExchange_relaxed_relaxed), - ("test_OptionalReference_compareExchange_relaxed_sequentiallyConsistent", test_OptionalReference_compareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalReference_compareExchange_releasing", test_OptionalReference_compareExchange_releasing), - ("test_OptionalReference_compareExchange_releasing_acquiring", test_OptionalReference_compareExchange_releasing_acquiring), - ("test_OptionalReference_compareExchange_releasing_relaxed", test_OptionalReference_compareExchange_releasing_relaxed), - ("test_OptionalReference_compareExchange_releasing_sequentiallyConsistent", test_OptionalReference_compareExchange_releasing_sequentiallyConsistent), - ("test_OptionalReference_compareExchange_sequentiallyConsistent", test_OptionalReference_compareExchange_sequentiallyConsistent), - ("test_OptionalReference_compareExchange_sequentiallyConsistent_acquiring", test_OptionalReference_compareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalReference_compareExchange_sequentiallyConsistent_relaxed", test_OptionalReference_compareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalReference_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalReference_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalReference_create_destroy", test_OptionalReference_create_destroy), - ("test_OptionalReference_exchange_acquiring", test_OptionalReference_exchange_acquiring), - ("test_OptionalReference_exchange_acquiringAndReleasing", test_OptionalReference_exchange_acquiringAndReleasing), - ("test_OptionalReference_exchange_relaxed", test_OptionalReference_exchange_relaxed), - ("test_OptionalReference_exchange_releasing", test_OptionalReference_exchange_releasing), - ("test_OptionalReference_exchange_sequentiallyConsistent", test_OptionalReference_exchange_sequentiallyConsistent), - ("test_OptionalReference_load_acquiring", test_OptionalReference_load_acquiring), - ("test_OptionalReference_load_relaxed", test_OptionalReference_load_relaxed), - ("test_OptionalReference_load_sequentiallyConsistent", test_OptionalReference_load_sequentiallyConsistent), - ("test_OptionalReference_store_relaxed", test_OptionalReference_store_relaxed), - ("test_OptionalReference_store_releasing", test_OptionalReference_store_releasing), - ("test_OptionalReference_store_sequentiallyConsistent", test_OptionalReference_store_sequentiallyConsistent), - ("test_OptionalReference_weakCompareExchange_acquiring_acquiring", test_OptionalReference_weakCompareExchange_acquiring_acquiring), - ("test_OptionalReference_weakCompareExchange_acquiring_relaxed", test_OptionalReference_weakCompareExchange_acquiring_relaxed), - ("test_OptionalReference_weakCompareExchange_acquiring_sequentiallyConsistent", test_OptionalReference_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalReference_weakCompareExchange_acquiringAndReleasing_acquiring", test_OptionalReference_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalReference_weakCompareExchange_acquiringAndReleasing_relaxed", test_OptionalReference_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalReference_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalReference_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalReference_weakCompareExchange_relaxed_acquiring", test_OptionalReference_weakCompareExchange_relaxed_acquiring), - ("test_OptionalReference_weakCompareExchange_relaxed_relaxed", test_OptionalReference_weakCompareExchange_relaxed_relaxed), - ("test_OptionalReference_weakCompareExchange_relaxed_sequentiallyConsistent", test_OptionalReference_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalReference_weakCompareExchange_releasing_acquiring", test_OptionalReference_weakCompareExchange_releasing_acquiring), - ("test_OptionalReference_weakCompareExchange_releasing_relaxed", test_OptionalReference_weakCompareExchange_releasing_relaxed), - ("test_OptionalReference_weakCompareExchange_releasing_sequentiallyConsistent", test_OptionalReference_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_OptionalReference_weakCompareExchange_sequentiallyConsistent_acquiring", test_OptionalReference_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalReference_weakCompareExchange_sequentiallyConsistent_relaxed", test_OptionalReference_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalReference_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalReference_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalUnmanaged_compareExchange_acquiring", test_OptionalUnmanaged_compareExchange_acquiring), - ("test_OptionalUnmanaged_compareExchange_acquiring_acquiring", test_OptionalUnmanaged_compareExchange_acquiring_acquiring), - ("test_OptionalUnmanaged_compareExchange_acquiring_relaxed", test_OptionalUnmanaged_compareExchange_acquiring_relaxed), - ("test_OptionalUnmanaged_compareExchange_acquiring_sequentiallyConsistent", test_OptionalUnmanaged_compareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalUnmanaged_compareExchange_acquiringAndReleasing", test_OptionalUnmanaged_compareExchange_acquiringAndReleasing), - ("test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_acquiring", test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_relaxed", test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalUnmanaged_compareExchange_relaxed", test_OptionalUnmanaged_compareExchange_relaxed), - ("test_OptionalUnmanaged_compareExchange_relaxed_acquiring", test_OptionalUnmanaged_compareExchange_relaxed_acquiring), - ("test_OptionalUnmanaged_compareExchange_relaxed_relaxed", test_OptionalUnmanaged_compareExchange_relaxed_relaxed), - ("test_OptionalUnmanaged_compareExchange_relaxed_sequentiallyConsistent", test_OptionalUnmanaged_compareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalUnmanaged_compareExchange_releasing", test_OptionalUnmanaged_compareExchange_releasing), - ("test_OptionalUnmanaged_compareExchange_releasing_acquiring", test_OptionalUnmanaged_compareExchange_releasing_acquiring), - ("test_OptionalUnmanaged_compareExchange_releasing_relaxed", test_OptionalUnmanaged_compareExchange_releasing_relaxed), - ("test_OptionalUnmanaged_compareExchange_releasing_sequentiallyConsistent", test_OptionalUnmanaged_compareExchange_releasing_sequentiallyConsistent), - ("test_OptionalUnmanaged_compareExchange_sequentiallyConsistent", test_OptionalUnmanaged_compareExchange_sequentiallyConsistent), - ("test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_acquiring", test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_relaxed", test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_OptionalUnmanaged_create_destroy", test_OptionalUnmanaged_create_destroy), - ("test_OptionalUnmanaged_exchange_acquiring", test_OptionalUnmanaged_exchange_acquiring), - ("test_OptionalUnmanaged_exchange_acquiringAndReleasing", test_OptionalUnmanaged_exchange_acquiringAndReleasing), - ("test_OptionalUnmanaged_exchange_relaxed", test_OptionalUnmanaged_exchange_relaxed), - ("test_OptionalUnmanaged_exchange_releasing", test_OptionalUnmanaged_exchange_releasing), - ("test_OptionalUnmanaged_exchange_sequentiallyConsistent", test_OptionalUnmanaged_exchange_sequentiallyConsistent), - ("test_OptionalUnmanaged_load_acquiring", test_OptionalUnmanaged_load_acquiring), - ("test_OptionalUnmanaged_load_relaxed", test_OptionalUnmanaged_load_relaxed), - ("test_OptionalUnmanaged_load_sequentiallyConsistent", test_OptionalUnmanaged_load_sequentiallyConsistent), - ("test_OptionalUnmanaged_store_relaxed", test_OptionalUnmanaged_store_relaxed), - ("test_OptionalUnmanaged_store_releasing", test_OptionalUnmanaged_store_releasing), - ("test_OptionalUnmanaged_store_sequentiallyConsistent", test_OptionalUnmanaged_store_sequentiallyConsistent), - ("test_OptionalUnmanaged_weakCompareExchange_acquiring_acquiring", test_OptionalUnmanaged_weakCompareExchange_acquiring_acquiring), - ("test_OptionalUnmanaged_weakCompareExchange_acquiring_relaxed", test_OptionalUnmanaged_weakCompareExchange_acquiring_relaxed), - ("test_OptionalUnmanaged_weakCompareExchange_acquiring_sequentiallyConsistent", test_OptionalUnmanaged_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_acquiring", test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_relaxed", test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_OptionalUnmanaged_weakCompareExchange_relaxed_acquiring", test_OptionalUnmanaged_weakCompareExchange_relaxed_acquiring), - ("test_OptionalUnmanaged_weakCompareExchange_relaxed_relaxed", test_OptionalUnmanaged_weakCompareExchange_relaxed_relaxed), - ("test_OptionalUnmanaged_weakCompareExchange_relaxed_sequentiallyConsistent", test_OptionalUnmanaged_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_OptionalUnmanaged_weakCompareExchange_releasing_acquiring", test_OptionalUnmanaged_weakCompareExchange_releasing_acquiring), - ("test_OptionalUnmanaged_weakCompareExchange_releasing_relaxed", test_OptionalUnmanaged_weakCompareExchange_releasing_relaxed), - ("test_OptionalUnmanaged_weakCompareExchange_releasing_sequentiallyConsistent", test_OptionalUnmanaged_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_acquiring", test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_relaxed", test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Pointer_compareExchange_acquiring", test_Pointer_compareExchange_acquiring), - ("test_Pointer_compareExchange_acquiring_acquiring", test_Pointer_compareExchange_acquiring_acquiring), - ("test_Pointer_compareExchange_acquiring_relaxed", test_Pointer_compareExchange_acquiring_relaxed), - ("test_Pointer_compareExchange_acquiring_sequentiallyConsistent", test_Pointer_compareExchange_acquiring_sequentiallyConsistent), - ("test_Pointer_compareExchange_acquiringAndReleasing", test_Pointer_compareExchange_acquiringAndReleasing), - ("test_Pointer_compareExchange_acquiringAndReleasing_acquiring", test_Pointer_compareExchange_acquiringAndReleasing_acquiring), - ("test_Pointer_compareExchange_acquiringAndReleasing_relaxed", test_Pointer_compareExchange_acquiringAndReleasing_relaxed), - ("test_Pointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Pointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Pointer_compareExchange_relaxed", test_Pointer_compareExchange_relaxed), - ("test_Pointer_compareExchange_relaxed_acquiring", test_Pointer_compareExchange_relaxed_acquiring), - ("test_Pointer_compareExchange_relaxed_relaxed", test_Pointer_compareExchange_relaxed_relaxed), - ("test_Pointer_compareExchange_relaxed_sequentiallyConsistent", test_Pointer_compareExchange_relaxed_sequentiallyConsistent), - ("test_Pointer_compareExchange_releasing", test_Pointer_compareExchange_releasing), - ("test_Pointer_compareExchange_releasing_acquiring", test_Pointer_compareExchange_releasing_acquiring), - ("test_Pointer_compareExchange_releasing_relaxed", test_Pointer_compareExchange_releasing_relaxed), - ("test_Pointer_compareExchange_releasing_sequentiallyConsistent", test_Pointer_compareExchange_releasing_sequentiallyConsistent), - ("test_Pointer_compareExchange_sequentiallyConsistent", test_Pointer_compareExchange_sequentiallyConsistent), - ("test_Pointer_compareExchange_sequentiallyConsistent_acquiring", test_Pointer_compareExchange_sequentiallyConsistent_acquiring), - ("test_Pointer_compareExchange_sequentiallyConsistent_relaxed", test_Pointer_compareExchange_sequentiallyConsistent_relaxed), - ("test_Pointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Pointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Pointer_create_destroy", test_Pointer_create_destroy), - ("test_Pointer_exchange_acquiring", test_Pointer_exchange_acquiring), - ("test_Pointer_exchange_acquiringAndReleasing", test_Pointer_exchange_acquiringAndReleasing), - ("test_Pointer_exchange_relaxed", test_Pointer_exchange_relaxed), - ("test_Pointer_exchange_releasing", test_Pointer_exchange_releasing), - ("test_Pointer_exchange_sequentiallyConsistent", test_Pointer_exchange_sequentiallyConsistent), - ("test_Pointer_load_acquiring", test_Pointer_load_acquiring), - ("test_Pointer_load_relaxed", test_Pointer_load_relaxed), - ("test_Pointer_load_sequentiallyConsistent", test_Pointer_load_sequentiallyConsistent), - ("test_Pointer_store_relaxed", test_Pointer_store_relaxed), - ("test_Pointer_store_releasing", test_Pointer_store_releasing), - ("test_Pointer_store_sequentiallyConsistent", test_Pointer_store_sequentiallyConsistent), - ("test_Pointer_weakCompareExchange_acquiring_acquiring", test_Pointer_weakCompareExchange_acquiring_acquiring), - ("test_Pointer_weakCompareExchange_acquiring_relaxed", test_Pointer_weakCompareExchange_acquiring_relaxed), - ("test_Pointer_weakCompareExchange_acquiring_sequentiallyConsistent", test_Pointer_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Pointer_weakCompareExchange_acquiringAndReleasing_acquiring", test_Pointer_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Pointer_weakCompareExchange_acquiringAndReleasing_relaxed", test_Pointer_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Pointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Pointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Pointer_weakCompareExchange_relaxed_acquiring", test_Pointer_weakCompareExchange_relaxed_acquiring), - ("test_Pointer_weakCompareExchange_relaxed_relaxed", test_Pointer_weakCompareExchange_relaxed_relaxed), - ("test_Pointer_weakCompareExchange_relaxed_sequentiallyConsistent", test_Pointer_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Pointer_weakCompareExchange_releasing_acquiring", test_Pointer_weakCompareExchange_releasing_acquiring), - ("test_Pointer_weakCompareExchange_releasing_relaxed", test_Pointer_weakCompareExchange_releasing_relaxed), - ("test_Pointer_weakCompareExchange_releasing_sequentiallyConsistent", test_Pointer_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Pointer_weakCompareExchange_sequentiallyConsistent_acquiring", test_Pointer_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Pointer_weakCompareExchange_sequentiallyConsistent_relaxed", test_Pointer_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Pointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Pointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_RawPointer_compareExchange_acquiring", test_RawPointer_compareExchange_acquiring), - ("test_RawPointer_compareExchange_acquiring_acquiring", test_RawPointer_compareExchange_acquiring_acquiring), - ("test_RawPointer_compareExchange_acquiring_relaxed", test_RawPointer_compareExchange_acquiring_relaxed), - ("test_RawPointer_compareExchange_acquiring_sequentiallyConsistent", test_RawPointer_compareExchange_acquiring_sequentiallyConsistent), - ("test_RawPointer_compareExchange_acquiringAndReleasing", test_RawPointer_compareExchange_acquiringAndReleasing), - ("test_RawPointer_compareExchange_acquiringAndReleasing_acquiring", test_RawPointer_compareExchange_acquiringAndReleasing_acquiring), - ("test_RawPointer_compareExchange_acquiringAndReleasing_relaxed", test_RawPointer_compareExchange_acquiringAndReleasing_relaxed), - ("test_RawPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_RawPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_RawPointer_compareExchange_relaxed", test_RawPointer_compareExchange_relaxed), - ("test_RawPointer_compareExchange_relaxed_acquiring", test_RawPointer_compareExchange_relaxed_acquiring), - ("test_RawPointer_compareExchange_relaxed_relaxed", test_RawPointer_compareExchange_relaxed_relaxed), - ("test_RawPointer_compareExchange_relaxed_sequentiallyConsistent", test_RawPointer_compareExchange_relaxed_sequentiallyConsistent), - ("test_RawPointer_compareExchange_releasing", test_RawPointer_compareExchange_releasing), - ("test_RawPointer_compareExchange_releasing_acquiring", test_RawPointer_compareExchange_releasing_acquiring), - ("test_RawPointer_compareExchange_releasing_relaxed", test_RawPointer_compareExchange_releasing_relaxed), - ("test_RawPointer_compareExchange_releasing_sequentiallyConsistent", test_RawPointer_compareExchange_releasing_sequentiallyConsistent), - ("test_RawPointer_compareExchange_sequentiallyConsistent", test_RawPointer_compareExchange_sequentiallyConsistent), - ("test_RawPointer_compareExchange_sequentiallyConsistent_acquiring", test_RawPointer_compareExchange_sequentiallyConsistent_acquiring), - ("test_RawPointer_compareExchange_sequentiallyConsistent_relaxed", test_RawPointer_compareExchange_sequentiallyConsistent_relaxed), - ("test_RawPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_RawPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_RawPointer_create_destroy", test_RawPointer_create_destroy), - ("test_RawPointer_exchange_acquiring", test_RawPointer_exchange_acquiring), - ("test_RawPointer_exchange_acquiringAndReleasing", test_RawPointer_exchange_acquiringAndReleasing), - ("test_RawPointer_exchange_relaxed", test_RawPointer_exchange_relaxed), - ("test_RawPointer_exchange_releasing", test_RawPointer_exchange_releasing), - ("test_RawPointer_exchange_sequentiallyConsistent", test_RawPointer_exchange_sequentiallyConsistent), - ("test_RawPointer_load_acquiring", test_RawPointer_load_acquiring), - ("test_RawPointer_load_relaxed", test_RawPointer_load_relaxed), - ("test_RawPointer_load_sequentiallyConsistent", test_RawPointer_load_sequentiallyConsistent), - ("test_RawPointer_store_relaxed", test_RawPointer_store_relaxed), - ("test_RawPointer_store_releasing", test_RawPointer_store_releasing), - ("test_RawPointer_store_sequentiallyConsistent", test_RawPointer_store_sequentiallyConsistent), - ("test_RawPointer_weakCompareExchange_acquiring_acquiring", test_RawPointer_weakCompareExchange_acquiring_acquiring), - ("test_RawPointer_weakCompareExchange_acquiring_relaxed", test_RawPointer_weakCompareExchange_acquiring_relaxed), - ("test_RawPointer_weakCompareExchange_acquiring_sequentiallyConsistent", test_RawPointer_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_RawPointer_weakCompareExchange_acquiringAndReleasing_acquiring", test_RawPointer_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_RawPointer_weakCompareExchange_acquiringAndReleasing_relaxed", test_RawPointer_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_RawPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_RawPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_RawPointer_weakCompareExchange_relaxed_acquiring", test_RawPointer_weakCompareExchange_relaxed_acquiring), - ("test_RawPointer_weakCompareExchange_relaxed_relaxed", test_RawPointer_weakCompareExchange_relaxed_relaxed), - ("test_RawPointer_weakCompareExchange_relaxed_sequentiallyConsistent", test_RawPointer_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_RawPointer_weakCompareExchange_releasing_acquiring", test_RawPointer_weakCompareExchange_releasing_acquiring), - ("test_RawPointer_weakCompareExchange_releasing_relaxed", test_RawPointer_weakCompareExchange_releasing_relaxed), - ("test_RawPointer_weakCompareExchange_releasing_sequentiallyConsistent", test_RawPointer_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_RawPointer_weakCompareExchange_sequentiallyConsistent_acquiring", test_RawPointer_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_RawPointer_weakCompareExchange_sequentiallyConsistent_relaxed", test_RawPointer_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_RawPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_RawPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_RawRepresentable_compareExchange_acquiring", test_RawRepresentable_compareExchange_acquiring), - ("test_RawRepresentable_compareExchange_acquiring_acquiring", test_RawRepresentable_compareExchange_acquiring_acquiring), - ("test_RawRepresentable_compareExchange_acquiring_relaxed", test_RawRepresentable_compareExchange_acquiring_relaxed), - ("test_RawRepresentable_compareExchange_acquiring_sequentiallyConsistent", test_RawRepresentable_compareExchange_acquiring_sequentiallyConsistent), - ("test_RawRepresentable_compareExchange_acquiringAndReleasing", test_RawRepresentable_compareExchange_acquiringAndReleasing), - ("test_RawRepresentable_compareExchange_acquiringAndReleasing_acquiring", test_RawRepresentable_compareExchange_acquiringAndReleasing_acquiring), - ("test_RawRepresentable_compareExchange_acquiringAndReleasing_relaxed", test_RawRepresentable_compareExchange_acquiringAndReleasing_relaxed), - ("test_RawRepresentable_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_RawRepresentable_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_RawRepresentable_compareExchange_relaxed", test_RawRepresentable_compareExchange_relaxed), - ("test_RawRepresentable_compareExchange_relaxed_acquiring", test_RawRepresentable_compareExchange_relaxed_acquiring), - ("test_RawRepresentable_compareExchange_relaxed_relaxed", test_RawRepresentable_compareExchange_relaxed_relaxed), - ("test_RawRepresentable_compareExchange_relaxed_sequentiallyConsistent", test_RawRepresentable_compareExchange_relaxed_sequentiallyConsistent), - ("test_RawRepresentable_compareExchange_releasing", test_RawRepresentable_compareExchange_releasing), - ("test_RawRepresentable_compareExchange_releasing_acquiring", test_RawRepresentable_compareExchange_releasing_acquiring), - ("test_RawRepresentable_compareExchange_releasing_relaxed", test_RawRepresentable_compareExchange_releasing_relaxed), - ("test_RawRepresentable_compareExchange_releasing_sequentiallyConsistent", test_RawRepresentable_compareExchange_releasing_sequentiallyConsistent), - ("test_RawRepresentable_compareExchange_sequentiallyConsistent", test_RawRepresentable_compareExchange_sequentiallyConsistent), - ("test_RawRepresentable_compareExchange_sequentiallyConsistent_acquiring", test_RawRepresentable_compareExchange_sequentiallyConsistent_acquiring), - ("test_RawRepresentable_compareExchange_sequentiallyConsistent_relaxed", test_RawRepresentable_compareExchange_sequentiallyConsistent_relaxed), - ("test_RawRepresentable_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_RawRepresentable_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_RawRepresentable_create_destroy", test_RawRepresentable_create_destroy), - ("test_RawRepresentable_exchange_acquiring", test_RawRepresentable_exchange_acquiring), - ("test_RawRepresentable_exchange_acquiringAndReleasing", test_RawRepresentable_exchange_acquiringAndReleasing), - ("test_RawRepresentable_exchange_relaxed", test_RawRepresentable_exchange_relaxed), - ("test_RawRepresentable_exchange_releasing", test_RawRepresentable_exchange_releasing), - ("test_RawRepresentable_exchange_sequentiallyConsistent", test_RawRepresentable_exchange_sequentiallyConsistent), - ("test_RawRepresentable_load_acquiring", test_RawRepresentable_load_acquiring), - ("test_RawRepresentable_load_relaxed", test_RawRepresentable_load_relaxed), - ("test_RawRepresentable_load_sequentiallyConsistent", test_RawRepresentable_load_sequentiallyConsistent), - ("test_RawRepresentable_store_relaxed", test_RawRepresentable_store_relaxed), - ("test_RawRepresentable_store_releasing", test_RawRepresentable_store_releasing), - ("test_RawRepresentable_store_sequentiallyConsistent", test_RawRepresentable_store_sequentiallyConsistent), - ("test_RawRepresentable_weakCompareExchange_acquiring_acquiring", test_RawRepresentable_weakCompareExchange_acquiring_acquiring), - ("test_RawRepresentable_weakCompareExchange_acquiring_relaxed", test_RawRepresentable_weakCompareExchange_acquiring_relaxed), - ("test_RawRepresentable_weakCompareExchange_acquiring_sequentiallyConsistent", test_RawRepresentable_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_acquiring", test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_relaxed", test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_RawRepresentable_weakCompareExchange_relaxed_acquiring", test_RawRepresentable_weakCompareExchange_relaxed_acquiring), - ("test_RawRepresentable_weakCompareExchange_relaxed_relaxed", test_RawRepresentable_weakCompareExchange_relaxed_relaxed), - ("test_RawRepresentable_weakCompareExchange_relaxed_sequentiallyConsistent", test_RawRepresentable_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_RawRepresentable_weakCompareExchange_releasing_acquiring", test_RawRepresentable_weakCompareExchange_releasing_acquiring), - ("test_RawRepresentable_weakCompareExchange_releasing_relaxed", test_RawRepresentable_weakCompareExchange_releasing_relaxed), - ("test_RawRepresentable_weakCompareExchange_releasing_sequentiallyConsistent", test_RawRepresentable_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_acquiring", test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_relaxed", test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Reference_compareExchange_acquiring", test_Reference_compareExchange_acquiring), - ("test_Reference_compareExchange_acquiring_acquiring", test_Reference_compareExchange_acquiring_acquiring), - ("test_Reference_compareExchange_acquiring_relaxed", test_Reference_compareExchange_acquiring_relaxed), - ("test_Reference_compareExchange_acquiring_sequentiallyConsistent", test_Reference_compareExchange_acquiring_sequentiallyConsistent), - ("test_Reference_compareExchange_acquiringAndReleasing", test_Reference_compareExchange_acquiringAndReleasing), - ("test_Reference_compareExchange_acquiringAndReleasing_acquiring", test_Reference_compareExchange_acquiringAndReleasing_acquiring), - ("test_Reference_compareExchange_acquiringAndReleasing_relaxed", test_Reference_compareExchange_acquiringAndReleasing_relaxed), - ("test_Reference_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Reference_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Reference_compareExchange_relaxed", test_Reference_compareExchange_relaxed), - ("test_Reference_compareExchange_relaxed_acquiring", test_Reference_compareExchange_relaxed_acquiring), - ("test_Reference_compareExchange_relaxed_relaxed", test_Reference_compareExchange_relaxed_relaxed), - ("test_Reference_compareExchange_relaxed_sequentiallyConsistent", test_Reference_compareExchange_relaxed_sequentiallyConsistent), - ("test_Reference_compareExchange_releasing", test_Reference_compareExchange_releasing), - ("test_Reference_compareExchange_releasing_acquiring", test_Reference_compareExchange_releasing_acquiring), - ("test_Reference_compareExchange_releasing_relaxed", test_Reference_compareExchange_releasing_relaxed), - ("test_Reference_compareExchange_releasing_sequentiallyConsistent", test_Reference_compareExchange_releasing_sequentiallyConsistent), - ("test_Reference_compareExchange_sequentiallyConsistent", test_Reference_compareExchange_sequentiallyConsistent), - ("test_Reference_compareExchange_sequentiallyConsistent_acquiring", test_Reference_compareExchange_sequentiallyConsistent_acquiring), - ("test_Reference_compareExchange_sequentiallyConsistent_relaxed", test_Reference_compareExchange_sequentiallyConsistent_relaxed), - ("test_Reference_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Reference_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Reference_create_destroy", test_Reference_create_destroy), - ("test_Reference_exchange_acquiring", test_Reference_exchange_acquiring), - ("test_Reference_exchange_acquiringAndReleasing", test_Reference_exchange_acquiringAndReleasing), - ("test_Reference_exchange_relaxed", test_Reference_exchange_relaxed), - ("test_Reference_exchange_releasing", test_Reference_exchange_releasing), - ("test_Reference_exchange_sequentiallyConsistent", test_Reference_exchange_sequentiallyConsistent), - ("test_Reference_load_acquiring", test_Reference_load_acquiring), - ("test_Reference_load_relaxed", test_Reference_load_relaxed), - ("test_Reference_load_sequentiallyConsistent", test_Reference_load_sequentiallyConsistent), - ("test_Reference_store_relaxed", test_Reference_store_relaxed), - ("test_Reference_store_releasing", test_Reference_store_releasing), - ("test_Reference_store_sequentiallyConsistent", test_Reference_store_sequentiallyConsistent), - ("test_Reference_weakCompareExchange_acquiring_acquiring", test_Reference_weakCompareExchange_acquiring_acquiring), - ("test_Reference_weakCompareExchange_acquiring_relaxed", test_Reference_weakCompareExchange_acquiring_relaxed), - ("test_Reference_weakCompareExchange_acquiring_sequentiallyConsistent", test_Reference_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Reference_weakCompareExchange_acquiringAndReleasing_acquiring", test_Reference_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Reference_weakCompareExchange_acquiringAndReleasing_relaxed", test_Reference_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Reference_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Reference_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Reference_weakCompareExchange_relaxed_acquiring", test_Reference_weakCompareExchange_relaxed_acquiring), - ("test_Reference_weakCompareExchange_relaxed_relaxed", test_Reference_weakCompareExchange_relaxed_relaxed), - ("test_Reference_weakCompareExchange_relaxed_sequentiallyConsistent", test_Reference_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Reference_weakCompareExchange_releasing_acquiring", test_Reference_weakCompareExchange_releasing_acquiring), - ("test_Reference_weakCompareExchange_releasing_relaxed", test_Reference_weakCompareExchange_releasing_relaxed), - ("test_Reference_weakCompareExchange_releasing_sequentiallyConsistent", test_Reference_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Reference_weakCompareExchange_sequentiallyConsistent_acquiring", test_Reference_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Reference_weakCompareExchange_sequentiallyConsistent_relaxed", test_Reference_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Reference_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Reference_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt16_bitwiseAndThenLoad_acquiring", test_UInt16_bitwiseAndThenLoad_acquiring), - ("test_UInt16_bitwiseAndThenLoad_acquiringAndReleasing", test_UInt16_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_UInt16_bitwiseAndThenLoad_relaxed", test_UInt16_bitwiseAndThenLoad_relaxed), - ("test_UInt16_bitwiseAndThenLoad_releasing", test_UInt16_bitwiseAndThenLoad_releasing), - ("test_UInt16_bitwiseAndThenLoad_sequentiallyConsistent", test_UInt16_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_UInt16_bitwiseOrThenLoad_acquiring", test_UInt16_bitwiseOrThenLoad_acquiring), - ("test_UInt16_bitwiseOrThenLoad_acquiringAndReleasing", test_UInt16_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_UInt16_bitwiseOrThenLoad_relaxed", test_UInt16_bitwiseOrThenLoad_relaxed), - ("test_UInt16_bitwiseOrThenLoad_releasing", test_UInt16_bitwiseOrThenLoad_releasing), - ("test_UInt16_bitwiseOrThenLoad_sequentiallyConsistent", test_UInt16_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_UInt16_bitwiseXorThenLoad_acquiring", test_UInt16_bitwiseXorThenLoad_acquiring), - ("test_UInt16_bitwiseXorThenLoad_acquiringAndReleasing", test_UInt16_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_UInt16_bitwiseXorThenLoad_relaxed", test_UInt16_bitwiseXorThenLoad_relaxed), - ("test_UInt16_bitwiseXorThenLoad_releasing", test_UInt16_bitwiseXorThenLoad_releasing), - ("test_UInt16_bitwiseXorThenLoad_sequentiallyConsistent", test_UInt16_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_UInt16_compareExchange_acquiring", test_UInt16_compareExchange_acquiring), - ("test_UInt16_compareExchange_acquiring_acquiring", test_UInt16_compareExchange_acquiring_acquiring), - ("test_UInt16_compareExchange_acquiring_relaxed", test_UInt16_compareExchange_acquiring_relaxed), - ("test_UInt16_compareExchange_acquiring_sequentiallyConsistent", test_UInt16_compareExchange_acquiring_sequentiallyConsistent), - ("test_UInt16_compareExchange_acquiringAndReleasing", test_UInt16_compareExchange_acquiringAndReleasing), - ("test_UInt16_compareExchange_acquiringAndReleasing_acquiring", test_UInt16_compareExchange_acquiringAndReleasing_acquiring), - ("test_UInt16_compareExchange_acquiringAndReleasing_relaxed", test_UInt16_compareExchange_acquiringAndReleasing_relaxed), - ("test_UInt16_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt16_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt16_compareExchange_relaxed", test_UInt16_compareExchange_relaxed), - ("test_UInt16_compareExchange_relaxed_acquiring", test_UInt16_compareExchange_relaxed_acquiring), - ("test_UInt16_compareExchange_relaxed_relaxed", test_UInt16_compareExchange_relaxed_relaxed), - ("test_UInt16_compareExchange_relaxed_sequentiallyConsistent", test_UInt16_compareExchange_relaxed_sequentiallyConsistent), - ("test_UInt16_compareExchange_releasing", test_UInt16_compareExchange_releasing), - ("test_UInt16_compareExchange_releasing_acquiring", test_UInt16_compareExchange_releasing_acquiring), - ("test_UInt16_compareExchange_releasing_relaxed", test_UInt16_compareExchange_releasing_relaxed), - ("test_UInt16_compareExchange_releasing_sequentiallyConsistent", test_UInt16_compareExchange_releasing_sequentiallyConsistent), - ("test_UInt16_compareExchange_sequentiallyConsistent", test_UInt16_compareExchange_sequentiallyConsistent), - ("test_UInt16_compareExchange_sequentiallyConsistent_acquiring", test_UInt16_compareExchange_sequentiallyConsistent_acquiring), - ("test_UInt16_compareExchange_sequentiallyConsistent_relaxed", test_UInt16_compareExchange_sequentiallyConsistent_relaxed), - ("test_UInt16_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt16_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt16_create_destroy", test_UInt16_create_destroy), - ("test_UInt16_exchange_acquiring", test_UInt16_exchange_acquiring), - ("test_UInt16_exchange_acquiringAndReleasing", test_UInt16_exchange_acquiringAndReleasing), - ("test_UInt16_exchange_relaxed", test_UInt16_exchange_relaxed), - ("test_UInt16_exchange_releasing", test_UInt16_exchange_releasing), - ("test_UInt16_exchange_sequentiallyConsistent", test_UInt16_exchange_sequentiallyConsistent), - ("test_UInt16_load_acquiring", test_UInt16_load_acquiring), - ("test_UInt16_load_relaxed", test_UInt16_load_relaxed), - ("test_UInt16_load_sequentiallyConsistent", test_UInt16_load_sequentiallyConsistent), - ("test_UInt16_loadThenBitwiseAnd_acquiring", test_UInt16_loadThenBitwiseAnd_acquiring), - ("test_UInt16_loadThenBitwiseAnd_acquiringAndReleasing", test_UInt16_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_UInt16_loadThenBitwiseAnd_relaxed", test_UInt16_loadThenBitwiseAnd_relaxed), - ("test_UInt16_loadThenBitwiseAnd_releasing", test_UInt16_loadThenBitwiseAnd_releasing), - ("test_UInt16_loadThenBitwiseAnd_sequentiallyConsistent", test_UInt16_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_UInt16_loadThenBitwiseOr_acquiring", test_UInt16_loadThenBitwiseOr_acquiring), - ("test_UInt16_loadThenBitwiseOr_acquiringAndReleasing", test_UInt16_loadThenBitwiseOr_acquiringAndReleasing), - ("test_UInt16_loadThenBitwiseOr_relaxed", test_UInt16_loadThenBitwiseOr_relaxed), - ("test_UInt16_loadThenBitwiseOr_releasing", test_UInt16_loadThenBitwiseOr_releasing), - ("test_UInt16_loadThenBitwiseOr_sequentiallyConsistent", test_UInt16_loadThenBitwiseOr_sequentiallyConsistent), - ("test_UInt16_loadThenBitwiseXor_acquiring", test_UInt16_loadThenBitwiseXor_acquiring), - ("test_UInt16_loadThenBitwiseXor_acquiringAndReleasing", test_UInt16_loadThenBitwiseXor_acquiringAndReleasing), - ("test_UInt16_loadThenBitwiseXor_relaxed", test_UInt16_loadThenBitwiseXor_relaxed), - ("test_UInt16_loadThenBitwiseXor_releasing", test_UInt16_loadThenBitwiseXor_releasing), - ("test_UInt16_loadThenBitwiseXor_sequentiallyConsistent", test_UInt16_loadThenBitwiseXor_sequentiallyConsistent), - ("test_UInt16_loadThenWrappingDecrement_acquiring", test_UInt16_loadThenWrappingDecrement_acquiring), - ("test_UInt16_loadThenWrappingDecrement_acquiringAndReleasing", test_UInt16_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_UInt16_loadThenWrappingDecrement_relaxed", test_UInt16_loadThenWrappingDecrement_relaxed), - ("test_UInt16_loadThenWrappingDecrement_releasing", test_UInt16_loadThenWrappingDecrement_releasing), - ("test_UInt16_loadThenWrappingDecrement_sequentiallyConsistent", test_UInt16_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_UInt16_loadThenWrappingIncrement_acquiring", test_UInt16_loadThenWrappingIncrement_acquiring), - ("test_UInt16_loadThenWrappingIncrement_acquiringAndReleasing", test_UInt16_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_UInt16_loadThenWrappingIncrement_relaxed", test_UInt16_loadThenWrappingIncrement_relaxed), - ("test_UInt16_loadThenWrappingIncrement_releasing", test_UInt16_loadThenWrappingIncrement_releasing), - ("test_UInt16_loadThenWrappingIncrement_sequentiallyConsistent", test_UInt16_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_UInt16_store_relaxed", test_UInt16_store_relaxed), - ("test_UInt16_store_releasing", test_UInt16_store_releasing), - ("test_UInt16_store_sequentiallyConsistent", test_UInt16_store_sequentiallyConsistent), - ("test_UInt16_weakCompareExchange_acquiring_acquiring", test_UInt16_weakCompareExchange_acquiring_acquiring), - ("test_UInt16_weakCompareExchange_acquiring_relaxed", test_UInt16_weakCompareExchange_acquiring_relaxed), - ("test_UInt16_weakCompareExchange_acquiring_sequentiallyConsistent", test_UInt16_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_UInt16_weakCompareExchange_acquiringAndReleasing_acquiring", test_UInt16_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_UInt16_weakCompareExchange_acquiringAndReleasing_relaxed", test_UInt16_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_UInt16_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt16_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt16_weakCompareExchange_relaxed_acquiring", test_UInt16_weakCompareExchange_relaxed_acquiring), - ("test_UInt16_weakCompareExchange_relaxed_relaxed", test_UInt16_weakCompareExchange_relaxed_relaxed), - ("test_UInt16_weakCompareExchange_relaxed_sequentiallyConsistent", test_UInt16_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_UInt16_weakCompareExchange_releasing_acquiring", test_UInt16_weakCompareExchange_releasing_acquiring), - ("test_UInt16_weakCompareExchange_releasing_relaxed", test_UInt16_weakCompareExchange_releasing_relaxed), - ("test_UInt16_weakCompareExchange_releasing_sequentiallyConsistent", test_UInt16_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_UInt16_weakCompareExchange_sequentiallyConsistent_acquiring", test_UInt16_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_UInt16_weakCompareExchange_sequentiallyConsistent_relaxed", test_UInt16_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_UInt16_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt16_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt16_wrappingDecrementThenLoad_acquiring", test_UInt16_wrappingDecrementThenLoad_acquiring), - ("test_UInt16_wrappingDecrementThenLoad_acquiringAndReleasing", test_UInt16_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_UInt16_wrappingDecrementThenLoad_relaxed", test_UInt16_wrappingDecrementThenLoad_relaxed), - ("test_UInt16_wrappingDecrementThenLoad_releasing", test_UInt16_wrappingDecrementThenLoad_releasing), - ("test_UInt16_wrappingDecrementThenLoad_sequentiallyConsistent", test_UInt16_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_UInt16_wrappingIncrementThenLoad_acquiring", test_UInt16_wrappingIncrementThenLoad_acquiring), - ("test_UInt16_wrappingIncrementThenLoad_acquiringAndReleasing", test_UInt16_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_UInt16_wrappingIncrementThenLoad_relaxed", test_UInt16_wrappingIncrementThenLoad_relaxed), - ("test_UInt16_wrappingIncrementThenLoad_releasing", test_UInt16_wrappingIncrementThenLoad_releasing), - ("test_UInt16_wrappingIncrementThenLoad_sequentiallyConsistent", test_UInt16_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_UInt32_bitwiseAndThenLoad_acquiring", test_UInt32_bitwiseAndThenLoad_acquiring), - ("test_UInt32_bitwiseAndThenLoad_acquiringAndReleasing", test_UInt32_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_UInt32_bitwiseAndThenLoad_relaxed", test_UInt32_bitwiseAndThenLoad_relaxed), - ("test_UInt32_bitwiseAndThenLoad_releasing", test_UInt32_bitwiseAndThenLoad_releasing), - ("test_UInt32_bitwiseAndThenLoad_sequentiallyConsistent", test_UInt32_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_UInt32_bitwiseOrThenLoad_acquiring", test_UInt32_bitwiseOrThenLoad_acquiring), - ("test_UInt32_bitwiseOrThenLoad_acquiringAndReleasing", test_UInt32_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_UInt32_bitwiseOrThenLoad_relaxed", test_UInt32_bitwiseOrThenLoad_relaxed), - ("test_UInt32_bitwiseOrThenLoad_releasing", test_UInt32_bitwiseOrThenLoad_releasing), - ("test_UInt32_bitwiseOrThenLoad_sequentiallyConsistent", test_UInt32_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_UInt32_bitwiseXorThenLoad_acquiring", test_UInt32_bitwiseXorThenLoad_acquiring), - ("test_UInt32_bitwiseXorThenLoad_acquiringAndReleasing", test_UInt32_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_UInt32_bitwiseXorThenLoad_relaxed", test_UInt32_bitwiseXorThenLoad_relaxed), - ("test_UInt32_bitwiseXorThenLoad_releasing", test_UInt32_bitwiseXorThenLoad_releasing), - ("test_UInt32_bitwiseXorThenLoad_sequentiallyConsistent", test_UInt32_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_UInt32_compareExchange_acquiring", test_UInt32_compareExchange_acquiring), - ("test_UInt32_compareExchange_acquiring_acquiring", test_UInt32_compareExchange_acquiring_acquiring), - ("test_UInt32_compareExchange_acquiring_relaxed", test_UInt32_compareExchange_acquiring_relaxed), - ("test_UInt32_compareExchange_acquiring_sequentiallyConsistent", test_UInt32_compareExchange_acquiring_sequentiallyConsistent), - ("test_UInt32_compareExchange_acquiringAndReleasing", test_UInt32_compareExchange_acquiringAndReleasing), - ("test_UInt32_compareExchange_acquiringAndReleasing_acquiring", test_UInt32_compareExchange_acquiringAndReleasing_acquiring), - ("test_UInt32_compareExchange_acquiringAndReleasing_relaxed", test_UInt32_compareExchange_acquiringAndReleasing_relaxed), - ("test_UInt32_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt32_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt32_compareExchange_relaxed", test_UInt32_compareExchange_relaxed), - ("test_UInt32_compareExchange_relaxed_acquiring", test_UInt32_compareExchange_relaxed_acquiring), - ("test_UInt32_compareExchange_relaxed_relaxed", test_UInt32_compareExchange_relaxed_relaxed), - ("test_UInt32_compareExchange_relaxed_sequentiallyConsistent", test_UInt32_compareExchange_relaxed_sequentiallyConsistent), - ("test_UInt32_compareExchange_releasing", test_UInt32_compareExchange_releasing), - ("test_UInt32_compareExchange_releasing_acquiring", test_UInt32_compareExchange_releasing_acquiring), - ("test_UInt32_compareExchange_releasing_relaxed", test_UInt32_compareExchange_releasing_relaxed), - ("test_UInt32_compareExchange_releasing_sequentiallyConsistent", test_UInt32_compareExchange_releasing_sequentiallyConsistent), - ("test_UInt32_compareExchange_sequentiallyConsistent", test_UInt32_compareExchange_sequentiallyConsistent), - ("test_UInt32_compareExchange_sequentiallyConsistent_acquiring", test_UInt32_compareExchange_sequentiallyConsistent_acquiring), - ("test_UInt32_compareExchange_sequentiallyConsistent_relaxed", test_UInt32_compareExchange_sequentiallyConsistent_relaxed), - ("test_UInt32_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt32_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt32_create_destroy", test_UInt32_create_destroy), - ("test_UInt32_exchange_acquiring", test_UInt32_exchange_acquiring), - ("test_UInt32_exchange_acquiringAndReleasing", test_UInt32_exchange_acquiringAndReleasing), - ("test_UInt32_exchange_relaxed", test_UInt32_exchange_relaxed), - ("test_UInt32_exchange_releasing", test_UInt32_exchange_releasing), - ("test_UInt32_exchange_sequentiallyConsistent", test_UInt32_exchange_sequentiallyConsistent), - ("test_UInt32_load_acquiring", test_UInt32_load_acquiring), - ("test_UInt32_load_relaxed", test_UInt32_load_relaxed), - ("test_UInt32_load_sequentiallyConsistent", test_UInt32_load_sequentiallyConsistent), - ("test_UInt32_loadThenBitwiseAnd_acquiring", test_UInt32_loadThenBitwiseAnd_acquiring), - ("test_UInt32_loadThenBitwiseAnd_acquiringAndReleasing", test_UInt32_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_UInt32_loadThenBitwiseAnd_relaxed", test_UInt32_loadThenBitwiseAnd_relaxed), - ("test_UInt32_loadThenBitwiseAnd_releasing", test_UInt32_loadThenBitwiseAnd_releasing), - ("test_UInt32_loadThenBitwiseAnd_sequentiallyConsistent", test_UInt32_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_UInt32_loadThenBitwiseOr_acquiring", test_UInt32_loadThenBitwiseOr_acquiring), - ("test_UInt32_loadThenBitwiseOr_acquiringAndReleasing", test_UInt32_loadThenBitwiseOr_acquiringAndReleasing), - ("test_UInt32_loadThenBitwiseOr_relaxed", test_UInt32_loadThenBitwiseOr_relaxed), - ("test_UInt32_loadThenBitwiseOr_releasing", test_UInt32_loadThenBitwiseOr_releasing), - ("test_UInt32_loadThenBitwiseOr_sequentiallyConsistent", test_UInt32_loadThenBitwiseOr_sequentiallyConsistent), - ("test_UInt32_loadThenBitwiseXor_acquiring", test_UInt32_loadThenBitwiseXor_acquiring), - ("test_UInt32_loadThenBitwiseXor_acquiringAndReleasing", test_UInt32_loadThenBitwiseXor_acquiringAndReleasing), - ("test_UInt32_loadThenBitwiseXor_relaxed", test_UInt32_loadThenBitwiseXor_relaxed), - ("test_UInt32_loadThenBitwiseXor_releasing", test_UInt32_loadThenBitwiseXor_releasing), - ("test_UInt32_loadThenBitwiseXor_sequentiallyConsistent", test_UInt32_loadThenBitwiseXor_sequentiallyConsistent), - ("test_UInt32_loadThenWrappingDecrement_acquiring", test_UInt32_loadThenWrappingDecrement_acquiring), - ("test_UInt32_loadThenWrappingDecrement_acquiringAndReleasing", test_UInt32_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_UInt32_loadThenWrappingDecrement_relaxed", test_UInt32_loadThenWrappingDecrement_relaxed), - ("test_UInt32_loadThenWrappingDecrement_releasing", test_UInt32_loadThenWrappingDecrement_releasing), - ("test_UInt32_loadThenWrappingDecrement_sequentiallyConsistent", test_UInt32_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_UInt32_loadThenWrappingIncrement_acquiring", test_UInt32_loadThenWrappingIncrement_acquiring), - ("test_UInt32_loadThenWrappingIncrement_acquiringAndReleasing", test_UInt32_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_UInt32_loadThenWrappingIncrement_relaxed", test_UInt32_loadThenWrappingIncrement_relaxed), - ("test_UInt32_loadThenWrappingIncrement_releasing", test_UInt32_loadThenWrappingIncrement_releasing), - ("test_UInt32_loadThenWrappingIncrement_sequentiallyConsistent", test_UInt32_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_UInt32_store_relaxed", test_UInt32_store_relaxed), - ("test_UInt32_store_releasing", test_UInt32_store_releasing), - ("test_UInt32_store_sequentiallyConsistent", test_UInt32_store_sequentiallyConsistent), - ("test_UInt32_weakCompareExchange_acquiring_acquiring", test_UInt32_weakCompareExchange_acquiring_acquiring), - ("test_UInt32_weakCompareExchange_acquiring_relaxed", test_UInt32_weakCompareExchange_acquiring_relaxed), - ("test_UInt32_weakCompareExchange_acquiring_sequentiallyConsistent", test_UInt32_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_UInt32_weakCompareExchange_acquiringAndReleasing_acquiring", test_UInt32_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_UInt32_weakCompareExchange_acquiringAndReleasing_relaxed", test_UInt32_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_UInt32_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt32_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt32_weakCompareExchange_relaxed_acquiring", test_UInt32_weakCompareExchange_relaxed_acquiring), - ("test_UInt32_weakCompareExchange_relaxed_relaxed", test_UInt32_weakCompareExchange_relaxed_relaxed), - ("test_UInt32_weakCompareExchange_relaxed_sequentiallyConsistent", test_UInt32_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_UInt32_weakCompareExchange_releasing_acquiring", test_UInt32_weakCompareExchange_releasing_acquiring), - ("test_UInt32_weakCompareExchange_releasing_relaxed", test_UInt32_weakCompareExchange_releasing_relaxed), - ("test_UInt32_weakCompareExchange_releasing_sequentiallyConsistent", test_UInt32_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_UInt32_weakCompareExchange_sequentiallyConsistent_acquiring", test_UInt32_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_UInt32_weakCompareExchange_sequentiallyConsistent_relaxed", test_UInt32_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_UInt32_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt32_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt32_wrappingDecrementThenLoad_acquiring", test_UInt32_wrappingDecrementThenLoad_acquiring), - ("test_UInt32_wrappingDecrementThenLoad_acquiringAndReleasing", test_UInt32_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_UInt32_wrappingDecrementThenLoad_relaxed", test_UInt32_wrappingDecrementThenLoad_relaxed), - ("test_UInt32_wrappingDecrementThenLoad_releasing", test_UInt32_wrappingDecrementThenLoad_releasing), - ("test_UInt32_wrappingDecrementThenLoad_sequentiallyConsistent", test_UInt32_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_UInt32_wrappingIncrementThenLoad_acquiring", test_UInt32_wrappingIncrementThenLoad_acquiring), - ("test_UInt32_wrappingIncrementThenLoad_acquiringAndReleasing", test_UInt32_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_UInt32_wrappingIncrementThenLoad_relaxed", test_UInt32_wrappingIncrementThenLoad_relaxed), - ("test_UInt32_wrappingIncrementThenLoad_releasing", test_UInt32_wrappingIncrementThenLoad_releasing), - ("test_UInt32_wrappingIncrementThenLoad_sequentiallyConsistent", test_UInt32_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_UInt64_bitwiseAndThenLoad_acquiring", test_UInt64_bitwiseAndThenLoad_acquiring), - ("test_UInt64_bitwiseAndThenLoad_acquiringAndReleasing", test_UInt64_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_UInt64_bitwiseAndThenLoad_relaxed", test_UInt64_bitwiseAndThenLoad_relaxed), - ("test_UInt64_bitwiseAndThenLoad_releasing", test_UInt64_bitwiseAndThenLoad_releasing), - ("test_UInt64_bitwiseAndThenLoad_sequentiallyConsistent", test_UInt64_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_UInt64_bitwiseOrThenLoad_acquiring", test_UInt64_bitwiseOrThenLoad_acquiring), - ("test_UInt64_bitwiseOrThenLoad_acquiringAndReleasing", test_UInt64_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_UInt64_bitwiseOrThenLoad_relaxed", test_UInt64_bitwiseOrThenLoad_relaxed), - ("test_UInt64_bitwiseOrThenLoad_releasing", test_UInt64_bitwiseOrThenLoad_releasing), - ("test_UInt64_bitwiseOrThenLoad_sequentiallyConsistent", test_UInt64_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_UInt64_bitwiseXorThenLoad_acquiring", test_UInt64_bitwiseXorThenLoad_acquiring), - ("test_UInt64_bitwiseXorThenLoad_acquiringAndReleasing", test_UInt64_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_UInt64_bitwiseXorThenLoad_relaxed", test_UInt64_bitwiseXorThenLoad_relaxed), - ("test_UInt64_bitwiseXorThenLoad_releasing", test_UInt64_bitwiseXorThenLoad_releasing), - ("test_UInt64_bitwiseXorThenLoad_sequentiallyConsistent", test_UInt64_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_UInt64_compareExchange_acquiring", test_UInt64_compareExchange_acquiring), - ("test_UInt64_compareExchange_acquiring_acquiring", test_UInt64_compareExchange_acquiring_acquiring), - ("test_UInt64_compareExchange_acquiring_relaxed", test_UInt64_compareExchange_acquiring_relaxed), - ("test_UInt64_compareExchange_acquiring_sequentiallyConsistent", test_UInt64_compareExchange_acquiring_sequentiallyConsistent), - ("test_UInt64_compareExchange_acquiringAndReleasing", test_UInt64_compareExchange_acquiringAndReleasing), - ("test_UInt64_compareExchange_acquiringAndReleasing_acquiring", test_UInt64_compareExchange_acquiringAndReleasing_acquiring), - ("test_UInt64_compareExchange_acquiringAndReleasing_relaxed", test_UInt64_compareExchange_acquiringAndReleasing_relaxed), - ("test_UInt64_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt64_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt64_compareExchange_relaxed", test_UInt64_compareExchange_relaxed), - ("test_UInt64_compareExchange_relaxed_acquiring", test_UInt64_compareExchange_relaxed_acquiring), - ("test_UInt64_compareExchange_relaxed_relaxed", test_UInt64_compareExchange_relaxed_relaxed), - ("test_UInt64_compareExchange_relaxed_sequentiallyConsistent", test_UInt64_compareExchange_relaxed_sequentiallyConsistent), - ("test_UInt64_compareExchange_releasing", test_UInt64_compareExchange_releasing), - ("test_UInt64_compareExchange_releasing_acquiring", test_UInt64_compareExchange_releasing_acquiring), - ("test_UInt64_compareExchange_releasing_relaxed", test_UInt64_compareExchange_releasing_relaxed), - ("test_UInt64_compareExchange_releasing_sequentiallyConsistent", test_UInt64_compareExchange_releasing_sequentiallyConsistent), - ("test_UInt64_compareExchange_sequentiallyConsistent", test_UInt64_compareExchange_sequentiallyConsistent), - ("test_UInt64_compareExchange_sequentiallyConsistent_acquiring", test_UInt64_compareExchange_sequentiallyConsistent_acquiring), - ("test_UInt64_compareExchange_sequentiallyConsistent_relaxed", test_UInt64_compareExchange_sequentiallyConsistent_relaxed), - ("test_UInt64_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt64_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt64_create_destroy", test_UInt64_create_destroy), - ("test_UInt64_exchange_acquiring", test_UInt64_exchange_acquiring), - ("test_UInt64_exchange_acquiringAndReleasing", test_UInt64_exchange_acquiringAndReleasing), - ("test_UInt64_exchange_relaxed", test_UInt64_exchange_relaxed), - ("test_UInt64_exchange_releasing", test_UInt64_exchange_releasing), - ("test_UInt64_exchange_sequentiallyConsistent", test_UInt64_exchange_sequentiallyConsistent), - ("test_UInt64_load_acquiring", test_UInt64_load_acquiring), - ("test_UInt64_load_relaxed", test_UInt64_load_relaxed), - ("test_UInt64_load_sequentiallyConsistent", test_UInt64_load_sequentiallyConsistent), - ("test_UInt64_loadThenBitwiseAnd_acquiring", test_UInt64_loadThenBitwiseAnd_acquiring), - ("test_UInt64_loadThenBitwiseAnd_acquiringAndReleasing", test_UInt64_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_UInt64_loadThenBitwiseAnd_relaxed", test_UInt64_loadThenBitwiseAnd_relaxed), - ("test_UInt64_loadThenBitwiseAnd_releasing", test_UInt64_loadThenBitwiseAnd_releasing), - ("test_UInt64_loadThenBitwiseAnd_sequentiallyConsistent", test_UInt64_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_UInt64_loadThenBitwiseOr_acquiring", test_UInt64_loadThenBitwiseOr_acquiring), - ("test_UInt64_loadThenBitwiseOr_acquiringAndReleasing", test_UInt64_loadThenBitwiseOr_acquiringAndReleasing), - ("test_UInt64_loadThenBitwiseOr_relaxed", test_UInt64_loadThenBitwiseOr_relaxed), - ("test_UInt64_loadThenBitwiseOr_releasing", test_UInt64_loadThenBitwiseOr_releasing), - ("test_UInt64_loadThenBitwiseOr_sequentiallyConsistent", test_UInt64_loadThenBitwiseOr_sequentiallyConsistent), - ("test_UInt64_loadThenBitwiseXor_acquiring", test_UInt64_loadThenBitwiseXor_acquiring), - ("test_UInt64_loadThenBitwiseXor_acquiringAndReleasing", test_UInt64_loadThenBitwiseXor_acquiringAndReleasing), - ("test_UInt64_loadThenBitwiseXor_relaxed", test_UInt64_loadThenBitwiseXor_relaxed), - ("test_UInt64_loadThenBitwiseXor_releasing", test_UInt64_loadThenBitwiseXor_releasing), - ("test_UInt64_loadThenBitwiseXor_sequentiallyConsistent", test_UInt64_loadThenBitwiseXor_sequentiallyConsistent), - ("test_UInt64_loadThenWrappingDecrement_acquiring", test_UInt64_loadThenWrappingDecrement_acquiring), - ("test_UInt64_loadThenWrappingDecrement_acquiringAndReleasing", test_UInt64_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_UInt64_loadThenWrappingDecrement_relaxed", test_UInt64_loadThenWrappingDecrement_relaxed), - ("test_UInt64_loadThenWrappingDecrement_releasing", test_UInt64_loadThenWrappingDecrement_releasing), - ("test_UInt64_loadThenWrappingDecrement_sequentiallyConsistent", test_UInt64_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_UInt64_loadThenWrappingIncrement_acquiring", test_UInt64_loadThenWrappingIncrement_acquiring), - ("test_UInt64_loadThenWrappingIncrement_acquiringAndReleasing", test_UInt64_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_UInt64_loadThenWrappingIncrement_relaxed", test_UInt64_loadThenWrappingIncrement_relaxed), - ("test_UInt64_loadThenWrappingIncrement_releasing", test_UInt64_loadThenWrappingIncrement_releasing), - ("test_UInt64_loadThenWrappingIncrement_sequentiallyConsistent", test_UInt64_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_UInt64_store_relaxed", test_UInt64_store_relaxed), - ("test_UInt64_store_releasing", test_UInt64_store_releasing), - ("test_UInt64_store_sequentiallyConsistent", test_UInt64_store_sequentiallyConsistent), - ("test_UInt64_weakCompareExchange_acquiring_acquiring", test_UInt64_weakCompareExchange_acquiring_acquiring), - ("test_UInt64_weakCompareExchange_acquiring_relaxed", test_UInt64_weakCompareExchange_acquiring_relaxed), - ("test_UInt64_weakCompareExchange_acquiring_sequentiallyConsistent", test_UInt64_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_UInt64_weakCompareExchange_acquiringAndReleasing_acquiring", test_UInt64_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_UInt64_weakCompareExchange_acquiringAndReleasing_relaxed", test_UInt64_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_UInt64_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt64_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt64_weakCompareExchange_relaxed_acquiring", test_UInt64_weakCompareExchange_relaxed_acquiring), - ("test_UInt64_weakCompareExchange_relaxed_relaxed", test_UInt64_weakCompareExchange_relaxed_relaxed), - ("test_UInt64_weakCompareExchange_relaxed_sequentiallyConsistent", test_UInt64_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_UInt64_weakCompareExchange_releasing_acquiring", test_UInt64_weakCompareExchange_releasing_acquiring), - ("test_UInt64_weakCompareExchange_releasing_relaxed", test_UInt64_weakCompareExchange_releasing_relaxed), - ("test_UInt64_weakCompareExchange_releasing_sequentiallyConsistent", test_UInt64_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_UInt64_weakCompareExchange_sequentiallyConsistent_acquiring", test_UInt64_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_UInt64_weakCompareExchange_sequentiallyConsistent_relaxed", test_UInt64_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_UInt64_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt64_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt64_wrappingDecrementThenLoad_acquiring", test_UInt64_wrappingDecrementThenLoad_acquiring), - ("test_UInt64_wrappingDecrementThenLoad_acquiringAndReleasing", test_UInt64_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_UInt64_wrappingDecrementThenLoad_relaxed", test_UInt64_wrappingDecrementThenLoad_relaxed), - ("test_UInt64_wrappingDecrementThenLoad_releasing", test_UInt64_wrappingDecrementThenLoad_releasing), - ("test_UInt64_wrappingDecrementThenLoad_sequentiallyConsistent", test_UInt64_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_UInt64_wrappingIncrementThenLoad_acquiring", test_UInt64_wrappingIncrementThenLoad_acquiring), - ("test_UInt64_wrappingIncrementThenLoad_acquiringAndReleasing", test_UInt64_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_UInt64_wrappingIncrementThenLoad_relaxed", test_UInt64_wrappingIncrementThenLoad_relaxed), - ("test_UInt64_wrappingIncrementThenLoad_releasing", test_UInt64_wrappingIncrementThenLoad_releasing), - ("test_UInt64_wrappingIncrementThenLoad_sequentiallyConsistent", test_UInt64_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_UInt8_bitwiseAndThenLoad_acquiring", test_UInt8_bitwiseAndThenLoad_acquiring), - ("test_UInt8_bitwiseAndThenLoad_acquiringAndReleasing", test_UInt8_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_UInt8_bitwiseAndThenLoad_relaxed", test_UInt8_bitwiseAndThenLoad_relaxed), - ("test_UInt8_bitwiseAndThenLoad_releasing", test_UInt8_bitwiseAndThenLoad_releasing), - ("test_UInt8_bitwiseAndThenLoad_sequentiallyConsistent", test_UInt8_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_UInt8_bitwiseOrThenLoad_acquiring", test_UInt8_bitwiseOrThenLoad_acquiring), - ("test_UInt8_bitwiseOrThenLoad_acquiringAndReleasing", test_UInt8_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_UInt8_bitwiseOrThenLoad_relaxed", test_UInt8_bitwiseOrThenLoad_relaxed), - ("test_UInt8_bitwiseOrThenLoad_releasing", test_UInt8_bitwiseOrThenLoad_releasing), - ("test_UInt8_bitwiseOrThenLoad_sequentiallyConsistent", test_UInt8_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_UInt8_bitwiseXorThenLoad_acquiring", test_UInt8_bitwiseXorThenLoad_acquiring), - ("test_UInt8_bitwiseXorThenLoad_acquiringAndReleasing", test_UInt8_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_UInt8_bitwiseXorThenLoad_relaxed", test_UInt8_bitwiseXorThenLoad_relaxed), - ("test_UInt8_bitwiseXorThenLoad_releasing", test_UInt8_bitwiseXorThenLoad_releasing), - ("test_UInt8_bitwiseXorThenLoad_sequentiallyConsistent", test_UInt8_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_UInt8_compareExchange_acquiring", test_UInt8_compareExchange_acquiring), - ("test_UInt8_compareExchange_acquiring_acquiring", test_UInt8_compareExchange_acquiring_acquiring), - ("test_UInt8_compareExchange_acquiring_relaxed", test_UInt8_compareExchange_acquiring_relaxed), - ("test_UInt8_compareExchange_acquiring_sequentiallyConsistent", test_UInt8_compareExchange_acquiring_sequentiallyConsistent), - ("test_UInt8_compareExchange_acquiringAndReleasing", test_UInt8_compareExchange_acquiringAndReleasing), - ("test_UInt8_compareExchange_acquiringAndReleasing_acquiring", test_UInt8_compareExchange_acquiringAndReleasing_acquiring), - ("test_UInt8_compareExchange_acquiringAndReleasing_relaxed", test_UInt8_compareExchange_acquiringAndReleasing_relaxed), - ("test_UInt8_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt8_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt8_compareExchange_relaxed", test_UInt8_compareExchange_relaxed), - ("test_UInt8_compareExchange_relaxed_acquiring", test_UInt8_compareExchange_relaxed_acquiring), - ("test_UInt8_compareExchange_relaxed_relaxed", test_UInt8_compareExchange_relaxed_relaxed), - ("test_UInt8_compareExchange_relaxed_sequentiallyConsistent", test_UInt8_compareExchange_relaxed_sequentiallyConsistent), - ("test_UInt8_compareExchange_releasing", test_UInt8_compareExchange_releasing), - ("test_UInt8_compareExchange_releasing_acquiring", test_UInt8_compareExchange_releasing_acquiring), - ("test_UInt8_compareExchange_releasing_relaxed", test_UInt8_compareExchange_releasing_relaxed), - ("test_UInt8_compareExchange_releasing_sequentiallyConsistent", test_UInt8_compareExchange_releasing_sequentiallyConsistent), - ("test_UInt8_compareExchange_sequentiallyConsistent", test_UInt8_compareExchange_sequentiallyConsistent), - ("test_UInt8_compareExchange_sequentiallyConsistent_acquiring", test_UInt8_compareExchange_sequentiallyConsistent_acquiring), - ("test_UInt8_compareExchange_sequentiallyConsistent_relaxed", test_UInt8_compareExchange_sequentiallyConsistent_relaxed), - ("test_UInt8_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt8_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt8_create_destroy", test_UInt8_create_destroy), - ("test_UInt8_exchange_acquiring", test_UInt8_exchange_acquiring), - ("test_UInt8_exchange_acquiringAndReleasing", test_UInt8_exchange_acquiringAndReleasing), - ("test_UInt8_exchange_relaxed", test_UInt8_exchange_relaxed), - ("test_UInt8_exchange_releasing", test_UInt8_exchange_releasing), - ("test_UInt8_exchange_sequentiallyConsistent", test_UInt8_exchange_sequentiallyConsistent), - ("test_UInt8_load_acquiring", test_UInt8_load_acquiring), - ("test_UInt8_load_relaxed", test_UInt8_load_relaxed), - ("test_UInt8_load_sequentiallyConsistent", test_UInt8_load_sequentiallyConsistent), - ("test_UInt8_loadThenBitwiseAnd_acquiring", test_UInt8_loadThenBitwiseAnd_acquiring), - ("test_UInt8_loadThenBitwiseAnd_acquiringAndReleasing", test_UInt8_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_UInt8_loadThenBitwiseAnd_relaxed", test_UInt8_loadThenBitwiseAnd_relaxed), - ("test_UInt8_loadThenBitwiseAnd_releasing", test_UInt8_loadThenBitwiseAnd_releasing), - ("test_UInt8_loadThenBitwiseAnd_sequentiallyConsistent", test_UInt8_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_UInt8_loadThenBitwiseOr_acquiring", test_UInt8_loadThenBitwiseOr_acquiring), - ("test_UInt8_loadThenBitwiseOr_acquiringAndReleasing", test_UInt8_loadThenBitwiseOr_acquiringAndReleasing), - ("test_UInt8_loadThenBitwiseOr_relaxed", test_UInt8_loadThenBitwiseOr_relaxed), - ("test_UInt8_loadThenBitwiseOr_releasing", test_UInt8_loadThenBitwiseOr_releasing), - ("test_UInt8_loadThenBitwiseOr_sequentiallyConsistent", test_UInt8_loadThenBitwiseOr_sequentiallyConsistent), - ("test_UInt8_loadThenBitwiseXor_acquiring", test_UInt8_loadThenBitwiseXor_acquiring), - ("test_UInt8_loadThenBitwiseXor_acquiringAndReleasing", test_UInt8_loadThenBitwiseXor_acquiringAndReleasing), - ("test_UInt8_loadThenBitwiseXor_relaxed", test_UInt8_loadThenBitwiseXor_relaxed), - ("test_UInt8_loadThenBitwiseXor_releasing", test_UInt8_loadThenBitwiseXor_releasing), - ("test_UInt8_loadThenBitwiseXor_sequentiallyConsistent", test_UInt8_loadThenBitwiseXor_sequentiallyConsistent), - ("test_UInt8_loadThenWrappingDecrement_acquiring", test_UInt8_loadThenWrappingDecrement_acquiring), - ("test_UInt8_loadThenWrappingDecrement_acquiringAndReleasing", test_UInt8_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_UInt8_loadThenWrappingDecrement_relaxed", test_UInt8_loadThenWrappingDecrement_relaxed), - ("test_UInt8_loadThenWrappingDecrement_releasing", test_UInt8_loadThenWrappingDecrement_releasing), - ("test_UInt8_loadThenWrappingDecrement_sequentiallyConsistent", test_UInt8_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_UInt8_loadThenWrappingIncrement_acquiring", test_UInt8_loadThenWrappingIncrement_acquiring), - ("test_UInt8_loadThenWrappingIncrement_acquiringAndReleasing", test_UInt8_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_UInt8_loadThenWrappingIncrement_relaxed", test_UInt8_loadThenWrappingIncrement_relaxed), - ("test_UInt8_loadThenWrappingIncrement_releasing", test_UInt8_loadThenWrappingIncrement_releasing), - ("test_UInt8_loadThenWrappingIncrement_sequentiallyConsistent", test_UInt8_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_UInt8_store_relaxed", test_UInt8_store_relaxed), - ("test_UInt8_store_releasing", test_UInt8_store_releasing), - ("test_UInt8_store_sequentiallyConsistent", test_UInt8_store_sequentiallyConsistent), - ("test_UInt8_weakCompareExchange_acquiring_acquiring", test_UInt8_weakCompareExchange_acquiring_acquiring), - ("test_UInt8_weakCompareExchange_acquiring_relaxed", test_UInt8_weakCompareExchange_acquiring_relaxed), - ("test_UInt8_weakCompareExchange_acquiring_sequentiallyConsistent", test_UInt8_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_UInt8_weakCompareExchange_acquiringAndReleasing_acquiring", test_UInt8_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_UInt8_weakCompareExchange_acquiringAndReleasing_relaxed", test_UInt8_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_UInt8_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt8_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt8_weakCompareExchange_relaxed_acquiring", test_UInt8_weakCompareExchange_relaxed_acquiring), - ("test_UInt8_weakCompareExchange_relaxed_relaxed", test_UInt8_weakCompareExchange_relaxed_relaxed), - ("test_UInt8_weakCompareExchange_relaxed_sequentiallyConsistent", test_UInt8_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_UInt8_weakCompareExchange_releasing_acquiring", test_UInt8_weakCompareExchange_releasing_acquiring), - ("test_UInt8_weakCompareExchange_releasing_relaxed", test_UInt8_weakCompareExchange_releasing_relaxed), - ("test_UInt8_weakCompareExchange_releasing_sequentiallyConsistent", test_UInt8_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_UInt8_weakCompareExchange_sequentiallyConsistent_acquiring", test_UInt8_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_UInt8_weakCompareExchange_sequentiallyConsistent_relaxed", test_UInt8_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_UInt8_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt8_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt8_wrappingDecrementThenLoad_acquiring", test_UInt8_wrappingDecrementThenLoad_acquiring), - ("test_UInt8_wrappingDecrementThenLoad_acquiringAndReleasing", test_UInt8_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_UInt8_wrappingDecrementThenLoad_relaxed", test_UInt8_wrappingDecrementThenLoad_relaxed), - ("test_UInt8_wrappingDecrementThenLoad_releasing", test_UInt8_wrappingDecrementThenLoad_releasing), - ("test_UInt8_wrappingDecrementThenLoad_sequentiallyConsistent", test_UInt8_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_UInt8_wrappingIncrementThenLoad_acquiring", test_UInt8_wrappingIncrementThenLoad_acquiring), - ("test_UInt8_wrappingIncrementThenLoad_acquiringAndReleasing", test_UInt8_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_UInt8_wrappingIncrementThenLoad_relaxed", test_UInt8_wrappingIncrementThenLoad_relaxed), - ("test_UInt8_wrappingIncrementThenLoad_releasing", test_UInt8_wrappingIncrementThenLoad_releasing), - ("test_UInt8_wrappingIncrementThenLoad_sequentiallyConsistent", test_UInt8_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_UInt_bitwiseAndThenLoad_acquiring", test_UInt_bitwiseAndThenLoad_acquiring), - ("test_UInt_bitwiseAndThenLoad_acquiringAndReleasing", test_UInt_bitwiseAndThenLoad_acquiringAndReleasing), - ("test_UInt_bitwiseAndThenLoad_relaxed", test_UInt_bitwiseAndThenLoad_relaxed), - ("test_UInt_bitwiseAndThenLoad_releasing", test_UInt_bitwiseAndThenLoad_releasing), - ("test_UInt_bitwiseAndThenLoad_sequentiallyConsistent", test_UInt_bitwiseAndThenLoad_sequentiallyConsistent), - ("test_UInt_bitwiseOrThenLoad_acquiring", test_UInt_bitwiseOrThenLoad_acquiring), - ("test_UInt_bitwiseOrThenLoad_acquiringAndReleasing", test_UInt_bitwiseOrThenLoad_acquiringAndReleasing), - ("test_UInt_bitwiseOrThenLoad_relaxed", test_UInt_bitwiseOrThenLoad_relaxed), - ("test_UInt_bitwiseOrThenLoad_releasing", test_UInt_bitwiseOrThenLoad_releasing), - ("test_UInt_bitwiseOrThenLoad_sequentiallyConsistent", test_UInt_bitwiseOrThenLoad_sequentiallyConsistent), - ("test_UInt_bitwiseXorThenLoad_acquiring", test_UInt_bitwiseXorThenLoad_acquiring), - ("test_UInt_bitwiseXorThenLoad_acquiringAndReleasing", test_UInt_bitwiseXorThenLoad_acquiringAndReleasing), - ("test_UInt_bitwiseXorThenLoad_relaxed", test_UInt_bitwiseXorThenLoad_relaxed), - ("test_UInt_bitwiseXorThenLoad_releasing", test_UInt_bitwiseXorThenLoad_releasing), - ("test_UInt_bitwiseXorThenLoad_sequentiallyConsistent", test_UInt_bitwiseXorThenLoad_sequentiallyConsistent), - ("test_UInt_compareExchange_acquiring", test_UInt_compareExchange_acquiring), - ("test_UInt_compareExchange_acquiring_acquiring", test_UInt_compareExchange_acquiring_acquiring), - ("test_UInt_compareExchange_acquiring_relaxed", test_UInt_compareExchange_acquiring_relaxed), - ("test_UInt_compareExchange_acquiring_sequentiallyConsistent", test_UInt_compareExchange_acquiring_sequentiallyConsistent), - ("test_UInt_compareExchange_acquiringAndReleasing", test_UInt_compareExchange_acquiringAndReleasing), - ("test_UInt_compareExchange_acquiringAndReleasing_acquiring", test_UInt_compareExchange_acquiringAndReleasing_acquiring), - ("test_UInt_compareExchange_acquiringAndReleasing_relaxed", test_UInt_compareExchange_acquiringAndReleasing_relaxed), - ("test_UInt_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt_compareExchange_relaxed", test_UInt_compareExchange_relaxed), - ("test_UInt_compareExchange_relaxed_acquiring", test_UInt_compareExchange_relaxed_acquiring), - ("test_UInt_compareExchange_relaxed_relaxed", test_UInt_compareExchange_relaxed_relaxed), - ("test_UInt_compareExchange_relaxed_sequentiallyConsistent", test_UInt_compareExchange_relaxed_sequentiallyConsistent), - ("test_UInt_compareExchange_releasing", test_UInt_compareExchange_releasing), - ("test_UInt_compareExchange_releasing_acquiring", test_UInt_compareExchange_releasing_acquiring), - ("test_UInt_compareExchange_releasing_relaxed", test_UInt_compareExchange_releasing_relaxed), - ("test_UInt_compareExchange_releasing_sequentiallyConsistent", test_UInt_compareExchange_releasing_sequentiallyConsistent), - ("test_UInt_compareExchange_sequentiallyConsistent", test_UInt_compareExchange_sequentiallyConsistent), - ("test_UInt_compareExchange_sequentiallyConsistent_acquiring", test_UInt_compareExchange_sequentiallyConsistent_acquiring), - ("test_UInt_compareExchange_sequentiallyConsistent_relaxed", test_UInt_compareExchange_sequentiallyConsistent_relaxed), - ("test_UInt_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt_create_destroy", test_UInt_create_destroy), - ("test_UInt_exchange_acquiring", test_UInt_exchange_acquiring), - ("test_UInt_exchange_acquiringAndReleasing", test_UInt_exchange_acquiringAndReleasing), - ("test_UInt_exchange_relaxed", test_UInt_exchange_relaxed), - ("test_UInt_exchange_releasing", test_UInt_exchange_releasing), - ("test_UInt_exchange_sequentiallyConsistent", test_UInt_exchange_sequentiallyConsistent), - ("test_UInt_load_acquiring", test_UInt_load_acquiring), - ("test_UInt_load_relaxed", test_UInt_load_relaxed), - ("test_UInt_load_sequentiallyConsistent", test_UInt_load_sequentiallyConsistent), - ("test_UInt_loadThenBitwiseAnd_acquiring", test_UInt_loadThenBitwiseAnd_acquiring), - ("test_UInt_loadThenBitwiseAnd_acquiringAndReleasing", test_UInt_loadThenBitwiseAnd_acquiringAndReleasing), - ("test_UInt_loadThenBitwiseAnd_relaxed", test_UInt_loadThenBitwiseAnd_relaxed), - ("test_UInt_loadThenBitwiseAnd_releasing", test_UInt_loadThenBitwiseAnd_releasing), - ("test_UInt_loadThenBitwiseAnd_sequentiallyConsistent", test_UInt_loadThenBitwiseAnd_sequentiallyConsistent), - ("test_UInt_loadThenBitwiseOr_acquiring", test_UInt_loadThenBitwiseOr_acquiring), - ("test_UInt_loadThenBitwiseOr_acquiringAndReleasing", test_UInt_loadThenBitwiseOr_acquiringAndReleasing), - ("test_UInt_loadThenBitwiseOr_relaxed", test_UInt_loadThenBitwiseOr_relaxed), - ("test_UInt_loadThenBitwiseOr_releasing", test_UInt_loadThenBitwiseOr_releasing), - ("test_UInt_loadThenBitwiseOr_sequentiallyConsistent", test_UInt_loadThenBitwiseOr_sequentiallyConsistent), - ("test_UInt_loadThenBitwiseXor_acquiring", test_UInt_loadThenBitwiseXor_acquiring), - ("test_UInt_loadThenBitwiseXor_acquiringAndReleasing", test_UInt_loadThenBitwiseXor_acquiringAndReleasing), - ("test_UInt_loadThenBitwiseXor_relaxed", test_UInt_loadThenBitwiseXor_relaxed), - ("test_UInt_loadThenBitwiseXor_releasing", test_UInt_loadThenBitwiseXor_releasing), - ("test_UInt_loadThenBitwiseXor_sequentiallyConsistent", test_UInt_loadThenBitwiseXor_sequentiallyConsistent), - ("test_UInt_loadThenWrappingDecrement_acquiring", test_UInt_loadThenWrappingDecrement_acquiring), - ("test_UInt_loadThenWrappingDecrement_acquiringAndReleasing", test_UInt_loadThenWrappingDecrement_acquiringAndReleasing), - ("test_UInt_loadThenWrappingDecrement_relaxed", test_UInt_loadThenWrappingDecrement_relaxed), - ("test_UInt_loadThenWrappingDecrement_releasing", test_UInt_loadThenWrappingDecrement_releasing), - ("test_UInt_loadThenWrappingDecrement_sequentiallyConsistent", test_UInt_loadThenWrappingDecrement_sequentiallyConsistent), - ("test_UInt_loadThenWrappingIncrement_acquiring", test_UInt_loadThenWrappingIncrement_acquiring), - ("test_UInt_loadThenWrappingIncrement_acquiringAndReleasing", test_UInt_loadThenWrappingIncrement_acquiringAndReleasing), - ("test_UInt_loadThenWrappingIncrement_relaxed", test_UInt_loadThenWrappingIncrement_relaxed), - ("test_UInt_loadThenWrappingIncrement_releasing", test_UInt_loadThenWrappingIncrement_releasing), - ("test_UInt_loadThenWrappingIncrement_sequentiallyConsistent", test_UInt_loadThenWrappingIncrement_sequentiallyConsistent), - ("test_UInt_store_relaxed", test_UInt_store_relaxed), - ("test_UInt_store_releasing", test_UInt_store_releasing), - ("test_UInt_store_sequentiallyConsistent", test_UInt_store_sequentiallyConsistent), - ("test_UInt_weakCompareExchange_acquiring_acquiring", test_UInt_weakCompareExchange_acquiring_acquiring), - ("test_UInt_weakCompareExchange_acquiring_relaxed", test_UInt_weakCompareExchange_acquiring_relaxed), - ("test_UInt_weakCompareExchange_acquiring_sequentiallyConsistent", test_UInt_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_UInt_weakCompareExchange_acquiringAndReleasing_acquiring", test_UInt_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_UInt_weakCompareExchange_acquiringAndReleasing_relaxed", test_UInt_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_UInt_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_UInt_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_UInt_weakCompareExchange_relaxed_acquiring", test_UInt_weakCompareExchange_relaxed_acquiring), - ("test_UInt_weakCompareExchange_relaxed_relaxed", test_UInt_weakCompareExchange_relaxed_relaxed), - ("test_UInt_weakCompareExchange_relaxed_sequentiallyConsistent", test_UInt_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_UInt_weakCompareExchange_releasing_acquiring", test_UInt_weakCompareExchange_releasing_acquiring), - ("test_UInt_weakCompareExchange_releasing_relaxed", test_UInt_weakCompareExchange_releasing_relaxed), - ("test_UInt_weakCompareExchange_releasing_sequentiallyConsistent", test_UInt_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_UInt_weakCompareExchange_sequentiallyConsistent_acquiring", test_UInt_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_UInt_weakCompareExchange_sequentiallyConsistent_relaxed", test_UInt_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_UInt_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_UInt_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_UInt_wrappingDecrementThenLoad_acquiring", test_UInt_wrappingDecrementThenLoad_acquiring), - ("test_UInt_wrappingDecrementThenLoad_acquiringAndReleasing", test_UInt_wrappingDecrementThenLoad_acquiringAndReleasing), - ("test_UInt_wrappingDecrementThenLoad_relaxed", test_UInt_wrappingDecrementThenLoad_relaxed), - ("test_UInt_wrappingDecrementThenLoad_releasing", test_UInt_wrappingDecrementThenLoad_releasing), - ("test_UInt_wrappingDecrementThenLoad_sequentiallyConsistent", test_UInt_wrappingDecrementThenLoad_sequentiallyConsistent), - ("test_UInt_wrappingIncrementThenLoad_acquiring", test_UInt_wrappingIncrementThenLoad_acquiring), - ("test_UInt_wrappingIncrementThenLoad_acquiringAndReleasing", test_UInt_wrappingIncrementThenLoad_acquiringAndReleasing), - ("test_UInt_wrappingIncrementThenLoad_relaxed", test_UInt_wrappingIncrementThenLoad_relaxed), - ("test_UInt_wrappingIncrementThenLoad_releasing", test_UInt_wrappingIncrementThenLoad_releasing), - ("test_UInt_wrappingIncrementThenLoad_sequentiallyConsistent", test_UInt_wrappingIncrementThenLoad_sequentiallyConsistent), - ("test_Unmanaged_compareExchange_acquiring", test_Unmanaged_compareExchange_acquiring), - ("test_Unmanaged_compareExchange_acquiring_acquiring", test_Unmanaged_compareExchange_acquiring_acquiring), - ("test_Unmanaged_compareExchange_acquiring_relaxed", test_Unmanaged_compareExchange_acquiring_relaxed), - ("test_Unmanaged_compareExchange_acquiring_sequentiallyConsistent", test_Unmanaged_compareExchange_acquiring_sequentiallyConsistent), - ("test_Unmanaged_compareExchange_acquiringAndReleasing", test_Unmanaged_compareExchange_acquiringAndReleasing), - ("test_Unmanaged_compareExchange_acquiringAndReleasing_acquiring", test_Unmanaged_compareExchange_acquiringAndReleasing_acquiring), - ("test_Unmanaged_compareExchange_acquiringAndReleasing_relaxed", test_Unmanaged_compareExchange_acquiringAndReleasing_relaxed), - ("test_Unmanaged_compareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Unmanaged_compareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Unmanaged_compareExchange_relaxed", test_Unmanaged_compareExchange_relaxed), - ("test_Unmanaged_compareExchange_relaxed_acquiring", test_Unmanaged_compareExchange_relaxed_acquiring), - ("test_Unmanaged_compareExchange_relaxed_relaxed", test_Unmanaged_compareExchange_relaxed_relaxed), - ("test_Unmanaged_compareExchange_relaxed_sequentiallyConsistent", test_Unmanaged_compareExchange_relaxed_sequentiallyConsistent), - ("test_Unmanaged_compareExchange_releasing", test_Unmanaged_compareExchange_releasing), - ("test_Unmanaged_compareExchange_releasing_acquiring", test_Unmanaged_compareExchange_releasing_acquiring), - ("test_Unmanaged_compareExchange_releasing_relaxed", test_Unmanaged_compareExchange_releasing_relaxed), - ("test_Unmanaged_compareExchange_releasing_sequentiallyConsistent", test_Unmanaged_compareExchange_releasing_sequentiallyConsistent), - ("test_Unmanaged_compareExchange_sequentiallyConsistent", test_Unmanaged_compareExchange_sequentiallyConsistent), - ("test_Unmanaged_compareExchange_sequentiallyConsistent_acquiring", test_Unmanaged_compareExchange_sequentiallyConsistent_acquiring), - ("test_Unmanaged_compareExchange_sequentiallyConsistent_relaxed", test_Unmanaged_compareExchange_sequentiallyConsistent_relaxed), - ("test_Unmanaged_compareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Unmanaged_compareExchange_sequentiallyConsistent_sequentiallyConsistent), - ("test_Unmanaged_create_destroy", test_Unmanaged_create_destroy), - ("test_Unmanaged_exchange_acquiring", test_Unmanaged_exchange_acquiring), - ("test_Unmanaged_exchange_acquiringAndReleasing", test_Unmanaged_exchange_acquiringAndReleasing), - ("test_Unmanaged_exchange_relaxed", test_Unmanaged_exchange_relaxed), - ("test_Unmanaged_exchange_releasing", test_Unmanaged_exchange_releasing), - ("test_Unmanaged_exchange_sequentiallyConsistent", test_Unmanaged_exchange_sequentiallyConsistent), - ("test_Unmanaged_load_acquiring", test_Unmanaged_load_acquiring), - ("test_Unmanaged_load_relaxed", test_Unmanaged_load_relaxed), - ("test_Unmanaged_load_sequentiallyConsistent", test_Unmanaged_load_sequentiallyConsistent), - ("test_Unmanaged_store_relaxed", test_Unmanaged_store_relaxed), - ("test_Unmanaged_store_releasing", test_Unmanaged_store_releasing), - ("test_Unmanaged_store_sequentiallyConsistent", test_Unmanaged_store_sequentiallyConsistent), - ("test_Unmanaged_weakCompareExchange_acquiring_acquiring", test_Unmanaged_weakCompareExchange_acquiring_acquiring), - ("test_Unmanaged_weakCompareExchange_acquiring_relaxed", test_Unmanaged_weakCompareExchange_acquiring_relaxed), - ("test_Unmanaged_weakCompareExchange_acquiring_sequentiallyConsistent", test_Unmanaged_weakCompareExchange_acquiring_sequentiallyConsistent), - ("test_Unmanaged_weakCompareExchange_acquiringAndReleasing_acquiring", test_Unmanaged_weakCompareExchange_acquiringAndReleasing_acquiring), - ("test_Unmanaged_weakCompareExchange_acquiringAndReleasing_relaxed", test_Unmanaged_weakCompareExchange_acquiringAndReleasing_relaxed), - ("test_Unmanaged_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent", test_Unmanaged_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent), - ("test_Unmanaged_weakCompareExchange_relaxed_acquiring", test_Unmanaged_weakCompareExchange_relaxed_acquiring), - ("test_Unmanaged_weakCompareExchange_relaxed_relaxed", test_Unmanaged_weakCompareExchange_relaxed_relaxed), - ("test_Unmanaged_weakCompareExchange_relaxed_sequentiallyConsistent", test_Unmanaged_weakCompareExchange_relaxed_sequentiallyConsistent), - ("test_Unmanaged_weakCompareExchange_releasing_acquiring", test_Unmanaged_weakCompareExchange_releasing_acquiring), - ("test_Unmanaged_weakCompareExchange_releasing_relaxed", test_Unmanaged_weakCompareExchange_releasing_relaxed), - ("test_Unmanaged_weakCompareExchange_releasing_sequentiallyConsistent", test_Unmanaged_weakCompareExchange_releasing_sequentiallyConsistent), - ("test_Unmanaged_weakCompareExchange_sequentiallyConsistent_acquiring", test_Unmanaged_weakCompareExchange_sequentiallyConsistent_acquiring), - ("test_Unmanaged_weakCompareExchange_sequentiallyConsistent_relaxed", test_Unmanaged_weakCompareExchange_sequentiallyConsistent_relaxed), - ("test_Unmanaged_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent", test_Unmanaged_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent), - ] -} - -extension DoubleWordTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__DoubleWordTests = [ - ("testFirstSecondInitializer", testFirstSecondInitializer), - ("testHighLowInitializer", testHighLowInitializer), - ("testMemoryLayout", testMemoryLayout), - ("testPropertyGetters", testPropertyGetters), - ("testPropertySetters", testPropertySetters), - ] -} - -extension LockFreeSingleConsumerStackTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__LockFreeSingleConsumerStackTests = [ - ("test_Basics", test_Basics), - ("test_ConcurrentPushes", test_ConcurrentPushes), - ("test_ConcurrentPushesAndPops", test_ConcurrentPushesAndPops), - ] -} - -extension QueueTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__QueueTests = [ - ("test01_10", test01_10), - ("test02_10", test02_10), - ("test04_10", test04_10), - ("test16_16", test16_16), - ] -} - -extension StrongReferenceRace { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__StrongReferenceRace = [ - ("testCompareExchange1", testCompareExchange1), - ("testCompareExchange16", testCompareExchange16), - ("testCompareExchange2", testCompareExchange2), - ("testCompareExchange4", testCompareExchange4), - ("testCompareExchange8", testCompareExchange8), - ("testCompareExchangeNil_01", testCompareExchangeNil_01), - ("testCompareExchangeNil_02", testCompareExchangeNil_02), - ("testCompareExchangeNil_04", testCompareExchangeNil_04), - ("testCompareExchangeNil_08", testCompareExchangeNil_08), - ("testCompareExchangeNil_16", testCompareExchangeNil_16), - ("testExchange_01_01", testExchange_01_01), - ("testExchange_01_02", testExchange_01_02), - ("testExchange_01_04", testExchange_01_04), - ("testExchange_02_01", testExchange_02_01), - ("testExchange_02_02", testExchange_02_02), - ("testExchange_02_04", testExchange_02_04), - ("testExchange_04_01", testExchange_04_01), - ("testExchange_04_02", testExchange_04_02), - ("testExchange_04_04", testExchange_04_04), - ("testExchange_08_01", testExchange_08_01), - ("testExchange_08_02", testExchange_08_02), - ("testExchange_08_04", testExchange_08_04), - ("testExchange_16_01", testExchange_16_01), - ("testExchange_16_02", testExchange_16_02), - ("testExchange_16_04", testExchange_16_04), - ("testLifetimes_02", testLifetimes_02), - ("testLifetimes_04", testLifetimes_04), - ("testLifetimes_08", testLifetimes_08), - ("testLifetimes_16", testLifetimes_16), - ("testLoad1", testLoad1), - ("testLoad16", testLoad16), - ("testLoad2", testLoad2), - ("testLoad4", testLoad4), - ("testLoad8", testLoad8), - ("testLoadStore_01_01", testLoadStore_01_01), - ("testLoadStore_01_02", testLoadStore_01_02), - ("testLoadStore_01_04", testLoadStore_01_04), - ("testLoadStore_02_01", testLoadStore_02_01), - ("testLoadStore_02_02", testLoadStore_02_02), - ("testLoadStore_02_04", testLoadStore_02_04), - ("testLoadStore_04_01", testLoadStore_04_01), - ("testLoadStore_04_02", testLoadStore_04_02), - ("testLoadStore_04_04", testLoadStore_04_04), - ("testLoadStore_08_01", testLoadStore_08_01), - ("testLoadStore_08_02", testLoadStore_08_02), - ("testLoadStore_08_04", testLoadStore_08_04), - ("testLoadStore_16_01", testLoadStore_16_01), - ("testLoadStore_16_02", testLoadStore_16_02), - ("testLoadStore_16_04", testLoadStore_16_04), - ] -} - -extension StrongReferenceShuffleTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__StrongReferenceShuffleTests = [ - ("test_sink_01_00", test_sink_01_00), - ("test_sink_01_01", test_sink_01_01), - ("test_sink_01_02", test_sink_01_02), - ("test_sink_01_04", test_sink_01_04), - ("test_sink_01_08", test_sink_01_08), - ("test_sink_02_00", test_sink_02_00), - ("test_sink_02_01", test_sink_02_01), - ("test_sink_02_02", test_sink_02_02), - ("test_sink_02_04", test_sink_02_04), - ("test_sink_02_08", test_sink_02_08), - ("test_sink_04_00", test_sink_04_00), - ("test_sink_04_01", test_sink_04_01), - ("test_sink_04_02", test_sink_04_02), - ("test_sink_04_04", test_sink_04_04), - ("test_sink_04_08", test_sink_04_08), - ("test_sink_08_00", test_sink_08_00), - ("test_sink_08_01", test_sink_08_01), - ("test_sink_08_02", test_sink_08_02), - ("test_sink_08_04", test_sink_08_04), - ("test_sink_08_08", test_sink_08_08), - ] -} - -extension UnsafeAtomicLazyReferenceTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__UnsafeAtomicLazyReferenceTests = [ - ("test_create_destroy", test_create_destroy), - ("test_storeIfNilThenLoad", test_storeIfNilThenLoad), - ] -} - -public func __allTests() -> [XCTestCaseEntry] { - return [ - testCase(BasicAtomicTests.__allTests__BasicAtomicTests), - testCase(DoubleWordTests.__allTests__DoubleWordTests), - testCase(LockFreeSingleConsumerStackTests.__allTests__LockFreeSingleConsumerStackTests), - testCase(QueueTests.__allTests__QueueTests), - testCase(StrongReferenceRace.__allTests__StrongReferenceRace), - testCase(StrongReferenceShuffleTests.__allTests__StrongReferenceShuffleTests), - testCase(UnsafeAtomicLazyReferenceTests.__allTests__UnsafeAtomicLazyReferenceTests), - ] -} -#endif diff --git a/Tests/AtomicsTests/autogenerated/Basics.swift b/Tests/AtomicsTests/autogenerated/Basics.swift index 6f9176c..5f84026 100644 --- a/Tests/AtomicsTests/autogenerated/Basics.swift +++ b/Tests/AtomicsTests/autogenerated/Basics.swift @@ -42,6 +42,7 @@ private class Bar: Equatable, CustomStringConvertible { } } +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS private class Baz: Equatable, CustomStringConvertible, AtomicReference { var value: Int init(_ value: Int) { self.value = value } @@ -50,52 +51,19 @@ private class Baz: Equatable, CustomStringConvertible, AtomicReference { left === right } } +#endif private enum Fred: Int, AtomicValue { case one case two } +#if true /// Exercises all operations in a single-threaded context, verifying /// they provide the expected results. -class BasicAtomicTests: XCTestCase { - private let _mfoo1: UnsafeMutablePointer = { - let p = UnsafeMutablePointer.allocate(capacity: 1) - p.initialize(to: Foo(1)) - return p - }() - - private let _mfoo2: UnsafeMutablePointer = { - let p = UnsafeMutablePointer.allocate(capacity: 1) - p.initialize(to: Foo(2)) - return p - }() - - private var _foo1: UnsafePointer { UnsafePointer(_mfoo1) } - private var _foo2: UnsafePointer { UnsafePointer(_mfoo2) } - - private let _raw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) - private let _raw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) - private let _bar1 = Unmanaged.passRetained(Bar(1)) - private let _bar2 = Unmanaged.passRetained(Bar(2)) - private let _baz1 = Baz(1) - private let _baz2 = Baz(2) - - deinit { - _mfoo1.deinitialize(count: 1) - _mfoo1.deallocate() - - _mfoo2.deinitialize(count: 1) - _mfoo2.deallocate() - - _raw1.deallocate() - _raw2.deallocate() - - _bar1.release() - _bar2.release() - } +class BasicAtomicIntTests: XCTestCase { - func test_Int_create_destroy() { + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -105,7 +73,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -114,7 +82,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -123,7 +91,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_Int_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -133,7 +101,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_Int_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -144,7 +112,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -155,7 +123,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -167,7 +135,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -180,7 +148,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -193,7 +161,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -206,7 +174,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -219,7 +187,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -233,7 +201,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -269,7 +237,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -305,7 +273,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -341,7 +309,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -377,7 +345,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -414,7 +382,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -454,7 +422,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -494,7 +462,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -534,7 +502,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -574,7 +542,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -614,7 +582,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -654,7 +622,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -694,7 +662,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -734,7 +702,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -774,7 +742,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -814,7 +782,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -854,7 +822,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -894,7 +862,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -934,7 +902,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -974,7 +942,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1014,7 +982,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1054,7 +1022,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1094,7 +1062,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1134,7 +1102,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1174,7 +1142,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1214,7 +1182,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1254,7 +1222,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1294,7 +1262,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1334,7 +1302,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1374,7 +1342,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1414,7 +1382,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1454,7 +1422,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1494,7 +1462,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1534,7 +1502,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1574,7 +1542,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -1616,12 +1584,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_Int_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1639,7 +1604,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1657,7 +1622,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1675,7 +1640,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1693,7 +1658,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1711,7 +1676,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1729,7 +1694,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1747,7 +1712,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1765,7 +1730,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1783,7 +1748,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1801,7 +1766,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1819,7 +1784,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1837,7 +1802,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1855,7 +1820,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1873,7 +1838,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1891,7 +1856,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1909,7 +1874,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1927,7 +1892,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1945,7 +1910,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1963,7 +1928,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1981,7 +1946,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -1999,7 +1964,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2017,7 +1982,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2035,7 +2000,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2053,7 +2018,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2072,7 +2037,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2090,7 +2055,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2108,7 +2073,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2126,7 +2091,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2144,7 +2109,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2162,7 +2127,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2180,7 +2145,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2198,7 +2163,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2216,7 +2181,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2234,7 +2199,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2252,7 +2217,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2270,7 +2235,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2288,7 +2253,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2306,7 +2271,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2324,7 +2289,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2342,7 +2307,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2360,7 +2325,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2378,7 +2343,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2396,7 +2361,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2414,7 +2379,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2432,7 +2397,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2450,7 +2415,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2468,7 +2433,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2486,7 +2451,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2504,7 +2469,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: Int = 3 let b: Int = 8 let c: Int = 12 @@ -2523,7 +2488,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicInt8Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -2533,7 +2505,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int8_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -2542,7 +2514,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int8_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -2551,7 +2523,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_Int8_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -2561,7 +2533,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_Int8_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -2572,7 +2544,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int8_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -2583,7 +2555,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int8_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -2595,7 +2567,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int8_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2608,7 +2580,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int8_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2621,7 +2593,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int8_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2634,7 +2606,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int8_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2647,7 +2619,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int8_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2661,7 +2633,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int8_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2697,7 +2669,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2733,7 +2705,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2769,7 +2741,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2805,7 +2777,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2842,7 +2814,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2882,7 +2854,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2922,7 +2894,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -2962,7 +2934,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3002,7 +2974,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3042,7 +3014,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3082,7 +3054,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3122,7 +3094,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3162,7 +3134,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3202,7 +3174,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3242,7 +3214,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3282,7 +3254,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3322,7 +3294,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3362,7 +3334,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3402,7 +3374,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3442,7 +3414,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3482,7 +3454,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3522,7 +3494,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3562,7 +3534,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3602,7 +3574,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3642,7 +3614,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3682,7 +3654,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3722,7 +3694,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3762,7 +3734,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3802,7 +3774,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3842,7 +3814,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3882,7 +3854,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3922,7 +3894,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -3962,7 +3934,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -4002,7 +3974,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int8_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -4044,12 +4016,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_Int8_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4067,7 +4036,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4085,7 +4054,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4103,7 +4072,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4121,7 +4090,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4139,7 +4108,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4157,7 +4126,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4175,7 +4144,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4193,7 +4162,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4211,7 +4180,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4229,7 +4198,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4247,7 +4216,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4265,7 +4234,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4283,7 +4252,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4301,7 +4270,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4319,7 +4288,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4337,7 +4306,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4355,7 +4324,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4373,7 +4342,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4391,7 +4360,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4409,7 +4378,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4427,7 +4396,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4445,7 +4414,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4463,7 +4432,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4481,7 +4450,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4500,7 +4469,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4518,7 +4487,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4536,7 +4505,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4554,7 +4523,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4572,7 +4541,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4590,7 +4559,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4608,7 +4577,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4626,7 +4595,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4644,7 +4613,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4662,7 +4631,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4680,7 +4649,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4698,7 +4667,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4716,7 +4685,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4734,7 +4703,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4752,7 +4721,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4770,7 +4739,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4788,7 +4757,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4806,7 +4775,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4824,7 +4793,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4842,7 +4811,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4860,7 +4829,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4878,7 +4847,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4896,7 +4865,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4914,7 +4883,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4932,7 +4901,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int8_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: Int8 = 3 let b: Int8 = 8 let c: Int8 = 12 @@ -4951,7 +4920,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicInt16Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -4961,7 +4937,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int16_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -4970,7 +4946,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int16_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -4979,7 +4955,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_Int16_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -4989,7 +4965,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_Int16_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -5000,7 +4976,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int16_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -5011,7 +4987,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int16_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -5023,7 +4999,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int16_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5036,7 +5012,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int16_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5049,7 +5025,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int16_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5062,7 +5038,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int16_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5075,7 +5051,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int16_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5089,7 +5065,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int16_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5125,7 +5101,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5161,7 +5137,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5197,7 +5173,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5233,7 +5209,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5270,7 +5246,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5310,7 +5286,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5350,7 +5326,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5390,7 +5366,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5430,7 +5406,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5470,7 +5446,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5510,7 +5486,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5550,7 +5526,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5590,7 +5566,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5630,7 +5606,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5670,7 +5646,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5710,7 +5686,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5750,7 +5726,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5790,7 +5766,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5830,7 +5806,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5870,7 +5846,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5910,7 +5886,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5950,7 +5926,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -5990,7 +5966,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6030,7 +6006,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6070,7 +6046,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6110,7 +6086,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6150,7 +6126,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6190,7 +6166,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6230,7 +6206,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6270,7 +6246,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6310,7 +6286,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6350,7 +6326,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6390,7 +6366,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6430,7 +6406,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int16_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -6472,12 +6448,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_Int16_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6495,7 +6468,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6513,7 +6486,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6531,7 +6504,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6549,7 +6522,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6567,7 +6540,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6585,7 +6558,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6603,7 +6576,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6621,7 +6594,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6639,7 +6612,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6657,7 +6630,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6675,7 +6648,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6693,7 +6666,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6711,7 +6684,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6729,7 +6702,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6747,7 +6720,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6765,7 +6738,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6783,7 +6756,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6801,7 +6774,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6819,7 +6792,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6837,7 +6810,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6855,7 +6828,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6873,7 +6846,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6891,7 +6864,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6909,7 +6882,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6928,7 +6901,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6946,7 +6919,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6964,7 +6937,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -6982,7 +6955,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7000,7 +6973,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7018,7 +6991,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7036,7 +7009,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7054,7 +7027,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7072,7 +7045,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7090,7 +7063,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7108,7 +7081,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7126,7 +7099,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7144,7 +7117,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7162,7 +7135,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7180,7 +7153,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7198,7 +7171,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7216,7 +7189,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7234,7 +7207,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7252,7 +7225,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7270,7 +7243,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7288,7 +7261,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7306,7 +7279,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7324,7 +7297,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7342,7 +7315,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7360,7 +7333,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int16_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: Int16 = 3 let b: Int16 = 8 let c: Int16 = 12 @@ -7379,7 +7352,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicInt32Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -7389,7 +7369,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int32_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -7398,7 +7378,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int32_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -7407,7 +7387,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_Int32_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -7417,7 +7397,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_Int32_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -7428,7 +7408,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int32_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -7439,7 +7419,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int32_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -7451,7 +7431,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int32_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7464,7 +7444,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int32_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7477,7 +7457,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int32_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7490,7 +7470,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int32_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7503,7 +7483,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int32_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7517,7 +7497,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int32_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7553,7 +7533,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7589,7 +7569,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7625,7 +7605,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7661,7 +7641,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7698,7 +7678,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7738,7 +7718,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7778,7 +7758,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7818,7 +7798,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7858,7 +7838,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7898,7 +7878,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7938,7 +7918,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -7978,7 +7958,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8018,7 +7998,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8058,7 +8038,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8098,7 +8078,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8138,7 +8118,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8178,7 +8158,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8218,7 +8198,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8258,7 +8238,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8298,7 +8278,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8338,7 +8318,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8378,7 +8358,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8418,7 +8398,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8458,7 +8438,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8498,7 +8478,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8538,7 +8518,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8578,7 +8558,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8618,7 +8598,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8658,7 +8638,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8698,7 +8678,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8738,7 +8718,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8778,7 +8758,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8818,7 +8798,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8858,7 +8838,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int32_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -8900,12 +8880,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_Int32_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -8923,7 +8900,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -8941,7 +8918,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -8959,7 +8936,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -8977,7 +8954,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -8995,7 +8972,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9013,7 +8990,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9031,7 +9008,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9049,7 +9026,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9067,7 +9044,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9085,7 +9062,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9103,7 +9080,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9121,7 +9098,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9139,7 +9116,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9157,7 +9134,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9175,7 +9152,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9193,7 +9170,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9211,7 +9188,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9229,7 +9206,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9247,7 +9224,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9265,7 +9242,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9283,7 +9260,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9301,7 +9278,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9319,7 +9296,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9337,7 +9314,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9356,7 +9333,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9374,7 +9351,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9392,7 +9369,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9410,7 +9387,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9428,7 +9405,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9446,7 +9423,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9464,7 +9441,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9482,7 +9459,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9500,7 +9477,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9518,7 +9495,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9536,7 +9513,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9554,7 +9531,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9572,7 +9549,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9590,7 +9567,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9608,7 +9585,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9626,7 +9603,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9644,7 +9621,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9662,7 +9639,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9680,7 +9657,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9698,7 +9675,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9716,7 +9693,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9734,7 +9711,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9752,7 +9729,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9770,7 +9747,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9788,7 +9765,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int32_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: Int32 = 3 let b: Int32 = 8 let c: Int32 = 12 @@ -9807,7 +9784,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicInt64Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -9817,7 +9801,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int64_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -9826,7 +9810,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_Int64_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -9835,7 +9819,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_Int64_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -9845,7 +9829,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_Int64_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -9856,7 +9840,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int64_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -9867,7 +9851,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int64_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -9879,7 +9863,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_Int64_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -9892,7 +9876,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int64_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -9905,7 +9889,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int64_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -9918,7 +9902,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int64_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -9931,7 +9915,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int64_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -9945,7 +9929,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_Int64_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -9981,7 +9965,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10017,7 +10001,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10053,7 +10037,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10089,7 +10073,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10126,7 +10110,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10166,7 +10150,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10206,7 +10190,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10246,7 +10230,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10286,7 +10270,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10326,7 +10310,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10366,7 +10350,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10406,7 +10390,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10446,7 +10430,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10486,7 +10470,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10526,7 +10510,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10566,7 +10550,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10606,7 +10590,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10646,7 +10630,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10686,7 +10670,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10726,7 +10710,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10766,7 +10750,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10806,7 +10790,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10846,7 +10830,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10886,7 +10870,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10926,7 +10910,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -10966,7 +10950,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11006,7 +10990,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11046,7 +11030,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11086,7 +11070,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11126,7 +11110,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11166,7 +11150,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11206,7 +11190,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11246,7 +11230,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11286,7 +11270,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_Int64_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -11328,12 +11312,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_Int64_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11351,7 +11332,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11369,7 +11350,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11387,7 +11368,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11405,7 +11386,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11423,7 +11404,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11441,7 +11422,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11459,7 +11440,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11477,7 +11458,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11495,7 +11476,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11513,7 +11494,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11531,7 +11512,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11549,7 +11530,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11567,7 +11548,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11585,7 +11566,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11603,7 +11584,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11621,7 +11602,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11639,7 +11620,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11657,7 +11638,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11675,7 +11656,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11693,7 +11674,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11711,7 +11692,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11729,7 +11710,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11747,7 +11728,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11765,7 +11746,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11784,7 +11765,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11802,7 +11783,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11820,7 +11801,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11838,7 +11819,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11856,7 +11837,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11874,7 +11855,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11892,7 +11873,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11910,7 +11891,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11928,7 +11909,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11946,7 +11927,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11964,7 +11945,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -11982,7 +11963,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12000,7 +11981,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12018,7 +11999,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12036,7 +12017,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12054,7 +12035,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12072,7 +12053,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12090,7 +12071,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12108,7 +12089,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12126,7 +12107,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12144,7 +12125,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12162,7 +12143,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12180,7 +12161,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12198,7 +12179,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12216,7 +12197,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Int64_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: Int64 = 3 let b: Int64 = 8 let c: Int64 = 12 @@ -12235,7 +12216,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicUIntTests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -12245,7 +12233,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -12254,7 +12242,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -12263,7 +12251,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_UInt_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -12273,7 +12261,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_UInt_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -12284,7 +12272,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -12295,7 +12283,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -12307,7 +12295,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12320,7 +12308,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12333,7 +12321,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12346,7 +12334,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12359,7 +12347,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12373,7 +12361,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12409,7 +12397,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12445,7 +12433,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12481,7 +12469,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12517,7 +12505,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12554,7 +12542,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12594,7 +12582,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12634,7 +12622,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12674,7 +12662,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12714,7 +12702,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12754,7 +12742,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12794,7 +12782,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12834,7 +12822,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12874,7 +12862,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12914,7 +12902,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12954,7 +12942,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -12994,7 +12982,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13034,7 +13022,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13074,7 +13062,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13114,7 +13102,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13154,7 +13142,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13194,7 +13182,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13234,7 +13222,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13274,7 +13262,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13314,7 +13302,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13354,7 +13342,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13394,7 +13382,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13434,7 +13422,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13474,7 +13462,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13514,7 +13502,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13554,7 +13542,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13594,7 +13582,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13634,7 +13622,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13674,7 +13662,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13714,7 +13702,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -13756,12 +13744,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_UInt_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13779,7 +13764,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13797,7 +13782,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13815,7 +13800,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13833,7 +13818,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13851,7 +13836,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13869,7 +13854,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13887,7 +13872,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13905,7 +13890,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13923,7 +13908,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13941,7 +13926,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13959,7 +13944,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13977,7 +13962,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -13995,7 +13980,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14013,7 +13998,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14031,7 +14016,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14049,7 +14034,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14067,7 +14052,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14085,7 +14070,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14103,7 +14088,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14121,7 +14106,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14139,7 +14124,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14157,7 +14142,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14175,7 +14160,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14193,7 +14178,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14212,7 +14197,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14230,7 +14215,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14248,7 +14233,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14266,7 +14251,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14284,7 +14269,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14302,7 +14287,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14320,7 +14305,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14338,7 +14323,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14356,7 +14341,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14374,7 +14359,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14392,7 +14377,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14410,7 +14395,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14428,7 +14413,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14446,7 +14431,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14464,7 +14449,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14482,7 +14467,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14500,7 +14485,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14518,7 +14503,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14536,7 +14521,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14554,7 +14539,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14572,7 +14557,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14590,7 +14575,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14608,7 +14593,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14626,7 +14611,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14644,7 +14629,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: UInt = 3 let b: UInt = 8 let c: UInt = 12 @@ -14663,7 +14648,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicUInt8Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -14673,7 +14665,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt8_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -14682,7 +14674,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt8_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -14691,7 +14683,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_UInt8_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -14701,7 +14693,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_UInt8_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -14712,7 +14704,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt8_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -14723,7 +14715,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt8_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -14735,7 +14727,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt8_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14748,7 +14740,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt8_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14761,7 +14753,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt8_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14774,7 +14766,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt8_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14787,7 +14779,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt8_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14801,7 +14793,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt8_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14837,7 +14829,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14873,7 +14865,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14909,7 +14901,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14945,7 +14937,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -14982,7 +14974,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15022,7 +15014,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15062,7 +15054,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15102,7 +15094,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15142,7 +15134,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15182,7 +15174,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15222,7 +15214,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15262,7 +15254,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15302,7 +15294,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15342,7 +15334,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15382,7 +15374,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15422,7 +15414,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15462,7 +15454,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15502,7 +15494,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15542,7 +15534,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15582,7 +15574,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15622,7 +15614,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15662,7 +15654,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15702,7 +15694,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15742,7 +15734,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15782,7 +15774,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15822,7 +15814,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15862,7 +15854,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15902,7 +15894,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15942,7 +15934,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -15982,7 +15974,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -16022,7 +16014,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -16062,7 +16054,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -16102,7 +16094,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -16142,7 +16134,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt8_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -16184,12 +16176,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_UInt8_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16207,7 +16196,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16225,7 +16214,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16243,7 +16232,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16261,7 +16250,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16279,7 +16268,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16297,7 +16286,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16315,7 +16304,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16333,7 +16322,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16351,7 +16340,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16369,7 +16358,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16387,7 +16376,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16405,7 +16394,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16423,7 +16412,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16441,7 +16430,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16459,7 +16448,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16477,7 +16466,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16495,7 +16484,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16513,7 +16502,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16531,7 +16520,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16549,7 +16538,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16567,7 +16556,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16585,7 +16574,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16603,7 +16592,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16621,7 +16610,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16640,7 +16629,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16658,7 +16647,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16676,7 +16665,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16694,7 +16683,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16712,7 +16701,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16730,7 +16719,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16748,7 +16737,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16766,7 +16755,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16784,7 +16773,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16802,7 +16791,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16820,7 +16809,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16838,7 +16827,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16856,7 +16845,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16874,7 +16863,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16892,7 +16881,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16910,7 +16899,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16928,7 +16917,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16946,7 +16935,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16964,7 +16953,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -16982,7 +16971,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -17000,7 +16989,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -17018,7 +17007,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -17036,7 +17025,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -17054,7 +17043,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -17072,7 +17061,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt8_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: UInt8 = 3 let b: UInt8 = 8 let c: UInt8 = 12 @@ -17091,7 +17080,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicUInt16Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -17101,7 +17097,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt16_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -17110,7 +17106,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt16_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -17119,7 +17115,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_UInt16_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -17129,7 +17125,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_UInt16_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -17140,7 +17136,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt16_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -17151,7 +17147,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt16_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -17163,7 +17159,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt16_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17176,7 +17172,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt16_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17189,7 +17185,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt16_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17202,7 +17198,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt16_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17215,7 +17211,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt16_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17229,7 +17225,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt16_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17265,7 +17261,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17301,7 +17297,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17337,7 +17333,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17373,7 +17369,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17410,7 +17406,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17450,7 +17446,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17490,7 +17486,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17530,7 +17526,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17570,7 +17566,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17610,7 +17606,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17650,7 +17646,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17690,7 +17686,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17730,7 +17726,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17770,7 +17766,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17810,7 +17806,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17850,7 +17846,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17890,7 +17886,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17930,7 +17926,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -17970,7 +17966,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18010,7 +18006,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18050,7 +18046,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18090,7 +18086,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18130,7 +18126,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18170,7 +18166,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18210,7 +18206,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18250,7 +18246,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18290,7 +18286,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18330,7 +18326,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18370,7 +18366,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18410,7 +18406,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18450,7 +18446,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18490,7 +18486,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18530,7 +18526,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18570,7 +18566,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt16_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -18612,12 +18608,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_UInt16_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18635,7 +18628,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18653,7 +18646,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18671,7 +18664,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18689,7 +18682,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18707,7 +18700,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18725,7 +18718,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18743,7 +18736,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18761,7 +18754,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18779,7 +18772,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18797,7 +18790,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18815,7 +18808,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18833,7 +18826,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18851,7 +18844,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18869,7 +18862,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18887,7 +18880,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18905,7 +18898,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18923,7 +18916,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18941,7 +18934,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18959,7 +18952,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18977,7 +18970,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -18995,7 +18988,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19013,7 +19006,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19031,7 +19024,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19049,7 +19042,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19068,7 +19061,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19086,7 +19079,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19104,7 +19097,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19122,7 +19115,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19140,7 +19133,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19158,7 +19151,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19176,7 +19169,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19194,7 +19187,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19212,7 +19205,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19230,7 +19223,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19248,7 +19241,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19266,7 +19259,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19284,7 +19277,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19302,7 +19295,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19320,7 +19313,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19338,7 +19331,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19356,7 +19349,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19374,7 +19367,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19392,7 +19385,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19410,7 +19403,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19428,7 +19421,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19446,7 +19439,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19464,7 +19457,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19482,7 +19475,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19500,7 +19493,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt16_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: UInt16 = 3 let b: UInt16 = 8 let c: UInt16 = 12 @@ -19519,7 +19512,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicUInt32Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -19529,7 +19529,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt32_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -19538,7 +19538,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt32_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -19547,7 +19547,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_UInt32_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -19557,7 +19557,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_UInt32_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -19568,7 +19568,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt32_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -19579,7 +19579,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt32_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -19591,7 +19591,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt32_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19604,7 +19604,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt32_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19617,7 +19617,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt32_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19630,7 +19630,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt32_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19643,7 +19643,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt32_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19657,7 +19657,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt32_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19693,7 +19693,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19729,7 +19729,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19765,7 +19765,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19801,7 +19801,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19838,7 +19838,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19878,7 +19878,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19918,7 +19918,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19958,7 +19958,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -19998,7 +19998,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20038,7 +20038,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20078,7 +20078,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20118,7 +20118,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20158,7 +20158,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20198,7 +20198,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20238,7 +20238,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20278,7 +20278,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20318,7 +20318,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20358,7 +20358,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20398,7 +20398,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20438,7 +20438,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20478,7 +20478,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20518,7 +20518,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20558,7 +20558,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20598,7 +20598,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20638,7 +20638,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20678,7 +20678,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20718,7 +20718,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20758,7 +20758,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20798,7 +20798,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20838,7 +20838,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20878,7 +20878,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20918,7 +20918,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20958,7 +20958,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -20998,7 +20998,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt32_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -21040,12 +21040,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_UInt32_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21063,7 +21060,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21081,7 +21078,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21099,7 +21096,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21117,7 +21114,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21135,7 +21132,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21153,7 +21150,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21171,7 +21168,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21189,7 +21186,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21207,7 +21204,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21225,7 +21222,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21243,7 +21240,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21261,7 +21258,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21279,7 +21276,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21297,7 +21294,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21315,7 +21312,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21333,7 +21330,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21351,7 +21348,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21369,7 +21366,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21387,7 +21384,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21405,7 +21402,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21423,7 +21420,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21441,7 +21438,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21459,7 +21456,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21477,7 +21474,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21496,7 +21493,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21514,7 +21511,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21532,7 +21529,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21550,7 +21547,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21568,7 +21565,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21586,7 +21583,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21604,7 +21601,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21622,7 +21619,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21640,7 +21637,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21658,7 +21655,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21676,7 +21673,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21694,7 +21691,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21712,7 +21709,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21730,7 +21727,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21748,7 +21745,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21766,7 +21763,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21784,7 +21781,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21802,7 +21799,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21820,7 +21817,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21838,7 +21835,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21856,7 +21853,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21874,7 +21871,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21892,7 +21889,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21910,7 +21907,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21928,7 +21925,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt32_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: UInt32 = 3 let b: UInt32 = 8 let c: UInt32 = 12 @@ -21947,7 +21944,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicUInt64Tests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -21957,7 +21961,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt64_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -21966,7 +21970,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), 23) } - func test_UInt64_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), 12) @@ -21975,7 +21979,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), 23) } - func test_UInt64_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) @@ -21985,7 +21989,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } - func test_UInt64_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .relaxed) @@ -21996,7 +22000,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt64_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .releasing) @@ -22007,7 +22011,7 @@ class BasicAtomicTests: XCTestCase { w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt64_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } v.store(23, ordering: .sequentiallyConsistent) @@ -22019,7 +22023,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), 12) } - func test_UInt64_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22032,7 +22036,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .relaxed), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt64_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22045,7 +22049,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiring), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt64_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22058,7 +22062,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .releasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt64_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22071,7 +22075,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(23, ordering: .acquiringAndReleasing), 23) XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt64_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22085,7 +22089,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 23) } - func test_UInt64_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22121,7 +22125,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22157,7 +22161,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22193,7 +22197,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22229,7 +22233,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22266,7 +22270,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22306,7 +22310,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22346,7 +22350,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22386,7 +22390,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22426,7 +22430,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22466,7 +22470,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22506,7 +22510,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22546,7 +22550,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22586,7 +22590,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22626,7 +22630,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22666,7 +22670,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22706,7 +22710,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22746,7 +22750,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22786,7 +22790,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22826,7 +22830,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22866,7 +22870,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22906,7 +22910,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22946,7 +22950,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -22986,7 +22990,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23026,7 +23030,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23066,7 +23070,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23106,7 +23110,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23146,7 +23150,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23186,7 +23190,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23226,7 +23230,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23266,7 +23270,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23306,7 +23310,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23346,7 +23350,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23386,7 +23390,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23426,7 +23430,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) } - func test_UInt64_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(12) defer { v.destroy() } @@ -23468,12 +23472,9 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - // Integer operations - - func test_UInt64_loadThenWrappingIncrement_relaxed() { + func test_loadThenWrappingIncrement_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23491,7 +23492,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingIncrement_acquiring() { + func test_loadThenWrappingIncrement_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23509,7 +23510,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingIncrement_releasing() { + func test_loadThenWrappingIncrement_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23527,7 +23528,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingIncrement_acquiringAndReleasing() { + func test_loadThenWrappingIncrement_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23545,7 +23546,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingIncrement_sequentiallyConsistent() { + func test_loadThenWrappingIncrement_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23563,7 +23564,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingDecrement_relaxed() { + func test_loadThenWrappingDecrement_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23581,7 +23582,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingDecrement_acquiring() { + func test_loadThenWrappingDecrement_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23599,7 +23600,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingDecrement_releasing() { + func test_loadThenWrappingDecrement_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23617,7 +23618,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingDecrement_acquiringAndReleasing() { + func test_loadThenWrappingDecrement_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23635,7 +23636,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenWrappingDecrement_sequentiallyConsistent() { + func test_loadThenWrappingDecrement_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23653,7 +23654,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseAnd_relaxed() { + func test_loadThenBitwiseAnd_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23671,7 +23672,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseAnd_acquiring() { + func test_loadThenBitwiseAnd_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23689,7 +23690,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseAnd_releasing() { + func test_loadThenBitwiseAnd_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23707,7 +23708,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseAnd_acquiringAndReleasing() { + func test_loadThenBitwiseAnd_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23725,7 +23726,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseAnd_sequentiallyConsistent() { + func test_loadThenBitwiseAnd_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23743,7 +23744,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseOr_relaxed() { + func test_loadThenBitwiseOr_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23761,7 +23762,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseOr_acquiring() { + func test_loadThenBitwiseOr_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23779,7 +23780,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseOr_releasing() { + func test_loadThenBitwiseOr_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23797,7 +23798,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseOr_acquiringAndReleasing() { + func test_loadThenBitwiseOr_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23815,7 +23816,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseOr_sequentiallyConsistent() { + func test_loadThenBitwiseOr_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23833,7 +23834,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseXor_relaxed() { + func test_loadThenBitwiseXor_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23851,7 +23852,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseXor_acquiring() { + func test_loadThenBitwiseXor_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23869,7 +23870,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseXor_releasing() { + func test_loadThenBitwiseXor_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23887,7 +23888,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseXor_acquiringAndReleasing() { + func test_loadThenBitwiseXor_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23905,7 +23906,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(old2, result1) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_loadThenBitwiseXor_sequentiallyConsistent() { + func test_loadThenBitwiseXor_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23924,7 +23925,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingIncrementThenLoad_relaxed() { + func test_wrappingIncrementThenLoad_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23942,7 +23943,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingIncrementThenLoad_acquiring() { + func test_wrappingIncrementThenLoad_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23960,7 +23961,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingIncrementThenLoad_releasing() { + func test_wrappingIncrementThenLoad_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23978,7 +23979,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingIncrementThenLoad_acquiringAndReleasing() { + func test_wrappingIncrementThenLoad_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -23996,7 +23997,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingIncrementThenLoad_sequentiallyConsistent() { + func test_wrappingIncrementThenLoad_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24014,7 +24015,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingDecrementThenLoad_relaxed() { + func test_wrappingDecrementThenLoad_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24032,7 +24033,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingDecrementThenLoad_acquiring() { + func test_wrappingDecrementThenLoad_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24050,7 +24051,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingDecrementThenLoad_releasing() { + func test_wrappingDecrementThenLoad_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24068,7 +24069,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingDecrementThenLoad_acquiringAndReleasing() { + func test_wrappingDecrementThenLoad_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24086,7 +24087,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_wrappingDecrementThenLoad_sequentiallyConsistent() { + func test_wrappingDecrementThenLoad_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24104,7 +24105,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseAndThenLoad_relaxed() { + func test_bitwiseAndThenLoad_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24122,7 +24123,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseAndThenLoad_acquiring() { + func test_bitwiseAndThenLoad_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24140,7 +24141,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseAndThenLoad_releasing() { + func test_bitwiseAndThenLoad_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24158,7 +24159,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseAndThenLoad_acquiringAndReleasing() { + func test_bitwiseAndThenLoad_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24176,7 +24177,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseAndThenLoad_sequentiallyConsistent() { + func test_bitwiseAndThenLoad_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24194,7 +24195,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseOrThenLoad_relaxed() { + func test_bitwiseOrThenLoad_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24212,7 +24213,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseOrThenLoad_acquiring() { + func test_bitwiseOrThenLoad_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24230,7 +24231,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseOrThenLoad_releasing() { + func test_bitwiseOrThenLoad_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24248,7 +24249,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseOrThenLoad_acquiringAndReleasing() { + func test_bitwiseOrThenLoad_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24266,7 +24267,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseOrThenLoad_sequentiallyConsistent() { + func test_bitwiseOrThenLoad_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24284,7 +24285,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseXorThenLoad_relaxed() { + func test_bitwiseXorThenLoad_relaxed() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24302,7 +24303,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseXorThenLoad_acquiring() { + func test_bitwiseXorThenLoad_acquiring() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24320,7 +24321,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseXorThenLoad_releasing() { + func test_bitwiseXorThenLoad_releasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24338,7 +24339,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseXorThenLoad_acquiringAndReleasing() { + func test_bitwiseXorThenLoad_acquiringAndReleasing() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24356,7 +24357,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(new2, result2) XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_UInt64_bitwiseXorThenLoad_sequentiallyConsistent() { + func test_bitwiseXorThenLoad_sequentiallyConsistent() { let a: UInt64 = 3 let b: UInt64 = 8 let c: UInt64 = 12 @@ -24375,7 +24376,14 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), result2) } - func test_Bool_create_destroy() { +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicBoolTests: XCTestCase { + + func test_create_destroy() { let v = UnsafeAtomic.create(true) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -24385,7 +24393,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), false) } - func test_Bool_load_relaxed() { + func test_load_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -24394,7 +24402,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), false) } - func test_Bool_load_acquiring() { + func test_load_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .acquiring), true) @@ -24403,7 +24411,7 @@ class BasicAtomicTests: XCTestCase { defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), false) } - func test_Bool_load_sequentiallyConsistent() { + func test_load_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), true) @@ -24413,7 +24421,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), false) } - func test_Bool_store_relaxed() { + func test_store_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } v.store(false, ordering: .relaxed) @@ -24424,7 +24432,7 @@ class BasicAtomicTests: XCTestCase { w.store(true, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), true) } - func test_Bool_store_releasing() { + func test_store_releasing() { let v = UnsafeAtomic.create(true) defer { v.destroy() } v.store(false, ordering: .releasing) @@ -24435,7 +24443,7 @@ class BasicAtomicTests: XCTestCase { w.store(true, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), true) } - func test_Bool_store_sequentiallyConsistent() { + func test_store_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } v.store(false, ordering: .sequentiallyConsistent) @@ -24447,7 +24455,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(w.load(ordering: .relaxed), true) } - func test_Bool_exchange_relaxed() { + func test_exchange_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24460,7 +24468,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(false, ordering: .relaxed), false) XCTAssertEqual(v.load(ordering: .relaxed), false) } - func test_Bool_exchange_acquiring() { + func test_exchange_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24473,7 +24481,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(false, ordering: .acquiring), false) XCTAssertEqual(v.load(ordering: .relaxed), false) } - func test_Bool_exchange_releasing() { + func test_exchange_releasing() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24486,7 +24494,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(false, ordering: .releasing), false) XCTAssertEqual(v.load(ordering: .relaxed), false) } - func test_Bool_exchange_acquiringAndReleasing() { + func test_exchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24499,7 +24507,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.exchange(false, ordering: .acquiringAndReleasing), false) XCTAssertEqual(v.load(ordering: .relaxed), false) } - func test_Bool_exchange_sequentiallyConsistent() { + func test_exchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24513,7 +24521,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), false) } - func test_Bool_compareExchange_relaxed() { + func test_compareExchange_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24549,7 +24557,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiring() { + func test_compareExchange_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24585,7 +24593,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_releasing() { + func test_compareExchange_releasing() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24621,7 +24629,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiringAndReleasing() { + func test_compareExchange_acquiringAndReleasing() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24657,7 +24665,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24694,7 +24702,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_relaxed_relaxed() { + func test_compareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24734,7 +24742,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_relaxed_acquiring() { + func test_compareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24774,7 +24782,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_relaxed_sequentiallyConsistent() { + func test_compareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24814,7 +24822,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiring_relaxed() { + func test_compareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24854,7 +24862,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiring_acquiring() { + func test_compareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24894,7 +24902,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiring_sequentiallyConsistent() { + func test_compareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24934,7 +24942,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_releasing_relaxed() { + func test_compareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -24974,7 +24982,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_releasing_acquiring() { + func test_compareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25014,7 +25022,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_releasing_sequentiallyConsistent() { + func test_compareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25054,7 +25062,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiringAndReleasing_relaxed() { + func test_compareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25094,7 +25102,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiringAndReleasing_acquiring() { + func test_compareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25134,7 +25142,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25174,7 +25182,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_sequentiallyConsistent_relaxed() { + func test_compareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25214,7 +25222,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_sequentiallyConsistent_acquiring() { + func test_compareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25254,7 +25262,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25294,7 +25302,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_relaxed_relaxed() { + func test_weakCompareExchange_relaxed_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25334,7 +25342,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_relaxed_acquiring() { + func test_weakCompareExchange_relaxed_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25374,7 +25382,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_relaxed_sequentiallyConsistent() { + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25414,7 +25422,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_acquiring_relaxed() { + func test_weakCompareExchange_acquiring_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25454,7 +25462,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_acquiring_acquiring() { + func test_weakCompareExchange_acquiring_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25494,7 +25502,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_acquiring_sequentiallyConsistent() { + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25534,7 +25542,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_releasing_relaxed() { + func test_weakCompareExchange_releasing_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25574,7 +25582,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_releasing_acquiring() { + func test_weakCompareExchange_releasing_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25614,7 +25622,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_releasing_sequentiallyConsistent() { + func test_weakCompareExchange_releasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25654,7 +25662,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_acquiringAndReleasing_relaxed() { + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25694,7 +25702,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_acquiringAndReleasing_acquiring() { + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25734,7 +25742,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25774,7 +25782,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_sequentiallyConsistent_relaxed() { + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25814,7 +25822,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_sequentiallyConsistent_acquiring() { + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25854,7 +25862,7 @@ class BasicAtomicTests: XCTestCase { XCTAssertEqual(original, true) XCTAssertEqual(v.load(ordering: .relaxed), true) } - func test_Bool_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { let v = UnsafeAtomic.create(true) defer { v.destroy() } @@ -25896,9 +25904,8 @@ class BasicAtomicTests: XCTestCase { } -// Bool operations - - func test_Bool_loadThenLogicalAnd_relaxed() { + // Bool operations + func test_loadThenLogicalAnd_relaxed() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -25915,7 +25922,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalAnd_acquiring() { + func test_loadThenLogicalAnd_acquiring() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -25932,7 +25939,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalAnd_releasing() { + func test_loadThenLogicalAnd_releasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -25949,7 +25956,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalAnd_acquiringAndReleasing() { + func test_loadThenLogicalAnd_acquiringAndReleasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -25966,7 +25973,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalAnd_sequentiallyConsistent() { + func test_loadThenLogicalAnd_sequentiallyConsistent() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -25983,7 +25990,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalOr_relaxed() { + func test_loadThenLogicalOr_relaxed() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26000,7 +26007,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalOr_acquiring() { + func test_loadThenLogicalOr_acquiring() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26017,7 +26024,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalOr_releasing() { + func test_loadThenLogicalOr_releasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26034,7 +26041,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalOr_acquiringAndReleasing() { + func test_loadThenLogicalOr_acquiringAndReleasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26051,7 +26058,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalOr_sequentiallyConsistent() { + func test_loadThenLogicalOr_sequentiallyConsistent() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26068,7 +26075,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalXor_relaxed() { + func test_loadThenLogicalXor_relaxed() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26085,7 +26092,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalXor_acquiring() { + func test_loadThenLogicalXor_acquiring() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26102,7 +26109,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalXor_releasing() { + func test_loadThenLogicalXor_releasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26119,7 +26126,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalXor_acquiringAndReleasing() { + func test_loadThenLogicalXor_acquiringAndReleasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26136,7 +26143,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_loadThenLogicalXor_sequentiallyConsistent() { + func test_loadThenLogicalXor_sequentiallyConsistent() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26154,7 +26161,7 @@ class BasicAtomicTests: XCTestCase { } } - func test_Bool_logicalAndThenLoad_relaxed() { + func test_logicalAndThenLoad_relaxed() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26173,7 +26180,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalAndThenLoad_acquiring() { + func test_logicalAndThenLoad_acquiring() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26192,7 +26199,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalAndThenLoad_releasing() { + func test_logicalAndThenLoad_releasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26211,7 +26218,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalAndThenLoad_acquiringAndReleasing() { + func test_logicalAndThenLoad_acquiringAndReleasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26230,7 +26237,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalAndThenLoad_sequentiallyConsistent() { + func test_logicalAndThenLoad_sequentiallyConsistent() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26249,7 +26256,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalOrThenLoad_relaxed() { + func test_logicalOrThenLoad_relaxed() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26268,7 +26275,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalOrThenLoad_acquiring() { + func test_logicalOrThenLoad_acquiring() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26287,7 +26294,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalOrThenLoad_releasing() { + func test_logicalOrThenLoad_releasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26306,7 +26313,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalOrThenLoad_acquiringAndReleasing() { + func test_logicalOrThenLoad_acquiringAndReleasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26325,7 +26332,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalOrThenLoad_sequentiallyConsistent() { + func test_logicalOrThenLoad_sequentiallyConsistent() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26344,7 +26351,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalXorThenLoad_relaxed() { + func test_logicalXorThenLoad_relaxed() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26363,7 +26370,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalXorThenLoad_acquiring() { + func test_logicalXorThenLoad_acquiring() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26382,7 +26389,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalXorThenLoad_releasing() { + func test_logicalXorThenLoad_releasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26401,7 +26408,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalXorThenLoad_acquiringAndReleasing() { + func test_logicalXorThenLoad_acquiringAndReleasing() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26420,7 +26427,7 @@ class BasicAtomicTests: XCTestCase { } } } - func test_Bool_logicalXorThenLoad_sequentiallyConsistent() { + func test_logicalXorThenLoad_sequentiallyConsistent() { let v = UnsafeAtomic.create(false) defer { v.destroy() } @@ -26440,1688 +26447,1738 @@ class BasicAtomicTests: XCTestCase { } } -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicPointerTests: XCTestCase { + private let _mfoo1: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(1)) + return p + }() + private let _mfoo2: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(2)) + return p + }() + + private var _foo1: UnsafePointer { UnsafePointer(_mfoo1) } + private var _foo2: UnsafePointer { UnsafePointer(_mfoo2) } - func test_DoubleWord_create_destroy() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + deinit { + _mfoo1.deinitialize(count: 1) + _mfoo1.deallocate() + + _mfoo2.deinitialize(count: 1) + _mfoo2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_load_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_load_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_load_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_load_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .acquiring), _foo1) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(w.load(ordering: .acquiring), _foo2) } - func test_DoubleWord_load_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _foo1) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _foo2) } - func test_DoubleWord_store_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_store_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - v.store(DoubleWord(high: 50, low: 32), ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + v.store(_foo2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - w.store(DoubleWord(high: 100, low: 64), ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + w.store(_foo1, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_store_releasing() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_store_releasing() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - v.store(DoubleWord(high: 50, low: 32), ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + v.store(_foo2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - w.store(DoubleWord(high: 100, low: 64), ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + w.store(_foo1, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_store_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - v.store(DoubleWord(high: 50, low: 32), ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + v.store(_foo2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + let w = UnsafeAtomic>.create(_foo2) defer { w.destroy() } - w.store(DoubleWord(high: 100, low: 64), ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + w.store(_foo1, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_exchange_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_exchange_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .relaxed), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.exchange(_foo1, ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .relaxed), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .relaxed), DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_exchange_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_exchange_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .acquiring), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.exchange(_foo1, ordering: .acquiring), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiring), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiring), DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_exchange_releasing() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_exchange_releasing() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .releasing), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.exchange(_foo1, ordering: .releasing), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .releasing), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .releasing), DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .acquiringAndReleasing), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.exchange(_foo1, ordering: .acquiringAndReleasing), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiringAndReleasing), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiringAndReleasing), DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .sequentiallyConsistent), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.exchange(_foo1, ordering: .sequentiallyConsistent), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .sequentiallyConsistent), DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .sequentiallyConsistent), DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_DoubleWord_compareExchange_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_releasing() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_releasing() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), - successOrdering: .relaxed, + expected: _foo2, + desired: _foo1, + successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } - func test_DoubleWord_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_foo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 100, low: 64), - desired: DoubleWord(high: 50, low: 32), + expected: _foo1, + desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo2) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) (exchanged, original) = v.compareExchange( - expected: DoubleWord(high: 50, low: 32), - desired: DoubleWord(high: 100, low: 64), + expected: _foo2, + desired: _foo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) - XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(original, _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), _foo1) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicOptionalPointerTests: XCTestCase { + private let _mfoo1: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(1)) + return p + }() + private let _mfoo2: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(2)) + return p + }() + private var _foo1: UnsafePointer { UnsafePointer(_mfoo1) } + private var _foo2: UnsafePointer { UnsafePointer(_mfoo2) } - func test_Pointer_create_destroy() { - let v = UnsafeAtomic>.create(_foo1) + deinit { + _mfoo1.deinitialize(count: 1) + _mfoo1.deallocate() + + _mfoo2.deinitialize(count: 1) + _mfoo2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } - func test_Pointer_load_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_load_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } - func test_Pointer_load_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_load_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), _foo1) + XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), _foo2) } - func test_Pointer_load_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _foo1) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _foo2) } - func test_Pointer_store_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_store_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } v.store(_foo2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } - w.store(_foo1, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), _foo1) + w.store(nil, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Pointer_store_releasing() { - let v = UnsafeAtomic>.create(_foo1) + func test_store_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } v.store(_foo2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } - w.store(_foo1, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), _foo1) + w.store(nil, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Pointer_store_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } v.store(_foo2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w = UnsafeAtomic>.create(_foo2) + let w = UnsafeAtomic?>.create(_foo2) defer { w.destroy() } - w.store(_foo1, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), _foo1) + w.store(nil, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Pointer_exchange_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_exchange_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_foo1, ordering: .relaxed), _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), _foo1) + XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), _foo2) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_Pointer_exchange_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_exchange_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_foo1, ordering: .acquiring), _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), _foo1) + XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), _foo2) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_Pointer_exchange_releasing() { - let v = UnsafeAtomic>.create(_foo1) + func test_exchange_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_foo1, ordering: .releasing), _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), _foo1) + XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), _foo2) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_Pointer_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic>.create(_foo1) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_foo1, ordering: .acquiringAndReleasing), _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), _foo1) + XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), _foo2) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_Pointer_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_foo1, ordering: .sequentiallyConsistent), _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), _foo1) + XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), _foo2) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) } - func test_Pointer_compareExchange_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .relaxed) XCTAssertFalse(exchanged) @@ -28130,34 +28187,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .acquiring) XCTAssertFalse(exchanged) @@ -28166,34 +28223,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_releasing() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .releasing) XCTAssertFalse(exchanged) @@ -28202,34 +28259,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .releasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) @@ -28238,34 +28295,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) @@ -28274,36 +28331,36 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -28313,37 +28370,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -28353,37 +28410,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -28393,37 +28450,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -28433,37 +28490,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -28473,37 +28530,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -28513,37 +28570,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -28553,37 +28610,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -28593,37 +28650,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -28633,37 +28690,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -28673,37 +28730,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -28713,37 +28770,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -28753,37 +28810,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -28793,37 +28850,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -28833,37 +28890,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -28873,37 +28930,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -28913,37 +28970,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -28953,37 +29010,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -28993,37 +29050,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -29033,37 +29090,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -29073,37 +29130,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -29113,37 +29170,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -29153,37 +29210,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -29193,37 +29250,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -29233,37 +29290,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -29273,37 +29330,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -29313,37 +29370,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -29353,37 +29410,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -29393,37 +29450,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -29433,37 +29490,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Pointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_foo1) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) (exchanged, original) = v.compareExchange( - expected: _foo1, + expected: nil, desired: _foo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -29473,1709 +29530,1757 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _foo2, - desired: _foo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo1) - XCTAssertEqual(v.load(ordering: .relaxed), _foo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicMutablePointerTests: XCTestCase { + private let _mfoo1: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(1)) + return p + }() + private let _mfoo2: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(2)) + return p + }() + private var _foo1: UnsafePointer { UnsafePointer(_mfoo1) } + private var _foo2: UnsafePointer { UnsafePointer(_mfoo2) } - func test_OptionalPointer_create_destroy() { - let v = UnsafeAtomic?>.create(nil) + deinit { + _mfoo1.deinitialize(count: 1) + _mfoo1.deallocate() + + _mfoo2.deinitialize(count: 1) + _mfoo2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _foo2) + XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_load_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_load_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _foo2) + XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_load_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_load_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .acquiring), _mfoo1) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), _foo2) + XCTAssertEqual(w.load(ordering: .acquiring), _mfoo2) } - func test_OptionalPointer_load_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _mfoo1) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _foo2) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mfoo2) } - func test_OptionalPointer_store_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_store_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - v.store(_foo2, ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + v.store(_mfoo2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - w.store(nil, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_mfoo1, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_store_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_store_releasing() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - v.store(_foo2, ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + v.store(_mfoo2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - w.store(nil, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_mfoo1, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_store_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - v.store(_foo2, ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + v.store(_mfoo2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w = UnsafeAtomic?>.create(_foo2) + let w = UnsafeAtomic>.create(_mfoo2) defer { w.destroy() } - w.store(nil, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_mfoo1, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_exchange_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mfoo1, ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - XCTAssertEqual(v.exchange(_foo2, ordering: .relaxed), _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_exchange_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mfoo1, ordering: .acquiring), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - XCTAssertEqual(v.exchange(_foo2, ordering: .acquiring), _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_exchange_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_releasing() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mfoo1, ordering: .releasing), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - XCTAssertEqual(v.exchange(_foo2, ordering: .releasing), _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mfoo1, ordering: .acquiringAndReleasing), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - XCTAssertEqual(v.exchange(_foo2, ordering: .acquiringAndReleasing), _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mfoo1, ordering: .sequentiallyConsistent), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - XCTAssertEqual(v.exchange(_foo2, ordering: .sequentiallyConsistent), _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_OptionalPointer_compareExchange_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, - successOrdering: .relaxed, + expected: _mfoo1, + desired: _mfoo2, + successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, - successOrdering: .relaxed, + expected: _mfoo1, + desired: _mfoo2, + successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } - func test_OptionalPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_mfoo1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _foo2, + expected: _mfoo1, + desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), _foo2) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _foo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo2) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) (exchanged, original) = v.compareExchange( - expected: _foo2, - desired: nil, + expected: _mfoo2, + desired: _mfoo1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicOptionalMutablePointerTests: XCTestCase { + private let _mfoo1: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(1)) + return p + }() + private let _mfoo2: UnsafeMutablePointer = { + let p = UnsafeMutablePointer.allocate(capacity: 1) + p.initialize(to: Foo(2)) + return p + }() + + private var _foo1: UnsafePointer { UnsafePointer(_mfoo1) } + private var _foo2: UnsafePointer { UnsafePointer(_mfoo2) } + deinit { + _mfoo1.deinitialize(count: 1) + _mfoo1.deallocate() - func test_MutablePointer_create_destroy() { - let v = UnsafeAtomic>.create(_mfoo1) + _mfoo2.deinitialize(count: 1) + _mfoo2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_load_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_load_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_load_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_load_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), _mfoo1) + XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), _mfoo2) } - func test_MutablePointer_load_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _mfoo1) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mfoo2) } - func test_MutablePointer_store_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_store_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } v.store(_mfoo2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } - w.store(_mfoo1, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) + w.store(nil, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_MutablePointer_store_releasing() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_store_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } v.store(_mfoo2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } - w.store(_mfoo1, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) + w.store(nil, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_MutablePointer_store_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } v.store(_mfoo2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w = UnsafeAtomic>.create(_mfoo2) + let w = UnsafeAtomic?>.create(_mfoo2) defer { w.destroy() } - w.store(_mfoo1, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) + w.store(nil, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_MutablePointer_exchange_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_exchange_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_mfoo1, ordering: .relaxed), _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), _mfoo2) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_exchange_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_exchange_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_mfoo1, ordering: .acquiring), _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), _mfoo1) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), _mfoo2) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_exchange_releasing() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_exchange_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_mfoo1, ordering: .releasing), _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), _mfoo1) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), _mfoo2) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_mfoo1, ordering: .acquiringAndReleasing), _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), _mfoo1) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), _mfoo2) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_mfoo1, ordering: .sequentiallyConsistent), _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), _mfoo1) + XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), _mfoo2) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) } - func test_MutablePointer_compareExchange_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .relaxed) XCTAssertFalse(exchanged) @@ -31184,34 +31289,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .acquiring) XCTAssertFalse(exchanged) @@ -31220,34 +31325,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_releasing() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .releasing) XCTAssertFalse(exchanged) @@ -31256,34 +31361,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .releasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) @@ -31292,34 +31397,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) @@ -31328,36 +31433,36 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -31367,37 +31472,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -31407,37 +31512,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -31447,37 +31552,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -31487,37 +31592,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -31527,37 +31632,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -31567,37 +31672,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -31607,37 +31712,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -31647,37 +31752,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -31687,37 +31792,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -31727,37 +31832,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -31767,37 +31872,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -31807,37 +31912,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -31847,37 +31952,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -31887,37 +31992,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -31927,37 +32032,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -31967,37 +32072,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -32007,37 +32112,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -32047,37 +32152,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -32087,37 +32192,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -32127,37 +32232,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -32167,37 +32272,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -32207,37 +32312,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -32247,37 +32352,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -32287,37 +32392,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -32327,37 +32432,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -32367,37 +32472,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -32407,37 +32512,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -32447,37 +32552,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -32487,37 +32592,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_MutablePointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_mfoo1) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) (exchanged, original) = v.compareExchange( - expected: _mfoo1, + expected: nil, desired: _mfoo2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -32527,1709 +32632,1735 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _mfoo2, - desired: _mfoo1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo1) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicRawPointerTests: XCTestCase { + private let _mraw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private let _mraw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private var _raw1: UnsafeRawPointer { UnsafeRawPointer(_mraw1) } + private var _raw2: UnsafeRawPointer { UnsafeRawPointer(_mraw2) } - func test_OptionalMutablePointer_create_destroy() { - let v = UnsafeAtomic?>.create(nil) + deinit { + _mraw1.deallocate() + _mraw2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_load_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_load_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_load_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_load_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .acquiring), _raw1) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), _mfoo2) + XCTAssertEqual(w.load(ordering: .acquiring), _raw2) } - func test_OptionalMutablePointer_load_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _raw1) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mfoo2) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _raw2) } - func test_OptionalMutablePointer_store_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_store_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - v.store(_mfoo2, ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + v.store(_raw2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - w.store(nil, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_raw1, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_store_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_store_releasing() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - v.store(_mfoo2, ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + v.store(_raw2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - w.store(nil, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_raw1, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_store_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - v.store(_mfoo2, ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + v.store(_raw2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w = UnsafeAtomic?>.create(_mfoo2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - w.store(nil, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_raw1, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_exchange_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_raw1, ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .relaxed), _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_exchange_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_raw1, ordering: .acquiring), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiring), _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_exchange_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_releasing() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_raw1, ordering: .releasing), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .releasing), _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_raw1, ordering: .acquiringAndReleasing), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .acquiringAndReleasing), _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_raw1, ordering: .sequentiallyConsistent), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - XCTAssertEqual(v.exchange(_mfoo2, ordering: .sequentiallyConsistent), _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_OptionalMutablePointer_compareExchange_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } - func test_OptionalMutablePointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_raw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _mfoo2, + expected: _raw1, + desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _mfoo2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw2) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) (exchanged, original) = v.compareExchange( - expected: _mfoo2, - desired: nil, + expected: _raw2, + desired: _raw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), _raw1) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicOptionalRawPointerTests: XCTestCase { + private let _mraw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private let _mraw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private var _raw1: UnsafeRawPointer { UnsafeRawPointer(_mraw1) } + private var _raw2: UnsafeRawPointer { UnsafeRawPointer(_mraw2) } - func test_RawPointer_create_destroy() { - let v = UnsafeAtomic.create(_raw1) + deinit { + _mraw1.deallocate() + _mraw2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } - func test_RawPointer_load_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_load_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } - func test_RawPointer_load_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_load_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), _raw1) + XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), _raw2) } - func test_RawPointer_load_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _raw1) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _raw2) } - func test_RawPointer_store_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_store_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } v.store(_raw2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - w.store(_raw1, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), _raw1) + w.store(nil, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_RawPointer_store_releasing() { - let v = UnsafeAtomic.create(_raw1) + func test_store_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } v.store(_raw2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - w.store(_raw1, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), _raw1) + w.store(nil, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_RawPointer_store_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } v.store(_raw2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_raw2) defer { w.destroy() } - w.store(_raw1, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), _raw1) + w.store(nil, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_RawPointer_exchange_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_raw1, ordering: .relaxed), _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), _raw1) + XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), _raw2) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_RawPointer_exchange_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_raw1, ordering: .acquiring), _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), _raw1) + XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), _raw2) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_RawPointer_exchange_releasing() { - let v = UnsafeAtomic.create(_raw1) + func test_exchange_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_raw1, ordering: .releasing), _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), _raw1) + XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), _raw2) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_RawPointer_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(_raw1) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_raw1, ordering: .acquiringAndReleasing), _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), _raw1) + XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), _raw2) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_RawPointer_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_raw1, ordering: .sequentiallyConsistent), _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), _raw1) + XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), _raw2) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) } - func test_RawPointer_compareExchange_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .relaxed) XCTAssertFalse(exchanged) @@ -34238,34 +34369,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .acquiring) XCTAssertFalse(exchanged) @@ -34274,34 +34405,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_releasing() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .releasing) XCTAssertFalse(exchanged) @@ -34310,34 +34441,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .releasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) @@ -34346,34 +34477,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) @@ -34382,36 +34513,36 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -34421,37 +34552,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -34461,37 +34592,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -34501,37 +34632,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -34541,37 +34672,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -34581,37 +34712,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -34621,37 +34752,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -34661,37 +34792,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -34701,37 +34832,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -34741,37 +34872,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -34781,37 +34912,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -34821,37 +34952,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -34861,37 +34992,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -34901,37 +35032,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -34941,37 +35072,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -34981,37 +35112,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -35021,37 +35152,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -35061,37 +35192,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -35101,37 +35232,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -35141,37 +35272,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -35181,37 +35312,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -35221,37 +35352,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -35261,37 +35392,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -35301,37 +35432,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -35341,37 +35472,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -35381,37 +35512,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -35421,37 +35552,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -35461,37 +35592,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -35501,37 +35632,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -35541,37 +35672,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_raw1) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw1) + XCTAssertEqual(original, nil) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) (exchanged, original) = v.compareExchange( - expected: _raw1, + expected: nil, desired: _raw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -35581,3236 +35712,3272 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( expected: _raw2, - desired: _raw1, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw1) - XCTAssertEqual(v.load(ordering: .relaxed), _raw1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicMutableRawPointerTests: XCTestCase { + private let _mraw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private let _mraw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private var _raw1: UnsafeRawPointer { UnsafeRawPointer(_mraw1) } + private var _raw2: UnsafeRawPointer { UnsafeRawPointer(_mraw2) } - func test_OptionalRawPointer_create_destroy() { - let v = UnsafeAtomic.create(nil) + deinit { + _mraw1.deallocate() + _mraw2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _raw2) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_load_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_load_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _raw2) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_load_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_load_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .acquiring), _mraw1) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), _raw2) + XCTAssertEqual(w.load(ordering: .acquiring), _mraw2) } - func test_OptionalRawPointer_load_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _mraw1) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _raw2) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mraw2) } - func test_OptionalRawPointer_store_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_store_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - v.store(_raw2, ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + v.store(_mraw2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - w.store(nil, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_mraw1, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_store_releasing() { - let v = UnsafeAtomic.create(nil) + func test_store_releasing() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - v.store(_raw2, ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + v.store(_mraw2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - w.store(nil, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_mraw1, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_store_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - v.store(_raw2, ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + v.store(_mraw2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w = UnsafeAtomic.create(_raw2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - w.store(nil, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_mraw1, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_exchange_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mraw1, ordering: .relaxed), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .relaxed), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_raw2, ordering: .relaxed), _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .relaxed), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_exchange_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mraw1, ordering: .acquiring), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiring), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_raw2, ordering: .acquiring), _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiring), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_exchange_releasing() { - let v = UnsafeAtomic.create(nil) + func test_exchange_releasing() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mraw1, ordering: .releasing), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .releasing), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_raw2, ordering: .releasing), _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .releasing), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(nil) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mraw1, ordering: .acquiringAndReleasing), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiringAndReleasing), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_raw2, ordering: .acquiringAndReleasing), _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiringAndReleasing), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_mraw1, ordering: .sequentiallyConsistent), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .sequentiallyConsistent), _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_raw2, ordering: .sequentiallyConsistent), _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .sequentiallyConsistent), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_OptionalRawPointer_compareExchange_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_releasing() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } - func test_OptionalRawPointer_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_mraw1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: nil, - desired: _raw2, + expected: _mraw1, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), _raw2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _raw2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) (exchanged, original) = v.compareExchange( - expected: _raw2, - desired: nil, + expected: _mraw2, + desired: _mraw1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _mraw1) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { + private let _mraw1 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private let _mraw2 = UnsafeMutableRawPointer.allocate(byteCount: 16, alignment: 1) + private var _raw1: UnsafeRawPointer { UnsafeRawPointer(_mraw1) } + private var _raw2: UnsafeRawPointer { UnsafeRawPointer(_mraw2) } - func test_Unmanaged_create_destroy() { - let v = UnsafeAtomic>.create(_bar1) + deinit { + _mraw1.deallocate() + _mraw2.deallocate() + } + + func test_create_destroy() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _bar2) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_load_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_load_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _bar2) + XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_load_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_load_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), _bar1) + XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), _bar2) + XCTAssertEqual(w.load(ordering: .acquiring), _mraw2) } - func test_Unmanaged_load_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _bar1) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _bar2) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mraw2) } - func test_Unmanaged_store_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_store_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - v.store(_bar2, ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + v.store(_mraw2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - w.store(_bar1, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), _bar1) + w.store(nil, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Unmanaged_store_releasing() { - let v = UnsafeAtomic>.create(_bar1) + func test_store_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - v.store(_bar2, ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + v.store(_mraw2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - w.store(_bar1, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), _bar1) + w.store(nil, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Unmanaged_store_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - v.store(_bar2, ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + v.store(_mraw2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w = UnsafeAtomic>.create(_bar2) + let w = UnsafeAtomic.create(_mraw2) defer { w.destroy() } - w.store(_bar1, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), _bar1) + w.store(nil, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Unmanaged_exchange_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_bar1, ordering: .relaxed), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .relaxed), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_exchange_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_bar1, ordering: .acquiring), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiring), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_exchange_releasing() { - let v = UnsafeAtomic>.create(_bar1) + func test_exchange_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_bar1, ordering: .releasing), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .releasing), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic>.create(_bar1) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_bar1, ordering: .acquiringAndReleasing), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .acquiringAndReleasing), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_bar1, ordering: .sequentiallyConsistent), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(v.exchange(_mraw2, ordering: .sequentiallyConsistent), _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) } - func test_Unmanaged_compareExchange_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_releasing() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Unmanaged_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic>.create(_bar1) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar1, - desired: _bar2, + expected: nil, + desired: _mraw2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, _mraw2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _bar2, - desired: _bar1, + expected: _mraw2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _bar1) - XCTAssertEqual(v.load(ordering: .relaxed), _bar1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicUnmanagedTests: XCTestCase { + private let _bar1 = Unmanaged.passRetained(Bar(1)) + private let _bar2 = Unmanaged.passRetained(Bar(2)) + deinit { + _bar1.release() + _bar2.release() + } - func test_OptionalUnmanaged_create_destroy() { - let v = UnsafeAtomic?>.create(nil) + func test_create_destroy() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_load_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_load_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_load_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_load_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .acquiring), _bar1) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), _bar2) } - func test_OptionalUnmanaged_load_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _bar1) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _bar2) } - func test_OptionalUnmanaged_store_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_store_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } v.store(_bar2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } - w.store(nil, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_bar1, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_store_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_store_releasing() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } v.store(_bar2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } - w.store(nil, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_bar1, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_store_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } v.store(_bar2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w = UnsafeAtomic?>.create(_bar2) + let w = UnsafeAtomic>.create(_bar2) defer { w.destroy() } - w.store(nil, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_bar1, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_exchange_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_bar1, ordering: .relaxed), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), _bar2) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_exchange_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_bar1, ordering: .acquiring), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), nil) + XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), _bar2) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_exchange_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_releasing() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_bar1, ordering: .releasing), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), nil) + XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), _bar2) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_bar1, ordering: .acquiringAndReleasing), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), _bar2) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_bar1, ordering: .sequentiallyConsistent), _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), _bar2) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_OptionalUnmanaged_compareExchange_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .relaxed) XCTAssertFalse(exchanged) @@ -38819,34 +38986,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .acquiring) XCTAssertFalse(exchanged) @@ -38855,34 +39022,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_releasing() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .releasing) XCTAssertFalse(exchanged) @@ -38891,34 +39058,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .releasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) @@ -38927,34 +39094,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) @@ -38963,36 +39130,36 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -39002,37 +39169,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -39042,37 +39209,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -39082,37 +39249,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -39122,37 +39289,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -39162,37 +39329,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -39202,37 +39369,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -39242,37 +39409,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -39282,37 +39449,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -39322,37 +39489,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -39362,37 +39529,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -39402,37 +39569,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -39442,37 +39609,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -39482,37 +39649,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -39522,37 +39689,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -39562,37 +39729,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -39602,37 +39769,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -39642,37 +39809,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -39682,37 +39849,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -39722,37 +39889,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -39762,37 +39929,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -39802,37 +39969,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -39842,37 +40009,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -39882,37 +40049,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -39922,37 +40089,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -39962,37 +40129,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -40002,37 +40169,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -40042,37 +40209,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -40082,37 +40249,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -40122,37 +40289,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } - func test_OptionalUnmanaged_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic?>.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic>.create(_bar1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _bar1, desired: _bar2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -40162,1709 +40329,4784 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _bar2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) (exchanged, original) = v.compareExchange( expected: _bar2, - desired: nil, + desired: _bar1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _bar1) + XCTAssertEqual(v.load(ordering: .relaxed), _bar1) } -// Bool operations -// Integer operations +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicOptionalUnmanagedTests: XCTestCase { + private let _bar1 = Unmanaged.passRetained(Bar(1)) + private let _bar2 = Unmanaged.passRetained(Bar(2)) + deinit { + _bar1.release() + _bar2.release() + } - func test_Reference_create_destroy() { - let v = UnsafeAtomic.create(_baz1) + func test_create_destroy() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _baz2) + XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } - func test_Reference_load_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_load_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), _baz2) + XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } - func test_Reference_load_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_load_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), _baz1) + XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), _baz2) + XCTAssertEqual(w.load(ordering: .acquiring), _bar2) } - func test_Reference_load_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _baz1) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _baz2) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _bar2) } - func test_Reference_store_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_store_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - v.store(_baz2, ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + v.store(_bar2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - w.store(_baz1, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), _baz1) + w.store(nil, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Reference_store_releasing() { - let v = UnsafeAtomic.create(_baz1) + func test_store_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - v.store(_baz2, ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + v.store(_bar2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - w.store(_baz1, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), _baz1) + w.store(nil, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Reference_store_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - v.store(_baz2, ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + v.store(_bar2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic?>.create(_bar2) defer { w.destroy() } - w.store(_baz1, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), _baz1) + w.store(nil, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_Reference_exchange_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_exchange_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_baz1, ordering: .relaxed), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .relaxed), _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_Reference_exchange_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_exchange_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_baz1, ordering: .acquiring), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .acquiring), _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_Reference_exchange_releasing() { - let v = UnsafeAtomic.create(_baz1) + func test_exchange_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_baz1, ordering: .releasing), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .releasing), _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_Reference_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(_baz1) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_baz1, ordering: .acquiringAndReleasing), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .acquiringAndReleasing), _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_Reference_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(_baz1, ordering: .sequentiallyConsistent), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(v.exchange(_bar2, ordering: .sequentiallyConsistent), _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) } - func test_Reference_compareExchange_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Reference_compareExchange_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Reference_compareExchange_releasing() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_releasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Reference_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Reference_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: _bar2, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_Reference_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic?>.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic?>.create(nil) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: nil, + desired: _bar2, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), _bar2) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, _bar2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + + (exchanged, original) = v.compareExchange( + expected: _bar2, + desired: nil, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) + } + + + + +} +#endif +#if true +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicRawRepresentableTests: XCTestCase { + + func test_create_destroy() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .relaxed), Fred.two) + } + + func test_load_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .relaxed), Fred.two) + } + func test_load_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .acquiring), Fred.one) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .acquiring), Fred.two) + } + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), Fred.one) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), Fred.two) + } + + func test_store_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + v.store(Fred.two, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + w.store(Fred.one, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), Fred.one) + } + func test_store_releasing() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + v.store(Fred.two, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + w.store(Fred.one, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), Fred.one) + } + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + v.store(Fred.two, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + let w = UnsafeAtomic.create(Fred.two) + defer { w.destroy() } + w.store(Fred.one, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), Fred.one) + } + + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(Fred.one, ordering: .relaxed), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .relaxed), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .relaxed), Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + } + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(Fred.one, ordering: .acquiring), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiring), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiring), Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + } + func test_exchange_releasing() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(Fred.one, ordering: .releasing), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .releasing), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .releasing), Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + } + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(Fred.one, ordering: .acquiringAndReleasing), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiringAndReleasing), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiringAndReleasing), Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + } + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(Fred.one, ordering: .sequentiallyConsistent), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .sequentiallyConsistent), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + XCTAssertEqual(v.exchange(Fred.two, ordering: .sequentiallyConsistent), Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + } + + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .releasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .releasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .releasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .releasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .acquiringAndReleasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .acquiringAndReleasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .acquiringAndReleasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .acquiringAndReleasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + ordering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + ordering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .relaxed, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiring, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .releasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .acquiringAndReleasing, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(Fred.one) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.one, + desired: Fred.two, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, Fred.two) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + + (exchanged, original) = v.compareExchange( + expected: Fred.two, + desired: Fred.one, + successOrdering: .sequentiallyConsistent, + failureOrdering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + } + + + + +} +#endif +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicDoubleWordTests: XCTestCase { + + func test_create_destroy() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + + func test_load_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + func test_load_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .acquiring), DoubleWord(high: 100, low: 64)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .acquiring), DoubleWord(high: 50, low: 32)) + } + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), DoubleWord(high: 100, low: 64)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), DoubleWord(high: 50, low: 32)) + } + + func test_store_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + v.store(DoubleWord(high: 50, low: 32), ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + w.store(DoubleWord(high: 100, low: 64), ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + func test_store_releasing() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + v.store(DoubleWord(high: 50, low: 32), ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + w.store(DoubleWord(high: 100, low: 64), ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + v.store(DoubleWord(high: 50, low: 32), ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + let w = UnsafeAtomic.create(DoubleWord(high: 50, low: 32)) + defer { w.destroy() } + w.store(DoubleWord(high: 100, low: 64), ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .relaxed), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .relaxed), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .acquiring), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiring), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiring), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + func test_exchange_releasing() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .releasing), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .releasing), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .releasing), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .acquiringAndReleasing), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiringAndReleasing), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .acquiringAndReleasing), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + XCTAssertEqual(v.exchange(DoubleWord(high: 100, low: 64), ordering: .sequentiallyConsistent), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .sequentiallyConsistent), DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + XCTAssertEqual(v.exchange(DoubleWord(high: 50, low: 32), ordering: .sequentiallyConsistent), DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + } + + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .relaxed) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .acquiring) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .acquiring) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .releasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .releasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .releasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .releasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .acquiringAndReleasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .acquiringAndReleasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .acquiringAndReleasing) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .acquiringAndReleasing) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + ordering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .sequentiallyConsistent) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), + ordering: .sequentiallyConsistent) + XCTAssertFalse(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) + } + + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) + defer { v.destroy() } + + var (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), + successOrdering: .relaxed, + failureOrdering: .relaxed) + XCTAssertTrue(exchanged) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) + + (exchanged, original) = v.compareExchange( + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } - func test_Reference_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(_baz1) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(DoubleWord(high: 100, low: 64)) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz1, - desired: _baz2, + expected: DoubleWord(high: 100, low: 64), + desired: DoubleWord(high: 50, low: 32), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz2) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 50, low: 32)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 50, low: 32)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) (exchanged, original) = v.compareExchange( - expected: _baz2, - desired: _baz1, + expected: DoubleWord(high: 50, low: 32), + desired: DoubleWord(high: 100, low: 64), successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, _baz1) - XCTAssertEqual(v.load(ordering: .relaxed), _baz1) + XCTAssertEqual(original, DoubleWord(high: 100, low: 64)) + XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(high: 100, low: 64)) } -// Bool operations - -// Integer operations +} +#endif +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicReferenceTests: XCTestCase { + private let _baz1 = Baz(1) + private let _baz2 = Baz(2) - func test_OptionalReference_create_destroy() { - let v = UnsafeAtomic.create(nil) + func test_create_destroy() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_load_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_load_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_load_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_load_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .acquiring), _baz1) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .acquiring), _baz2) } - func test_OptionalReference_load_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _baz1) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _baz2) } - func test_OptionalReference_store_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_store_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } v.store(_baz2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - w.store(nil, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_baz1, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_store_releasing() { - let v = UnsafeAtomic.create(nil) + func test_store_releasing() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } v.store(_baz2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - w.store(nil, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_baz1, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_store_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } v.store(_baz2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w = UnsafeAtomic.create(_baz2) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - w.store(nil, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), nil) + w.store(_baz1, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_exchange_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_baz1, ordering: .relaxed), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), _baz2) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_exchange_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_baz1, ordering: .acquiring), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), nil) + XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), _baz2) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_exchange_releasing() { - let v = UnsafeAtomic.create(nil) + func test_exchange_releasing() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_baz1, ordering: .releasing), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), nil) + XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), _baz2) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(nil) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_baz1, ordering: .acquiringAndReleasing), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), _baz2) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } - XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.exchange(_baz1, ordering: .sequentiallyConsistent), _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), _baz2) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_OptionalReference_compareExchange_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .relaxed) XCTAssertFalse(exchanged) @@ -41873,34 +45115,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .acquiring) XCTAssertFalse(exchanged) @@ -41909,34 +45151,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_releasing() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .releasing) XCTAssertFalse(exchanged) @@ -41945,34 +45187,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .releasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) @@ -41981,34 +45223,34 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) @@ -42017,36 +45259,36 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -42056,37 +45298,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -42096,37 +45338,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -42136,37 +45378,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -42176,37 +45418,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -42216,37 +45458,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -42256,37 +45498,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -42296,37 +45538,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -42336,37 +45578,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -42376,37 +45618,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -42416,37 +45658,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -42456,37 +45698,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -42496,37 +45738,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -42536,37 +45778,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -42576,37 +45818,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -42616,37 +45858,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) @@ -42656,37 +45898,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) @@ -42696,37 +45938,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) @@ -42736,37 +45978,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) @@ -42776,37 +46018,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) @@ -42816,37 +46058,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) @@ -42856,37 +46098,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) @@ -42896,37 +46138,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) @@ -42936,37 +46178,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) @@ -42976,37 +46218,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) @@ -43016,37 +46258,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) @@ -43056,37 +46298,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) @@ -43096,37 +46338,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) @@ -43136,37 +46378,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) @@ -43176,37 +46418,37 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } - func test_OptionalReference_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(nil) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(_baz1) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, nil) + XCTAssertEqual(original, _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: nil, + expected: _baz1, desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) @@ -43216,1555 +46458,1557 @@ class BasicAtomicTests: XCTestCase { (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) XCTAssertEqual(original, _baz2) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) (exchanged, original) = v.compareExchange( expected: _baz2, - desired: nil, + desired: _baz1, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, nil) - XCTAssertEqual(v.load(ordering: .relaxed), nil) + XCTAssertEqual(original, _baz1) + XCTAssertEqual(v.load(ordering: .relaxed), _baz1) } -// Bool operations -// Integer operations - +} +#endif +#if !(os(Linux) && arch(x86_64)) || ENABLE_DOUBLEWIDE_ATOMICS +/// Exercises all operations in a single-threaded context, verifying +/// they provide the expected results. +class BasicAtomicOptionalReferenceTests: XCTestCase { + private let _baz1 = Baz(1) + private let _baz2 = Baz(2) - func test_RawRepresentable_create_destroy() { - let v = UnsafeAtomic.create(Fred.one) + func test_create_destroy() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_load_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_load_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_load_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_load_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .acquiring), Fred.one) + XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .acquiring), Fred.two) + XCTAssertEqual(w.load(ordering: .acquiring), _baz2) } - func test_RawRepresentable_load_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_load_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), Fred.one) + XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), Fred.two) + XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _baz2) } - func test_RawRepresentable_store_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_store_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - v.store(Fred.two, ordering: .relaxed) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + v.store(_baz2, ordering: .relaxed) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - w.store(Fred.one, ordering: .relaxed) - XCTAssertEqual(w.load(ordering: .relaxed), Fred.one) + w.store(nil, ordering: .relaxed) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_RawRepresentable_store_releasing() { - let v = UnsafeAtomic.create(Fred.one) + func test_store_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - v.store(Fred.two, ordering: .releasing) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + v.store(_baz2, ordering: .releasing) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - w.store(Fred.one, ordering: .releasing) - XCTAssertEqual(w.load(ordering: .relaxed), Fred.one) + w.store(nil, ordering: .releasing) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_RawRepresentable_store_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_store_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - v.store(Fred.two, ordering: .sequentiallyConsistent) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + v.store(_baz2, ordering: .sequentiallyConsistent) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w = UnsafeAtomic.create(Fred.two) + let w = UnsafeAtomic.create(_baz2) defer { w.destroy() } - w.store(Fred.one, ordering: .sequentiallyConsistent) - XCTAssertEqual(w.load(ordering: .relaxed), Fred.one) + w.store(nil, ordering: .sequentiallyConsistent) + XCTAssertEqual(w.load(ordering: .relaxed), nil) } - func test_RawRepresentable_exchange_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_exchange_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(Fred.one, ordering: .relaxed), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(Fred.two, ordering: .relaxed), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - XCTAssertEqual(v.exchange(Fred.two, ordering: .relaxed), Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .relaxed), _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_exchange_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_exchange_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(Fred.one, ordering: .acquiring), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiring), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiring), Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .acquiring), _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_exchange_releasing() { - let v = UnsafeAtomic.create(Fred.one) + func test_exchange_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(Fred.one, ordering: .releasing), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(Fred.two, ordering: .releasing), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - XCTAssertEqual(v.exchange(Fred.two, ordering: .releasing), Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .releasing), _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_exchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(Fred.one) + func test_exchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(Fred.one, ordering: .acquiringAndReleasing), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiringAndReleasing), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - XCTAssertEqual(v.exchange(Fred.two, ordering: .acquiringAndReleasing), Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .acquiringAndReleasing), _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_exchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_exchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } - XCTAssertEqual(v.exchange(Fred.one, ordering: .sequentiallyConsistent), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) - XCTAssertEqual(v.exchange(Fred.two, ordering: .sequentiallyConsistent), Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - XCTAssertEqual(v.exchange(Fred.two, ordering: .sequentiallyConsistent), Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(v.exchange(_baz2, ordering: .sequentiallyConsistent), _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) } - func test_RawRepresentable_compareExchange_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_releasing() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_releasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .releasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .releasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiringAndReleasing() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiringAndReleasing() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .acquiringAndReleasing) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, ordering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_relaxed_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_relaxed_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_relaxed_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_relaxed_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_relaxed_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .relaxed, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_acquiring_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_acquiring_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_acquiring_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_acquiring_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_acquiring_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiring, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_releasing_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_releasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_releasing_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_releasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_releasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_releasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .releasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_acquiringAndReleasing_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_acquiringAndReleasing_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .acquiringAndReleasing, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_sequentiallyConsistent_relaxed() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .relaxed) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_sequentiallyConsistent_acquiring() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .acquiring) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } - func test_RawRepresentable_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v = UnsafeAtomic.create(Fred.one) + func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { + let v = UnsafeAtomic.create(nil) defer { v.destroy() } var (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.one, - desired: Fred.two, + expected: nil, + desired: _baz2, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), _baz2) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertTrue(exchanged) - XCTAssertEqual(original, Fred.two) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, _baz2) + XCTAssertEqual(v.load(ordering: .relaxed), nil) (exchanged, original) = v.compareExchange( - expected: Fred.two, - desired: Fred.one, + expected: _baz2, + desired: nil, successOrdering: .sequentiallyConsistent, failureOrdering: .sequentiallyConsistent) XCTAssertFalse(exchanged) - XCTAssertEqual(original, Fred.one) - XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) + XCTAssertEqual(original, nil) + XCTAssertEqual(v.load(ordering: .relaxed), nil) } -// Bool operations - - -// Integer operations } +#endif diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift deleted file mode 100644 index 57979de..0000000 --- a/Tests/LinuxMain.swift +++ /dev/null @@ -1,8 +0,0 @@ -import XCTest - -import AtomicsTests - -var tests = [XCTestCaseEntry]() -tests += AtomicsTests.__allTests() - -XCTMain(tests) diff --git a/generate-sources b/generate-sources index 5d9004f..d8114a3 100755 --- a/generate-sources +++ b/generate-sources @@ -28,10 +28,8 @@ lineDirective='' #lineDirective='#sourceLocation(file: "%(file)s", line: %(line)d)' -echo "Running gyb..." - # Create a temporary directory; remove it on exit. -tmpdir="$(mktemp -d -t "$(basename "$0")")" +tmpdir="$(mktemp -d "${TMPDIR:-/tmp}/$(basename "$0").XXXXXXXX")" trap "rm -rf \"$tmpdir\"" EXIT # Run gyb on each gyb file in the source tree and put results in @@ -62,11 +60,3 @@ sort "$tmpdir/generated-files.txt" | uniq -u | while read obsolete; do echo "Removing $obsolete" rm "$obsolete" done - -# Generate XCTest test registry for platforms without the Objective-C runtime. -if [ "$(uname)" = Darwin ]; then - echo "Registering tests..." - swift test --generate-linuxmain -fi - -echo "All done!"