Files
Dimitris C cb72197f8e feature(Mp4): Support for non-optimised mp4 (#67)
* initial work for supporting non-optimised mp4

* Update AppCoordinator.swift

* some refactor and fixed seek for a restructured mp4

* nit

* nit

* nit

* runs swiftlint

* improvements

* improvements

* handles case where we the stream is not seekable for an mp4 file

* better check for mp4, seekable and moov atom

* nit

* fix an issue with seek

* some refactoring
2024-04-01 16:02:51 +03:00

38 lines
947 B
Swift

//
// Created by Dimitrios Chatzieleftheriou on 22/05/2020.
// Copyright © 2020 Decimal. All rights reserved.
//
import XCTest
@testable import AudioStreaming
class AtomicTests: XCTestCase {
func testProtectedValuesAreAccessedSafely() {
measure {
let atomic = Atomic<Int>(0)
DispatchQueue.concurrentPerform(iterations: 100_000) { _ in
_ = atomic.value
atomic.write { $0 += 1 }
}
XCTAssertEqual(atomic.value, 100_000)
}
}
func testThatProtectedReadAndWriteAreSafe() {
measure {
let initialValue = "aValue"
let protected = Atomic<String>(initialValue)
DispatchQueue.concurrentPerform(iterations: 1000) { i in
_ = protected.value
protected.write { $0 = "\(i)" }
}
XCTAssertNotEqual(protected.value, initialValue)
}
}
}