mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-23 11:26:54 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
40 lines
932 B
Swift
40 lines
932 B
Swift
//
|
|
// AtomicTests.swift
|
|
//
|
|
//
|
|
// Created by Vladislav Lisianskii on 27.03.2022.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import XcodeGenCore
|
|
|
|
final class AtomicTests: XCTestCase {
|
|
|
|
@Atomic private var atomicDictionary = [String: Int]()
|
|
|
|
func testSimultaneousWriteOrder() {
|
|
let group = DispatchGroup()
|
|
|
|
for index in (0..<100) {
|
|
group.enter()
|
|
DispatchQueue.global().async {
|
|
self.$atomicDictionary.with { atomicDictionary in
|
|
atomicDictionary["\(index)"] = index
|
|
}
|
|
group.leave()
|
|
}
|
|
}
|
|
|
|
group.notify(queue: .main, execute: {
|
|
var expectedValue = [String: Int]()
|
|
for index in (0..<100) {
|
|
expectedValue["\(index)"] = index
|
|
}
|
|
XCTAssertEqual(
|
|
self.atomicDictionary,
|
|
expectedValue
|
|
)
|
|
})
|
|
}
|
|
}
|