File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Tests/SwiftAlgorithmsTests Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 10
10
//===----------------------------------------------------------------------===//
11
11
12
12
import XCTest
13
- import Algorithms
13
+ @ testable import Algorithms
14
14
15
15
func validateRandomSamples< S: Sequence > (
16
16
_ samples: [ Int : Int ] ,
@@ -96,8 +96,13 @@ final class RandomSampleTests: XCTestCase {
96
96
XCTAssertEqual ( sample1c, sample2c)
97
97
}
98
98
99
- func testRandomSampleZeroRandom( ) {
100
- var generator = SplitMix64 ( seed: 0x61c8864680b583eb ) // this seed starts with 0
101
- _ = c. randomSample ( count: k, using: & generator) // must not crash
99
+ func testRandomSampleRandomEdgeCasesInternal( ) {
100
+ struct ZeroGenerator : RandomNumberGenerator {
101
+ mutating func next( ) -> UInt64 { 0 }
102
+ }
103
+ var zero = ZeroGenerator ( )
104
+ XCTAssertGreaterThan ( nextW ( k: 1 , using: & zero) , 0 )
105
+ XCTAssertGreaterThan ( nextW ( k: k, using: & zero) , 0 )
106
+ _ = nextOffset ( w: 1 , using: & zero) // must not crash
102
107
}
103
108
}
You can’t perform that action at this time.
0 commit comments