mirror of
https://github.com/apple/swift-async-algorithms
synced 2026-11-26 04:37:48 +00:00
* Add a detailed proposal like guide for MarbleDiagram * Slight spacing change Co-authored-by: kperryua <kperry@apple.com> * Fix some pluralization agreement Co-authored-by: kperryua <kperry@apple.com> * Clarify the testing of merge and add a future direction for unordered groups * rename the diagram system to a more general 'validate' based name * Spelling fixes * Grammar fixes for credits Co-authored-by: kperryua <kperry@apple.com>
63 lines
1.9 KiB
Swift
63 lines
1.9 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift Async Algorithms open source project
|
|
//
|
|
// Copyright (c) 2022 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import _CAsyncSequenceValidationSupport
|
|
|
|
@resultBuilder
|
|
public struct AsyncSequenceValidationDiagram : Sendable {
|
|
public static func buildBlock<Operation: AsyncSequence>(
|
|
_ sequence: Operation,
|
|
_ output: String
|
|
) -> some AsyncSequenceValidationTest where Operation.Element == String {
|
|
return Test(inputs: [], sequence: sequence, output: output)
|
|
}
|
|
|
|
public static func buildBlock<Operation: AsyncSequence>(
|
|
_ input: String,
|
|
_ sequence: Operation,
|
|
_ output: String
|
|
) -> some AsyncSequenceValidationTest where Operation.Element == String {
|
|
return Test(inputs: [input], sequence: sequence, output: output)
|
|
}
|
|
|
|
public static func buildBlock<Operation: AsyncSequence>(
|
|
_ input1: String,
|
|
_ input2: String,
|
|
_ sequence: Operation,
|
|
_ output: String
|
|
) -> some AsyncSequenceValidationTest where Operation.Element == String {
|
|
Test(inputs: [input1, input2], sequence: sequence, output: output)
|
|
}
|
|
|
|
public static func buildBlock<Operation: AsyncSequence>(
|
|
_ input1: String,
|
|
_ input2: String,
|
|
_ input3: String,
|
|
_ sequence: Operation,
|
|
_ output: String
|
|
) -> some AsyncSequenceValidationTest where Operation.Element == String {
|
|
Test(inputs: [input1, input2, input3], sequence: sequence, output: output)
|
|
}
|
|
|
|
let queue: WorkQueue
|
|
|
|
public var inputs: InputList
|
|
public let clock: Clock
|
|
|
|
internal init() {
|
|
let queue = WorkQueue()
|
|
self.queue = queue
|
|
self.inputs = InputList(queue: queue)
|
|
self.clock = Clock(queue: queue)
|
|
}
|
|
}
|
|
|