diff --git a/Sources/Atomics/autogenerated/AtomicBool.swift b/Sources/Atomics/autogenerated/AtomicBool.swift index ed89286..237db0a 100644 --- a/Sources/Atomics/autogenerated/AtomicBool.swift +++ b/Sources/Atomics/autogenerated/AtomicBool.swift @@ -229,6 +229,116 @@ extension Bool.AtomicRepresentation { } } +extension Atomic where Value == Bool { + /// Perform an atomic logical AND operation and return the original value, applying + /// the specified memory ordering. + /// + /// - Parameter operand: A boolean value. + /// - Parameter ordering: The memory ordering to apply on this operation. + /// - Returns: The original value before the operation. + @_semantics("atomics.requires_constant_orderings") + @_transparent @_alwaysEmitIntoClient + public func loadThenLogicalAnd( + with operand: Value, + ordering: AtomicUpdateOrdering + ) -> Value { + Value.AtomicRepresentation.atomicLoadThenLogicalAnd( + with: operand, + at: _ptr, + ordering: ordering) + } + /// Perform an atomic logical OR operation and return the original value, applying + /// the specified memory ordering. + /// + /// - Parameter operand: A boolean value. + /// - Parameter ordering: The memory ordering to apply on this operation. + /// - Returns: The original value before the operation. + @_semantics("atomics.requires_constant_orderings") + @_transparent @_alwaysEmitIntoClient + public func loadThenLogicalOr( + with operand: Value, + ordering: AtomicUpdateOrdering + ) -> Value { + Value.AtomicRepresentation.atomicLoadThenLogicalOr( + with: operand, + at: _ptr, + ordering: ordering) + } + /// Perform an atomic logical XOR operation and return the original value, applying + /// the specified memory ordering. + /// + /// - Parameter operand: A boolean value. + /// - Parameter ordering: The memory ordering to apply on this operation. + /// - Returns: The original value before the operation. + @_semantics("atomics.requires_constant_orderings") + @_transparent @_alwaysEmitIntoClient + public func loadThenLogicalXor( + with operand: Value, + ordering: AtomicUpdateOrdering + ) -> Value { + Value.AtomicRepresentation.atomicLoadThenLogicalXor( + with: operand, + at: _ptr, + ordering: ordering) + } +} + +extension Atomic where Value == Bool { + /// Perform an atomic logical AND operation and return the original value, applying + /// the specified memory ordering. + /// + /// - Parameter operand: A boolean value. + /// - Parameter ordering: The memory ordering to apply on this operation. + /// - Returns: The original value before the operation. + @_semantics("atomics.requires_constant_orderings") + @_transparent @_alwaysEmitIntoClient + public func logicalAndThenLoad( + with operand: Value, + ordering: AtomicUpdateOrdering + ) -> Value { + let original = Value.AtomicRepresentation.atomicLoadThenLogicalAnd( + with: operand, + at: _ptr, + ordering: ordering) + return original && operand + } + /// Perform an atomic logical OR operation and return the original value, applying + /// the specified memory ordering. + /// + /// - Parameter operand: A boolean value. + /// - Parameter ordering: The memory ordering to apply on this operation. + /// - Returns: The original value before the operation. + @_semantics("atomics.requires_constant_orderings") + @_transparent @_alwaysEmitIntoClient + public func logicalOrThenLoad( + with operand: Value, + ordering: AtomicUpdateOrdering + ) -> Value { + let original = Value.AtomicRepresentation.atomicLoadThenLogicalOr( + with: operand, + at: _ptr, + ordering: ordering) + return original || operand + } + /// Perform an atomic logical XOR operation and return the original value, applying + /// the specified memory ordering. + /// + /// - Parameter operand: A boolean value. + /// - Parameter ordering: The memory ordering to apply on this operation. + /// - Returns: The original value before the operation. + @_semantics("atomics.requires_constant_orderings") + @_transparent @_alwaysEmitIntoClient + public func logicalXorThenLoad( + with operand: Value, + ordering: AtomicUpdateOrdering + ) -> Value { + let original = Value.AtomicRepresentation.atomicLoadThenLogicalXor( + with: operand, + at: _ptr, + ordering: ordering) + return original != operand + } +} extension UnsafeAtomic where Value == Bool { /// Perform an atomic logical AND operation and return the original value, applying /// the specified memory ordering. diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicBoolTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicBoolTests.swift index c4079d1..6b1d2b0 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicBoolTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicBoolTests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicBoolTests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.load(ordering: .relaxed), true) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) XCTAssertEqual(w.load(ordering: .relaxed), false) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.load(ordering: .relaxed), true) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) XCTAssertEqual(w.load(ordering: .relaxed), false) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.load(ordering: .acquiring), true) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) XCTAssertEqual(w.load(ordering: .acquiring), false) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), true) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), false) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) v.store(false, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), false) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) w.store(true, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), true) } func test_store_releasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) v.store(false, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), false) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) w.store(true, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), true) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) v.store(false, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), false) - let w: UnsafeAtomic = .create(false) - defer { w.destroy() } + let w = Atomic(false) w.store(true, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), true) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.exchange(true, ordering: .relaxed), true) XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -118,8 +103,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.exchange(true, ordering: .acquiring), true) XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -132,8 +116,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.exchange(true, ordering: .releasing), true) XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -146,8 +129,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.exchange(true, ordering: .acquiringAndReleasing), true) XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -160,8 +142,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) XCTAssertEqual(v.exchange(true, ordering: .sequentiallyConsistent), true) XCTAssertEqual(v.load(ordering: .relaxed), true) @@ -175,8 +156,7 @@ class BasicAtomicBoolTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -212,8 +192,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -249,8 +228,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -286,8 +264,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -323,8 +300,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -360,8 +336,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -397,8 +372,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -434,8 +408,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -471,8 +444,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -508,8 +480,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -546,8 +517,7 @@ class BasicAtomicBoolTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -587,8 +557,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -628,8 +597,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -669,8 +637,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -710,8 +677,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -751,8 +717,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -792,8 +757,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -833,8 +797,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -874,8 +837,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -915,8 +877,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -956,8 +917,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -997,8 +957,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -1038,8 +997,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -1079,8 +1037,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -1120,8 +1077,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.compareExchange( expected: true, @@ -1161,8 +1117,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1202,8 +1157,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1243,8 +1197,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1284,8 +1237,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1325,8 +1277,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1366,8 +1317,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1407,8 +1357,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1448,8 +1397,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1489,8 +1437,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1530,8 +1477,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1571,8 +1517,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1612,8 +1557,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1653,8 +1597,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1694,8 +1637,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1735,8 +1677,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(true) - defer { v.destroy() } + let v = Atomic(true) var (exchanged, original): (Bool, Bool) = v.weakCompareExchange( expected: true, @@ -1779,8 +1720,7 @@ class BasicAtomicBoolTests: XCTestCase { // Bool operations func test_loadThenLogicalAnd_relaxed() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1797,8 +1737,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalAnd_acquiring() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1815,8 +1754,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalAnd_releasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1833,8 +1771,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalAnd_acquiringAndReleasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1851,8 +1788,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalAnd_sequentiallyConsistent() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1869,8 +1805,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalOr_relaxed() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1887,8 +1822,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalOr_acquiring() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1905,8 +1839,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalOr_releasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1923,8 +1856,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalOr_acquiringAndReleasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1941,8 +1873,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalOr_sequentiallyConsistent() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1959,8 +1890,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalXor_relaxed() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1977,8 +1907,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalXor_acquiring() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -1995,8 +1924,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalXor_releasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2013,8 +1941,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalXor_acquiringAndReleasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2031,8 +1958,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_loadThenLogicalXor_sequentiallyConsistent() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2050,8 +1976,7 @@ class BasicAtomicBoolTests: XCTestCase { func test_logicalAndThenLoad_relaxed() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2070,8 +1995,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalAndThenLoad_acquiring() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2090,8 +2014,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalAndThenLoad_releasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2110,8 +2033,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalAndThenLoad_acquiringAndReleasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2130,8 +2052,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalAndThenLoad_sequentiallyConsistent() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2150,8 +2071,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalOrThenLoad_relaxed() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2170,8 +2090,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalOrThenLoad_acquiring() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2190,8 +2109,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalOrThenLoad_releasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2210,8 +2128,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalOrThenLoad_acquiringAndReleasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2230,8 +2147,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalOrThenLoad_sequentiallyConsistent() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2250,8 +2166,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalXorThenLoad_relaxed() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2270,8 +2185,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalXorThenLoad_acquiring() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2290,8 +2204,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalXorThenLoad_releasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2310,8 +2223,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalXorThenLoad_acquiringAndReleasing() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { @@ -2330,8 +2242,7 @@ class BasicAtomicBoolTests: XCTestCase { } func test_logicalXorThenLoad_sequentiallyConsistent() { - let v = UnsafeAtomic.create(false) - defer { v.destroy() } + let v = Atomic(false) // The truth tables are super tiny, so just check every value for a in [false, true] { diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicDoubleWordTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicDoubleWordTests.swift index 8d9adfa..fdfd7cb 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicDoubleWordTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicDoubleWordTests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicDoubleWordTests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(first: 50, second: 32)) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(first: 50, second: 32)) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .acquiring), DoubleWord(first: 100, second: 64)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) XCTAssertEqual(w.load(ordering: .acquiring), DoubleWord(first: 50, second: 32)) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), DoubleWord(first: 100, second: 64)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), DoubleWord(first: 50, second: 32)) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) v.store(DoubleWord(first: 50, second: 32), ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 50, second: 32)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) w.store(DoubleWord(first: 100, second: 64), ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) } func test_store_releasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) v.store(DoubleWord(first: 50, second: 32), ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 50, second: 32)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) w.store(DoubleWord(first: 100, second: 64), ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) v.store(DoubleWord(first: 50, second: 32), ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 50, second: 32)) - let w: UnsafeAtomic = .create(DoubleWord(first: 50, second: 32)) - defer { w.destroy() } + let w = Atomic(DoubleWord(first: 50, second: 32)) w.store(DoubleWord(first: 100, second: 64), ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.exchange(DoubleWord(first: 100, second: 64), ordering: .relaxed), DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) @@ -118,8 +103,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.exchange(DoubleWord(first: 100, second: 64), ordering: .acquiring), DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) @@ -132,8 +116,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.exchange(DoubleWord(first: 100, second: 64), ordering: .releasing), DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) @@ -146,8 +129,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.exchange(DoubleWord(first: 100, second: 64), ordering: .acquiringAndReleasing), DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) @@ -160,8 +142,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.exchange(DoubleWord(first: 100, second: 64), ordering: .sequentiallyConsistent), DoubleWord(first: 100, second: 64)) XCTAssertEqual(v.load(ordering: .relaxed), DoubleWord(first: 100, second: 64)) @@ -175,8 +156,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -212,8 +192,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -249,8 +228,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -286,8 +264,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -323,8 +300,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -360,8 +336,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -397,8 +372,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -434,8 +408,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -471,8 +444,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -508,8 +480,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -546,8 +517,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -587,8 +557,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -628,8 +597,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -669,8 +637,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -710,8 +677,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -751,8 +717,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -792,8 +757,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -833,8 +797,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -874,8 +837,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -915,8 +877,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -956,8 +917,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -997,8 +957,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1038,8 +997,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1079,8 +1037,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1120,8 +1077,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.compareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1161,8 +1117,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1202,8 +1157,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1243,8 +1197,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1284,8 +1237,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1325,8 +1277,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1366,8 +1317,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1407,8 +1357,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1448,8 +1397,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1489,8 +1437,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1530,8 +1477,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1571,8 +1517,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1612,8 +1557,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1653,8 +1597,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1694,8 +1637,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), @@ -1735,8 +1677,7 @@ class BasicAtomicDoubleWordTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(DoubleWord(first: 100, second: 64)) - defer { v.destroy() } + let v = Atomic(DoubleWord(first: 100, second: 64)) var (exchanged, original): (Bool, DoubleWord) = v.weakCompareExchange( expected: DoubleWord(first: 100, second: 64), diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt16Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt16Tests.swift index 48c48b2..04b01e2 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt16Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt16Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicInt16Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicInt16Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicInt16Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int16) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int16 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &+ b let result2: Int16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a &- b let result2: Int16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a & b let result2: Int16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a | b let result2: Int16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicInt16Tests: XCTestCase { let result1: Int16 = a ^ b let result2: Int16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int16 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt32Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt32Tests.swift index b755452..c42f193 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt32Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt32Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicInt32Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicInt32Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicInt32Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int32) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int32 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &+ b let result2: Int32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a &- b let result2: Int32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a & b let result2: Int32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a | b let result2: Int32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicInt32Tests: XCTestCase { let result1: Int32 = a ^ b let result2: Int32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int32 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt64Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt64Tests.swift index bda8b1c..bae388d 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt64Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt64Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicInt64Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicInt64Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicInt64Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int64) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int64 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &+ b let result2: Int64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a &- b let result2: Int64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a & b let result2: Int64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a | b let result2: Int64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicInt64Tests: XCTestCase { let result1: Int64 = a ^ b let result2: Int64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int64 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt8Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt8Tests.swift index b5c33e2..6bcb27c 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt8Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicInt8Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicInt8Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicInt8Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicInt8Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int8) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int8 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &+ b let result2: Int8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a &- b let result2: Int8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a & b let result2: Int8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a | b let result2: Int8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicInt8Tests: XCTestCase { let result1: Int8 = a ^ b let result2: Int8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int8 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicIntTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicIntTests.swift index d24f881..1a6de6e 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicIntTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicIntTests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicIntTests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicIntTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicIntTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, Int) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: Int = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &+ b let result2: Int = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a &- b let result2: Int = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a & b let result2: Int = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a | b let result2: Int = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicIntTests: XCTestCase { let result1: Int = a ^ b let result2: Int = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: Int = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutablePointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutablePointerTests.swift index 2240630..6708e85 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutablePointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutablePointerTests.swift @@ -47,86 +47,71 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } func test_load_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } func test_load_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.load(ordering: .acquiring), _mfoo1) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) XCTAssertEqual(w.load(ordering: .acquiring), _mfoo2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _mfoo1) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mfoo2) } func test_store_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) v.store(_mfoo2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) w.store(_mfoo1, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) } func test_store_releasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) v.store(_mfoo2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) w.store(_mfoo1, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) v.store(_mfoo2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w: UnsafeAtomic> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic>(_mfoo2) w.store(_mfoo1, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo1) } func test_exchange_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.exchange(_mfoo1, ordering: .relaxed), _mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) @@ -139,8 +124,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.exchange(_mfoo1, ordering: .acquiring), _mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) @@ -153,8 +137,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.exchange(_mfoo1, ordering: .releasing), _mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) @@ -167,8 +150,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.exchange(_mfoo1, ordering: .acquiringAndReleasing), _mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) @@ -181,8 +163,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) XCTAssertEqual(v.exchange(_mfoo1, ordering: .sequentiallyConsistent), _mfoo1) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo1) @@ -196,8 +177,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -233,8 +213,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -270,8 +249,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -307,8 +285,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -344,8 +321,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -381,8 +357,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -418,8 +393,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -455,8 +429,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -492,8 +465,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -529,8 +501,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -567,8 +538,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -608,8 +578,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -649,8 +618,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -690,8 +658,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -731,8 +698,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -772,8 +738,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -813,8 +778,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -854,8 +818,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -895,8 +858,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -936,8 +898,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -977,8 +938,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -1018,8 +978,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -1059,8 +1018,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -1100,8 +1058,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -1141,8 +1098,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.compareExchange( expected: _mfoo1, @@ -1182,8 +1138,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1223,8 +1178,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1264,8 +1218,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1305,8 +1258,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1346,8 +1298,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1387,8 +1338,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1428,8 +1378,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1469,8 +1418,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1510,8 +1458,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1551,8 +1498,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1592,8 +1538,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1633,8 +1578,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1674,8 +1618,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1715,8 +1658,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, @@ -1756,8 +1698,7 @@ class BasicAtomicMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_mfoo1) - defer { v.destroy() } + let v = Atomic>(_mfoo1) var (exchanged, original): (Bool, UnsafeMutablePointer) = v.weakCompareExchange( expected: _mfoo1, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutableRawPointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutableRawPointerTests.swift index 0056e52..6a9de4d 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutableRawPointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicMutableRawPointerTests.swift @@ -36,86 +36,71 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.load(ordering: .acquiring), _mraw1) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .acquiring), _mraw2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _mraw1) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mraw2) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) v.store(_mraw2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) w.store(_mraw1, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), _mraw1) } func test_store_releasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) v.store(_mraw2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) w.store(_mraw1, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), _mraw1) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) v.store(_mraw2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) w.store(_mraw1, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), _mraw1) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.exchange(_mraw1, ordering: .relaxed), _mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) @@ -128,8 +113,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.exchange(_mraw1, ordering: .acquiring), _mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) @@ -142,8 +126,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.exchange(_mraw1, ordering: .releasing), _mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) @@ -156,8 +139,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.exchange(_mraw1, ordering: .acquiringAndReleasing), _mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) @@ -170,8 +152,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) XCTAssertEqual(v.exchange(_mraw1, ordering: .sequentiallyConsistent), _mraw1) XCTAssertEqual(v.load(ordering: .relaxed), _mraw1) @@ -185,8 +166,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -222,8 +202,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -259,8 +238,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -296,8 +274,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -333,8 +310,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -370,8 +346,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -407,8 +382,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -444,8 +418,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -481,8 +454,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -518,8 +490,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -556,8 +527,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -597,8 +567,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -638,8 +607,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -679,8 +647,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -720,8 +687,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -761,8 +727,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -802,8 +767,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -843,8 +807,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -884,8 +847,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -925,8 +887,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -966,8 +927,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -1007,8 +967,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -1048,8 +1007,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -1089,8 +1047,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -1130,8 +1087,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.compareExchange( expected: _mraw1, @@ -1171,8 +1127,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1212,8 +1167,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1253,8 +1207,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1294,8 +1247,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1335,8 +1287,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1376,8 +1327,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1417,8 +1367,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1458,8 +1407,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1499,8 +1447,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1540,8 +1487,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1581,8 +1527,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1622,8 +1567,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1663,8 +1607,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1704,8 +1647,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, @@ -1745,8 +1687,7 @@ class BasicAtomicMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_mraw1) - defer { v.destroy() } + let v = Atomic(_mraw1) var (exchanged, original): (Bool, UnsafeMutableRawPointer) = v.weakCompareExchange( expected: _mraw1, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutablePointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutablePointerTests.swift index f61687d..296d2ac 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutablePointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutablePointerTests.swift @@ -47,86 +47,71 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } func test_load_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) XCTAssertEqual(w.load(ordering: .relaxed), _mfoo2) } func test_load_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) XCTAssertEqual(w.load(ordering: .acquiring), _mfoo2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mfoo2) } func test_store_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_mfoo2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) w.store(nil, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_mfoo2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) w.store(nil, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_mfoo2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _mfoo2) - let w: UnsafeAtomic?> = .create(_mfoo2) - defer { w.destroy() } + let w = Atomic?>(_mfoo2) w.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_exchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -139,8 +124,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -153,8 +137,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -167,8 +150,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -181,8 +163,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -196,8 +177,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -233,8 +213,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -270,8 +249,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -307,8 +285,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -344,8 +321,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -381,8 +357,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -418,8 +393,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -455,8 +429,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -492,8 +465,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -529,8 +501,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -567,8 +538,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -608,8 +578,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -649,8 +618,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -690,8 +658,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -731,8 +698,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -772,8 +738,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -813,8 +778,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -854,8 +818,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -895,8 +858,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -936,8 +898,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -977,8 +938,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -1018,8 +978,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -1059,8 +1018,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -1100,8 +1058,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -1141,8 +1098,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.compareExchange( expected: nil, @@ -1182,8 +1138,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1223,8 +1178,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1264,8 +1218,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1305,8 +1258,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1346,8 +1298,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1387,8 +1338,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1428,8 +1378,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1469,8 +1418,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1510,8 +1458,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1551,8 +1498,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1592,8 +1538,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1633,8 +1578,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1674,8 +1618,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1715,8 +1658,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, @@ -1756,8 +1698,7 @@ class BasicAtomicOptionalMutablePointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafeMutablePointer?) = v.weakCompareExchange( expected: nil, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutableRawPointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutableRawPointerTests.swift index 9eb8929..15bb37b 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutableRawPointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalMutableRawPointerTests.swift @@ -36,86 +36,71 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .relaxed), _mraw2) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .acquiring), _mraw2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _mraw2) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_mraw2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) w.store(nil, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_mraw2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) w.store(nil, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_mraw2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _mraw2) - let w: UnsafeAtomic = .create(_mraw2) - defer { w.destroy() } + let w = Atomic(_mraw2) w.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -128,8 +113,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -142,8 +126,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -156,8 +139,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -170,8 +152,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -185,8 +166,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -222,8 +202,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -259,8 +238,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -296,8 +274,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -333,8 +310,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -370,8 +346,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -407,8 +382,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -444,8 +418,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -481,8 +454,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -518,8 +490,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -556,8 +527,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -597,8 +567,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -638,8 +607,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -679,8 +647,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -720,8 +687,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -761,8 +727,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -802,8 +767,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -843,8 +807,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -884,8 +847,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -925,8 +887,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -966,8 +927,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -1007,8 +967,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -1048,8 +1007,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -1089,8 +1047,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -1130,8 +1087,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.compareExchange( expected: nil, @@ -1171,8 +1127,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1212,8 +1167,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1253,8 +1207,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1294,8 +1247,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1335,8 +1287,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1376,8 +1327,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1417,8 +1367,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1458,8 +1407,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1499,8 +1447,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1540,8 +1487,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1581,8 +1527,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1622,8 +1567,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1663,8 +1607,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1704,8 +1647,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1745,8 +1687,7 @@ class BasicAtomicOptionalMutableRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeMutableRawPointer?) = v.weakCompareExchange( expected: nil, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalPointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalPointerTests.swift index 7e5a58e..97c9735 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalPointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalPointerTests.swift @@ -47,86 +47,71 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } func test_load_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } func test_load_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) XCTAssertEqual(w.load(ordering: .acquiring), _foo2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _foo2) } func test_store_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_foo2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) w.store(nil, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_foo2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) w.store(nil, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_foo2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w: UnsafeAtomic?> = .create(_foo2) - defer { w.destroy() } + let w = Atomic?>(_foo2) w.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_exchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -139,8 +124,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -153,8 +137,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -167,8 +150,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -181,8 +163,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -196,8 +177,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -233,8 +213,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -270,8 +249,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -307,8 +285,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -344,8 +321,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -381,8 +357,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -418,8 +393,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -455,8 +429,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -492,8 +465,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -529,8 +501,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -567,8 +538,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -608,8 +578,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -649,8 +618,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -690,8 +658,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -731,8 +698,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -772,8 +738,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -813,8 +778,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -854,8 +818,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -895,8 +858,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -936,8 +898,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -977,8 +938,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -1018,8 +978,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -1059,8 +1018,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -1100,8 +1058,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -1141,8 +1098,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.compareExchange( expected: nil, @@ -1182,8 +1138,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1223,8 +1178,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1264,8 +1218,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1305,8 +1258,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1346,8 +1298,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1387,8 +1338,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1428,8 +1378,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1469,8 +1418,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1510,8 +1458,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1551,8 +1498,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1592,8 +1538,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1633,8 +1578,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1674,8 +1618,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1715,8 +1658,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, @@ -1756,8 +1698,7 @@ class BasicAtomicOptionalPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, UnsafePointer?) = v.weakCompareExchange( expected: nil, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawPointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawPointerTests.swift index 4a36fe0..7dad84a 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawPointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawPointerTests.swift @@ -36,86 +36,71 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .acquiring), _raw2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _raw2) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_raw2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) w.store(nil, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_raw2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) w.store(nil, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_raw2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) w.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -128,8 +113,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -142,8 +126,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -156,8 +139,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -170,8 +152,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -185,8 +166,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -222,8 +202,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -259,8 +238,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -296,8 +274,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -333,8 +310,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -370,8 +346,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -407,8 +382,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -444,8 +418,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -481,8 +454,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -518,8 +490,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -556,8 +527,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -597,8 +567,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -638,8 +607,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -679,8 +647,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -720,8 +687,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -761,8 +727,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -802,8 +767,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -843,8 +807,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -884,8 +847,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -925,8 +887,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -966,8 +927,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -1007,8 +967,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -1048,8 +1007,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -1089,8 +1047,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -1130,8 +1087,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.compareExchange( expected: nil, @@ -1171,8 +1127,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1212,8 +1167,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1253,8 +1207,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1294,8 +1247,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1335,8 +1287,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1376,8 +1327,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1417,8 +1367,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1458,8 +1407,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1499,8 +1447,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1540,8 +1487,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1581,8 +1527,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1622,8 +1567,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1663,8 +1607,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1704,8 +1647,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, @@ -1745,8 +1687,7 @@ class BasicAtomicOptionalRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, UnsafeRawPointer?) = v.weakCompareExchange( expected: nil, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawRepresentableTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawRepresentableTests.swift index 4ba56a6..c98f794 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawRepresentableTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalRawRepresentableTests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicOptionalRawRepresentableTests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .acquiring), Hyacinth.bucket) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) XCTAssertEqual(w.load(ordering: .acquiring), nil) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), Hyacinth.bucket) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), nil) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) v.store(nil, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) w.store(Hyacinth.bucket, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), Hyacinth.bucket) } func test_store_releasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) v.store(nil, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) w.store(Hyacinth.bucket, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), Hyacinth.bucket) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) v.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(nil) - defer { w.destroy() } + let w = Atomic(nil) w.store(Hyacinth.bucket, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), Hyacinth.bucket) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.exchange(Hyacinth.bucket, ordering: .relaxed), Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) @@ -118,8 +103,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.exchange(Hyacinth.bucket, ordering: .acquiring), Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) @@ -132,8 +116,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.exchange(Hyacinth.bucket, ordering: .releasing), Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) @@ -146,8 +129,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.exchange(Hyacinth.bucket, ordering: .acquiringAndReleasing), Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) @@ -160,8 +142,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) XCTAssertEqual(v.exchange(Hyacinth.bucket, ordering: .sequentiallyConsistent), Hyacinth.bucket) XCTAssertEqual(v.load(ordering: .relaxed), Hyacinth.bucket) @@ -175,8 +156,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -212,8 +192,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -249,8 +228,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -286,8 +264,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -323,8 +300,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -360,8 +336,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -397,8 +372,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -434,8 +408,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -471,8 +444,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -508,8 +480,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -546,8 +517,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -587,8 +557,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -628,8 +597,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -669,8 +637,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -710,8 +677,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -751,8 +717,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -792,8 +757,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -833,8 +797,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -874,8 +837,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -915,8 +877,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -956,8 +917,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -997,8 +957,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -1038,8 +997,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -1079,8 +1037,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -1120,8 +1077,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.compareExchange( expected: Hyacinth.bucket, @@ -1161,8 +1117,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1202,8 +1157,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1243,8 +1197,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1284,8 +1237,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1325,8 +1277,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1366,8 +1317,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1407,8 +1357,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1448,8 +1397,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1489,8 +1437,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1530,8 +1477,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1571,8 +1517,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1612,8 +1557,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1653,8 +1597,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1694,8 +1637,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, @@ -1735,8 +1677,7 @@ class BasicAtomicOptionalRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Hyacinth.bucket) - defer { v.destroy() } + let v = Atomic(Hyacinth.bucket) var (exchanged, original): (Bool, Hyacinth?) = v.weakCompareExchange( expected: Hyacinth.bucket, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalReferenceTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalReferenceTests.swift index 0df9852..65a6b51 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalReferenceTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalReferenceTests.swift @@ -28,86 +28,71 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { private let _baz2 = Baz(2) func test_create_destroy() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .acquiring), _baz2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _baz2) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_baz2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) w.store(nil, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_baz2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) w.store(nil, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) v.store(_baz2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) w.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -120,8 +105,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -134,8 +118,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -148,8 +131,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -162,8 +144,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -177,8 +158,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -214,8 +194,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -251,8 +230,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -288,8 +266,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -325,8 +302,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -362,8 +338,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -399,8 +374,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -436,8 +410,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -473,8 +446,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -510,8 +482,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -548,8 +519,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -589,8 +559,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -630,8 +599,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -671,8 +639,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -712,8 +679,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -753,8 +719,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -794,8 +759,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -835,8 +799,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -876,8 +839,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -917,8 +879,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -958,8 +919,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -999,8 +959,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -1040,8 +999,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -1081,8 +1039,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -1122,8 +1079,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.compareExchange( expected: nil, @@ -1163,8 +1119,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1204,8 +1159,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1245,8 +1199,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1286,8 +1239,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1327,8 +1279,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1368,8 +1319,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1409,8 +1359,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1450,8 +1399,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1491,8 +1439,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1532,8 +1479,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1573,8 +1519,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1614,8 +1559,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1655,8 +1599,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1696,8 +1639,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, @@ -1737,8 +1679,7 @@ class BasicAtomicOptionalReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(nil) - defer { v.destroy() } + let v = Atomic(nil) var (exchanged, original): (Bool, Baz?) = v.weakCompareExchange( expected: nil, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalUnmanagedTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalUnmanagedTests.swift index 17bb682..d347970 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalUnmanagedTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicOptionalUnmanagedTests.swift @@ -33,86 +33,71 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } func test_load_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } func test_load_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .acquiring), nil) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) XCTAssertEqual(w.load(ordering: .acquiring), _bar2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), nil) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _bar2) } func test_store_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_bar2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) w.store(nil, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_bar2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) w.store(nil, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) v.store(_bar2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w: UnsafeAtomic?> = .create(_bar2) - defer { w.destroy() } + let w = Atomic?>(_bar2) w.store(nil, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), nil) } func test_exchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .relaxed), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -125,8 +110,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiring), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -139,8 +123,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .releasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -153,8 +136,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .acquiringAndReleasing), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -167,8 +149,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) XCTAssertEqual(v.exchange(nil, ordering: .sequentiallyConsistent), nil) XCTAssertEqual(v.load(ordering: .relaxed), nil) @@ -182,8 +163,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -219,8 +199,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -256,8 +235,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -293,8 +271,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -330,8 +307,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -367,8 +343,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -404,8 +379,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -441,8 +415,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -478,8 +451,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -515,8 +487,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -553,8 +524,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -594,8 +564,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -635,8 +604,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -676,8 +644,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -717,8 +684,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -758,8 +724,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -799,8 +764,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -840,8 +804,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -881,8 +844,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -922,8 +884,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -963,8 +924,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -1004,8 +964,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -1045,8 +1004,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -1086,8 +1044,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -1127,8 +1084,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.compareExchange( expected: nil, @@ -1168,8 +1124,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1209,8 +1164,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1250,8 +1204,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1291,8 +1244,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1332,8 +1284,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1373,8 +1324,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1414,8 +1364,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1455,8 +1404,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1496,8 +1444,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1537,8 +1484,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1578,8 +1524,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1619,8 +1564,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1660,8 +1604,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1701,8 +1644,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, @@ -1742,8 +1684,7 @@ class BasicAtomicOptionalUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic?> = .create(nil) - defer { v.destroy() } + let v = Atomic?>(nil) var (exchanged, original): (Bool, Unmanaged?) = v.weakCompareExchange( expected: nil, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicPointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicPointerTests.swift index b1cb328..4b91696 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicPointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicPointerTests.swift @@ -47,86 +47,71 @@ class BasicAtomicPointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } func test_load_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) XCTAssertEqual(w.load(ordering: .relaxed), _foo2) } func test_load_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.load(ordering: .acquiring), _foo1) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) XCTAssertEqual(w.load(ordering: .acquiring), _foo2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _foo1) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _foo2) } func test_store_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) v.store(_foo2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) w.store(_foo1, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), _foo1) } func test_store_releasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) v.store(_foo2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) w.store(_foo1, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), _foo1) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) v.store(_foo2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _foo2) - let w: UnsafeAtomic> = .create(_foo2) - defer { w.destroy() } + let w = Atomic>(_foo2) w.store(_foo1, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), _foo1) } func test_exchange_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.exchange(_foo1, ordering: .relaxed), _foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) @@ -139,8 +124,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.exchange(_foo1, ordering: .acquiring), _foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) @@ -153,8 +137,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.exchange(_foo1, ordering: .releasing), _foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) @@ -167,8 +150,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.exchange(_foo1, ordering: .acquiringAndReleasing), _foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) @@ -181,8 +163,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) XCTAssertEqual(v.exchange(_foo1, ordering: .sequentiallyConsistent), _foo1) XCTAssertEqual(v.load(ordering: .relaxed), _foo1) @@ -196,8 +177,7 @@ class BasicAtomicPointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -233,8 +213,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -270,8 +249,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -307,8 +285,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -344,8 +321,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -381,8 +357,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -418,8 +393,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -455,8 +429,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -492,8 +465,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -529,8 +501,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -567,8 +538,7 @@ class BasicAtomicPointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -608,8 +578,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -649,8 +618,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -690,8 +658,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -731,8 +698,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -772,8 +738,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -813,8 +778,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -854,8 +818,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -895,8 +858,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -936,8 +898,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -977,8 +938,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -1018,8 +978,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -1059,8 +1018,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -1100,8 +1058,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -1141,8 +1098,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.compareExchange( expected: _foo1, @@ -1182,8 +1138,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1223,8 +1178,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1264,8 +1218,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1305,8 +1258,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1346,8 +1298,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1387,8 +1338,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1428,8 +1378,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1469,8 +1418,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1510,8 +1458,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1551,8 +1498,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1592,8 +1538,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1633,8 +1578,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1674,8 +1618,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1715,8 +1658,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, @@ -1756,8 +1698,7 @@ class BasicAtomicPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_foo1) - defer { v.destroy() } + let v = Atomic>(_foo1) var (exchanged, original): (Bool, UnsafePointer) = v.weakCompareExchange( expected: _foo1, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawPointerTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawPointerTests.swift index 157ea7e..55bafd4 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawPointerTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawPointerTests.swift @@ -36,86 +36,71 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .relaxed), _raw2) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.load(ordering: .acquiring), _raw1) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .acquiring), _raw2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _raw1) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _raw2) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) v.store(_raw2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) w.store(_raw1, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), _raw1) } func test_store_releasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) v.store(_raw2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) w.store(_raw1, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), _raw1) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) v.store(_raw2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _raw2) - let w: UnsafeAtomic = .create(_raw2) - defer { w.destroy() } + let w = Atomic(_raw2) w.store(_raw1, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), _raw1) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.exchange(_raw1, ordering: .relaxed), _raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) @@ -128,8 +113,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.exchange(_raw1, ordering: .acquiring), _raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) @@ -142,8 +126,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.exchange(_raw1, ordering: .releasing), _raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) @@ -156,8 +139,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.exchange(_raw1, ordering: .acquiringAndReleasing), _raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) @@ -170,8 +152,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) XCTAssertEqual(v.exchange(_raw1, ordering: .sequentiallyConsistent), _raw1) XCTAssertEqual(v.load(ordering: .relaxed), _raw1) @@ -185,8 +166,7 @@ class BasicAtomicRawPointerTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -222,8 +202,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -259,8 +238,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -296,8 +274,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -333,8 +310,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -370,8 +346,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -407,8 +382,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -444,8 +418,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -481,8 +454,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -518,8 +490,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -556,8 +527,7 @@ class BasicAtomicRawPointerTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -597,8 +567,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -638,8 +607,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -679,8 +647,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -720,8 +687,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -761,8 +727,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -802,8 +767,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -843,8 +807,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -884,8 +847,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -925,8 +887,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -966,8 +927,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -1007,8 +967,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -1048,8 +1007,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -1089,8 +1047,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -1130,8 +1087,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.compareExchange( expected: _raw1, @@ -1171,8 +1127,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1212,8 +1167,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1253,8 +1207,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1294,8 +1247,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1335,8 +1287,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1376,8 +1327,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1417,8 +1367,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1458,8 +1407,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1499,8 +1447,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1540,8 +1487,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1581,8 +1527,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1622,8 +1567,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1663,8 +1607,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1704,8 +1647,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, @@ -1745,8 +1687,7 @@ class BasicAtomicRawPointerTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_raw1) - defer { v.destroy() } + let v = Atomic(_raw1) var (exchanged, original): (Bool, UnsafeRawPointer) = v.weakCompareExchange( expected: _raw1, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawRepresentableTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawRepresentableTests.swift index fc0dcd6..1ab8293 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawRepresentableTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicRawRepresentableTests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicRawRepresentableTests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) XCTAssertEqual(w.load(ordering: .relaxed), Fred.two) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) XCTAssertEqual(w.load(ordering: .relaxed), Fred.two) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.load(ordering: .acquiring), Fred.one) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) XCTAssertEqual(w.load(ordering: .acquiring), Fred.two) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), Fred.one) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), Fred.two) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) v.store(Fred.two, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) 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() } + let v = Atomic(Fred.one) v.store(Fred.two, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) 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() } + let v = Atomic(Fred.one) v.store(Fred.two, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), Fred.two) - let w: UnsafeAtomic = .create(Fred.two) - defer { w.destroy() } + let w = Atomic(Fred.two) 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() } + let v = Atomic(Fred.one) XCTAssertEqual(v.exchange(Fred.one, ordering: .relaxed), Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) @@ -118,8 +103,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.exchange(Fred.one, ordering: .acquiring), Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) @@ -132,8 +116,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.exchange(Fred.one, ordering: .releasing), Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) @@ -146,8 +129,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.exchange(Fred.one, ordering: .acquiringAndReleasing), Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) @@ -160,8 +142,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) XCTAssertEqual(v.exchange(Fred.one, ordering: .sequentiallyConsistent), Fred.one) XCTAssertEqual(v.load(ordering: .relaxed), Fred.one) @@ -175,8 +156,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -212,8 +192,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -249,8 +228,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -286,8 +264,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -323,8 +300,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -360,8 +336,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -397,8 +372,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -434,8 +408,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -471,8 +444,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -508,8 +480,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -546,8 +517,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -587,8 +557,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -628,8 +597,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -669,8 +637,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -710,8 +677,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -751,8 +717,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -792,8 +757,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -833,8 +797,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -874,8 +837,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -915,8 +877,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -956,8 +917,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -997,8 +957,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -1038,8 +997,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -1079,8 +1037,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -1120,8 +1077,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.compareExchange( expected: Fred.one, @@ -1161,8 +1117,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1202,8 +1157,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1243,8 +1197,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1284,8 +1237,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1325,8 +1277,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1366,8 +1317,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1407,8 +1357,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1448,8 +1397,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1489,8 +1437,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1530,8 +1477,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1571,8 +1517,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1612,8 +1557,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1653,8 +1597,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1694,8 +1637,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, @@ -1735,8 +1677,7 @@ class BasicAtomicRawRepresentableTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(Fred.one) - defer { v.destroy() } + let v = Atomic(Fred.one) var (exchanged, original): (Bool, Fred) = v.weakCompareExchange( expected: Fred.one, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicReferenceTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicReferenceTests.swift index 65883e0..53542c4 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicReferenceTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicReferenceTests.swift @@ -28,86 +28,71 @@ class BasicAtomicReferenceTests: XCTestCase { private let _baz2 = Baz(2) func test_create_destroy() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .relaxed), _baz2) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.load(ordering: .acquiring), _baz1) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .acquiring), _baz2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _baz1) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _baz2) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) v.store(_baz2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) w.store(_baz1, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), _baz1) } func test_store_releasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) v.store(_baz2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) w.store(_baz1, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), _baz1) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) v.store(_baz2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _baz2) - let w: UnsafeAtomic = .create(_baz2) - defer { w.destroy() } + let w = Atomic(_baz2) w.store(_baz1, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), _baz1) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.exchange(_baz1, ordering: .relaxed), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) @@ -120,8 +105,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.exchange(_baz1, ordering: .acquiring), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) @@ -134,8 +118,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.exchange(_baz1, ordering: .releasing), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) @@ -148,8 +131,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.exchange(_baz1, ordering: .acquiringAndReleasing), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) @@ -162,8 +144,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) XCTAssertEqual(v.exchange(_baz1, ordering: .sequentiallyConsistent), _baz1) XCTAssertEqual(v.load(ordering: .relaxed), _baz1) @@ -177,8 +158,7 @@ class BasicAtomicReferenceTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -214,8 +194,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -251,8 +230,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -288,8 +266,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -325,8 +302,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -362,8 +338,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -399,8 +374,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -436,8 +410,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -473,8 +446,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -510,8 +482,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -548,8 +519,7 @@ class BasicAtomicReferenceTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -589,8 +559,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -630,8 +599,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -671,8 +639,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -712,8 +679,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -753,8 +719,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -794,8 +759,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -835,8 +799,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -876,8 +839,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -917,8 +879,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -958,8 +919,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -999,8 +959,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -1040,8 +999,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -1081,8 +1039,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -1122,8 +1079,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.compareExchange( expected: _baz1, @@ -1163,8 +1119,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1204,8 +1159,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1245,8 +1199,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1286,8 +1239,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1327,8 +1279,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1368,8 +1319,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1409,8 +1359,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1450,8 +1399,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1491,8 +1439,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1532,8 +1479,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1573,8 +1519,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1614,8 +1559,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1655,8 +1599,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1696,8 +1639,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, @@ -1737,8 +1679,7 @@ class BasicAtomicReferenceTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(_baz1) - defer { v.destroy() } + let v = Atomic(_baz1) var (exchanged, original): (Bool, Baz) = v.weakCompareExchange( expected: _baz1, diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt16Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt16Tests.swift index cf233db..5272ae0 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt16Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt16Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicUInt16Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicUInt16Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicUInt16Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicUInt16Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt16) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt16 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &+ b let result2: UInt16 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a &- b let result2: UInt16 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a & b let result2: UInt16 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a | b let result2: UInt16 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicUInt16Tests: XCTestCase { let result1: UInt16 = a ^ b let result2: UInt16 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt16 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt32Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt32Tests.swift index a62d823..1b1aaf3 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt32Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt32Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicUInt32Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicUInt32Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicUInt32Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicUInt32Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt32) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt32 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &+ b let result2: UInt32 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a &- b let result2: UInt32 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a & b let result2: UInt32 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a | b let result2: UInt32 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicUInt32Tests: XCTestCase { let result1: UInt32 = a ^ b let result2: UInt32 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt32 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt64Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt64Tests.swift index 4dfd806..958f1db 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt64Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt64Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicUInt64Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicUInt64Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicUInt64Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicUInt64Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt64) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt64 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &+ b let result2: UInt64 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a &- b let result2: UInt64 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a & b let result2: UInt64 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a | b let result2: UInt64 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicUInt64Tests: XCTestCase { let result1: UInt64 = a ^ b let result2: UInt64 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt64 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt8Tests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt8Tests.swift index ca8ecc9..8b95a36 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt8Tests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUInt8Tests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicUInt8Tests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicUInt8Tests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicUInt8Tests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicUInt8Tests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt8) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt8 = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &+ b let result2: UInt8 = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a &- b let result2: UInt8 = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a & b let result2: UInt8 = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a | b let result2: UInt8 = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicUInt8Tests: XCTestCase { let result1: UInt8 = a ^ b let result2: UInt8 = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt8 = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUIntTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUIntTests.swift index 067adcb..df2cff1 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUIntTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUIntTests.swift @@ -26,86 +26,71 @@ import Atomics class BasicAtomicUIntTests: XCTestCase { func test_create_destroy() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .relaxed), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .relaxed), 23) } func test_load_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .acquiring), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .acquiring), 23) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), 12) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), 23) } func test_store_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) v.store(23, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), 23) - let w: UnsafeAtomic = .create(23) - defer { w.destroy() } + let w = Atomic(23) w.store(12, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), 12) } func test_exchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .relaxed), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -118,8 +103,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiring), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -132,8 +116,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .releasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -146,8 +129,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .acquiringAndReleasing), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -160,8 +142,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) XCTAssertEqual(v.exchange(12, ordering: .sequentiallyConsistent), 12) XCTAssertEqual(v.load(ordering: .relaxed), 12) @@ -175,8 +156,7 @@ class BasicAtomicUIntTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -212,8 +192,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -249,8 +228,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -286,8 +264,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -323,8 +300,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -360,8 +336,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -397,8 +372,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -434,8 +408,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -471,8 +444,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -508,8 +480,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -546,8 +517,7 @@ class BasicAtomicUIntTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -587,8 +557,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -628,8 +597,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -669,8 +637,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -710,8 +677,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -751,8 +717,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -792,8 +757,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -833,8 +797,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -874,8 +837,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -915,8 +877,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -956,8 +917,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -997,8 +957,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -1038,8 +997,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -1079,8 +1037,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -1120,8 +1077,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.compareExchange( expected: 12, @@ -1161,8 +1117,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1202,8 +1157,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1243,8 +1197,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1284,8 +1237,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1325,8 +1277,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1366,8 +1317,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1407,8 +1357,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1448,8 +1397,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1489,8 +1437,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1530,8 +1477,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1571,8 +1517,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1612,8 +1557,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1653,8 +1597,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1694,8 +1637,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1735,8 +1677,7 @@ class BasicAtomicUIntTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic = .create(12) - defer { v.destroy() } + let v = Atomic(12) var (exchanged, original): (Bool, UInt) = v.weakCompareExchange( expected: 12, @@ -1786,8 +1727,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingIncrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1805,8 +1745,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingIncrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1824,8 +1763,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingIncrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1843,8 +1781,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingIncrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1862,8 +1799,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingIncrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1881,8 +1817,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingDecrement(by: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1900,8 +1835,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingDecrement(by: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -1919,8 +1853,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingDecrement(by: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -1938,8 +1871,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingDecrement(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -1957,8 +1889,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenWrappingDecrement(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -1976,8 +1907,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseAnd(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -1995,8 +1925,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseAnd(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2014,8 +1943,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseAnd(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2033,8 +1961,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseAnd(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2052,8 +1979,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseAnd(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2071,8 +1997,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseOr(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2090,8 +2015,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseOr(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2109,8 +2033,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseOr(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2128,8 +2051,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseOr(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2147,8 +2069,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseOr(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2166,8 +2087,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseXor(with: b, ordering: .relaxed) XCTAssertEqual(old1, a) @@ -2185,8 +2105,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseXor(with: b, ordering: .acquiring) XCTAssertEqual(old1, a) @@ -2204,8 +2123,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseXor(with: b, ordering: .releasing) XCTAssertEqual(old1, a) @@ -2223,8 +2141,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseXor(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(old1, a) @@ -2242,8 +2159,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let old1: UInt = v.loadThenBitwiseXor(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(old1, a) @@ -2262,8 +2178,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingIncrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2281,8 +2196,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingIncrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2300,8 +2214,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingIncrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2319,8 +2232,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingIncrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2338,8 +2250,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &+ b let result2: UInt = result1 &+ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingIncrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2357,8 +2268,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingDecrementThenLoad(by: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2376,8 +2286,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingDecrementThenLoad(by: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2395,8 +2304,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingDecrementThenLoad(by: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2414,8 +2322,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingDecrementThenLoad(by: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2433,8 +2340,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a &- b let result2: UInt = result1 &- c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.wrappingDecrementThenLoad(by: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2452,8 +2358,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseAndThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2471,8 +2376,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseAndThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2490,8 +2394,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseAndThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2509,8 +2412,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseAndThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2528,8 +2430,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a & b let result2: UInt = result1 & c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseAndThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2547,8 +2448,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseOrThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2566,8 +2466,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseOrThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2585,8 +2484,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseOrThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2604,8 +2502,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseOrThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2623,8 +2520,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a | b let result2: UInt = result1 | c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseOrThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) @@ -2642,8 +2538,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseXorThenLoad(with: b, ordering: .relaxed) XCTAssertEqual(new1, result1) @@ -2661,8 +2556,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseXorThenLoad(with: b, ordering: .acquiring) XCTAssertEqual(new1, result1) @@ -2680,8 +2574,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseXorThenLoad(with: b, ordering: .releasing) XCTAssertEqual(new1, result1) @@ -2699,8 +2592,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseXorThenLoad(with: b, ordering: .acquiringAndReleasing) XCTAssertEqual(new1, result1) @@ -2718,8 +2610,7 @@ class BasicAtomicUIntTests: XCTestCase { let result1: UInt = a ^ b let result2: UInt = result1 ^ c - let v: UnsafeAtomic = .create(a) - defer { v.destroy() } + let v = Atomic(a) let new1: UInt = v.bitwiseXorThenLoad(with: b, ordering: .sequentiallyConsistent) XCTAssertEqual(new1, result1) diff --git a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUnmanagedTests.swift b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUnmanagedTests.swift index 35d846b..26206e8 100644 --- a/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUnmanagedTests.swift +++ b/Tests/AtomicsTests/Basics/autogenerated/BasicAtomicUnmanagedTests.swift @@ -33,86 +33,71 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_create_destroy() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } func test_load_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) XCTAssertEqual(w.load(ordering: .relaxed), _bar2) } func test_load_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.load(ordering: .acquiring), _bar1) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) XCTAssertEqual(w.load(ordering: .acquiring), _bar2) } func test_load_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.load(ordering: .sequentiallyConsistent), _bar1) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) XCTAssertEqual(w.load(ordering: .sequentiallyConsistent), _bar2) } func test_store_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) v.store(_bar2, ordering: .relaxed) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) w.store(_bar1, ordering: .relaxed) XCTAssertEqual(w.load(ordering: .relaxed), _bar1) } func test_store_releasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) v.store(_bar2, ordering: .releasing) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) w.store(_bar1, ordering: .releasing) XCTAssertEqual(w.load(ordering: .relaxed), _bar1) } func test_store_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) v.store(_bar2, ordering: .sequentiallyConsistent) XCTAssertEqual(v.load(ordering: .relaxed), _bar2) - let w: UnsafeAtomic> = .create(_bar2) - defer { w.destroy() } + let w = Atomic>(_bar2) w.store(_bar1, ordering: .sequentiallyConsistent) XCTAssertEqual(w.load(ordering: .relaxed), _bar1) } func test_exchange_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.exchange(_bar1, ordering: .relaxed), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) @@ -125,8 +110,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_exchange_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.exchange(_bar1, ordering: .acquiring), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) @@ -139,8 +123,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_exchange_releasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.exchange(_bar1, ordering: .releasing), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) @@ -153,8 +136,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_exchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.exchange(_bar1, ordering: .acquiringAndReleasing), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) @@ -167,8 +149,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_exchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) XCTAssertEqual(v.exchange(_bar1, ordering: .sequentiallyConsistent), _bar1) XCTAssertEqual(v.load(ordering: .relaxed), _bar1) @@ -182,8 +163,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { func test_compareExchange_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -219,8 +199,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -256,8 +235,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_releasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -293,8 +271,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -330,8 +307,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -367,8 +343,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -404,8 +379,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -441,8 +415,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -478,8 +451,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -515,8 +487,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -553,8 +524,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { func test_compareExchange_relaxed_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -594,8 +564,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_relaxed_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -635,8 +604,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -676,8 +644,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -717,8 +684,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -758,8 +724,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -799,8 +764,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_releasing_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -840,8 +804,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_releasing_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -881,8 +844,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -922,8 +884,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -963,8 +924,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -1004,8 +964,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -1045,8 +1004,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -1086,8 +1044,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -1127,8 +1084,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_compareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.compareExchange( expected: _bar1, @@ -1168,8 +1124,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1209,8 +1164,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1250,8 +1204,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_relaxed_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1291,8 +1244,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1332,8 +1284,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1373,8 +1324,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiring_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1414,8 +1364,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1455,8 +1404,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1496,8 +1444,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_releasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1537,8 +1484,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1578,8 +1524,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1619,8 +1564,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_acquiringAndReleasing_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1660,8 +1604,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_relaxed() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1701,8 +1644,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_acquiring() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1, @@ -1742,8 +1684,7 @@ class BasicAtomicUnmanagedTests: XCTestCase { } func test_weakCompareExchange_sequentiallyConsistent_sequentiallyConsistent() { - let v: UnsafeAtomic> = .create(_bar1) - defer { v.destroy() } + let v = Atomic>(_bar1) var (exchanged, original): (Bool, Unmanaged) = v.weakCompareExchange( expected: _bar1,