import Observation import XCTest @testable import OldFella actor OverlapGate { private var waits: [CheckedContinuation] = [] private var observer: CheckedContinuation? func wait() async { await withCheckedContinuation { continuation in waits.append(continuation) if waits.count == 2 { observer?.resume() observer = nil } } } func waitForCount(_ count: Int) async { while waits.count < count { await Task.yield() } } func releaseFirst() { waits.removeFirst().resume() } }