//===----------------------------------------------------------------------===// // // This source file is part of the Swift Algorithms open source project // // Copyright (c) 2020 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 XCTest import Algorithms func validateRandomSamples( _ samples: [Int: Int], elements: S, expectedValue: Int, file: StaticString = #file, line: UInt = #line ) where S.Element == Int { let expectedRange = ((expectedValue / 3) * 2) ... ((expectedValue / 3) * 4) XCTAssertEqualSequences(samples.keys.sorted(), elements, file: file, line: line) for v in samples.values { XCTAssert(expectedRange.contains(v), file: file, line: line) } } private let n = 100 private let k = 12 private let iterations = 10_000 private let c = 0..