35 lines
577 B
Swift
35 lines
577 B
Swift
//
|
|
// AtomicTests.swift
|
|
// ScheduleTests
|
|
//
|
|
// Created by Quentin Jin on 2018/7/27.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import Schedule
|
|
|
|
final class AtomicTests: XCTestCase {
|
|
|
|
func testRead() {
|
|
let atom = Atomic<Int>(1)
|
|
atom.read {
|
|
XCTAssertEqual($0, 1)
|
|
}
|
|
}
|
|
|
|
func testWrite() {
|
|
let atom = Atomic<Int>(1)
|
|
atom.write {
|
|
$0 = 2
|
|
}
|
|
atom.read {
|
|
XCTAssertEqual($0, 2)
|
|
}
|
|
}
|
|
|
|
static var allTests = [
|
|
("testRead", testRead),
|
|
("testWrite", testWrite)
|
|
]
|
|
}
|