@@ -535,7 +535,7 @@ public func exists<A : Arbitrary>(_ gen : Gen<A>, pf : @escaping (A) throws -> T
535535
536536// MARK: - Implementation Details
537537
538- internal enum Result {
538+ internal enum QuickCheckResult {
539539 case success(
540540 numTests : Int ,
541541 labels : [ ( String , Int ) ] ,
@@ -585,7 +585,7 @@ private indirect enum Either<L, R> {
585585 case right( R )
586586}
587587
588- internal func quickCheckWithResult( _ args : CheckerArguments , _ p : Testable ) -> Result {
588+ internal func quickCheckWithResult( _ args : CheckerArguments , _ p : Testable ) -> QuickCheckResult {
589589 let istate = CheckerState (
590590 name: args. name,
591591 maxAllowableSuccessfulTests: args. maxAllowableSuccessfulTests,
@@ -621,7 +621,7 @@ internal func quickCheckWithResult(_ args : CheckerArguments, _ p : Testable) ->
621621// - giveUp: When the number of discarded tests exceeds the number given in the
622622// arguments we just give up turning the run loop to prevent excessive
623623// generation.
624- private func test( _ st : CheckerState , caseGen : ( StdGen , Int ) -> Prop ) -> Result {
624+ private func test( _ st : CheckerState , caseGen : ( StdGen , Int ) -> Prop ) -> QuickCheckResult {
625625 var state = st
626626 while true {
627627 switch runATest ( state, caseGen: caseGen) {
@@ -631,9 +631,9 @@ private func test(_ st : CheckerState, caseGen : (StdGen, Int) -> Prop) -> Resul
631631 return fail. 0
632632 case let ( _, . noExpectedFailure( numTests, seed, sz, labels, output) ) :
633633 return . noExpectedFailure( numTests: numTests, usedSeed: seed, usedSize: sz, labels: labels, output: output)
634- // Existential Failures need explicit propagation. Existentials increment the
635- // discard count so we check if it has been surpassed. If it has with any kind
636- // of success we're done. If no successes are found we've failed checking the
634+ // Existential Failures need explicit propagation. Existentials increment the
635+ // discard count so we check if it has been surpassed. If it has with any kind
636+ // of success we're done. If no successes are found we've failed checking the
637637 // existential and report it as such. Otherwise turn the testing loop.
638638 case ( . existentialFailure( _, _, _, _, _, _, _) , _) :
639639 if fail. 1 . successfulTestCount == 0 || fail. 1 . discardedTestCount >= fail. 1 . maxAllowableDiscardedTests {
@@ -661,7 +661,7 @@ private func test(_ st : CheckerState, caseGen : (StdGen, Int) -> Prop) -> Resul
661661//
662662// On success the next state is returned. On failure the final result and state
663663// are returned.
664- private func runATest( _ st : CheckerState , caseGen : ( StdGen , Int ) -> Prop ) -> Either < ( Result , CheckerState ) , CheckerState > {
664+ private func runATest( _ st : CheckerState , caseGen : ( StdGen , Int ) -> Prop ) -> Either < ( QuickCheckResult , CheckerState ) , CheckerState > {
665665 let size = st. computeSize ( st. successfulTestCount, st. discardedTestCount)
666666 let ( rnd1, rnd2) = st. randomSeedGenerator. split
667667
@@ -751,7 +751,7 @@ private func runATest(_ st : CheckerState, caseGen : (StdGen, Int) -> Prop) -> E
751751
752752 /// However, some existentials outlive their usefulness
753753 if nstate. discardedTestCount >= nstate. maxAllowableDiscardedTests {
754- let resul = Result . existentialFailure (
754+ let resul = QuickCheckResult . existentialFailure (
755755 numTests: ( st. successfulTestCount + 1 ) ,
756756 usedSeed: st. randomSeedGenerator,
757757 usedSize: st. computeSize ( st. successfulTestCount, st. discardedTestCount) ,
@@ -768,12 +768,12 @@ private func runATest(_ st : CheckerState, caseGen : (StdGen, Int) -> Prop) -> E
768768 // Attempt a shrink.
769769 let ( numShrinks, _, _) = findMinimalFailingTestCase ( st, res: res, ts: ts ( ) )
770770
771- if ! expect {
772- let s = Result . success ( numTests: ( st. successfulTestCount + 1 ) , labels: summary ( st) , output: " +++ OK, failed as expected. " )
771+ guard expect else {
772+ let s = QuickCheckResult . success ( numTests: ( st. successfulTestCount + 1 ) , labels: summary ( st) , output: " +++ OK, failed as expected. " )
773773 return . left( ( s, st) )
774774 }
775775
776- let stat = Result . failure (
776+ let stat = QuickCheckResult . failure (
777777 numTests: ( st. successfulTestCount + 1 ) ,
778778 numShrinks: numShrinks,
779779 usedSeed: st. randomSeedGenerator,
@@ -809,7 +809,7 @@ private func runATest(_ st : CheckerState, caseGen : (StdGen, Int) -> Prop) -> E
809809 }
810810}
811811
812- private func doneTesting( _ st : CheckerState ) -> Result {
812+ private func doneTesting( _ st : CheckerState ) -> QuickCheckResult {
813813 if !st. hasFulfilledExpectedFailure {
814814 if insufficientCoverage ( st) {
815815 printCond ( st. silence, " +++ OK, failed as expected. " )
@@ -843,7 +843,7 @@ private func doneTesting(_ st : CheckerState) -> Result {
843843 }
844844}
845845
846- private func giveUp( _ st : CheckerState ) -> Result {
846+ private func giveUp( _ st : CheckerState ) -> QuickCheckResult {
847847 printDistributionGraph ( st)
848848 return . gaveUp( numTests: st. successfulTestCount, labels: summary ( st) , output: " " )
849849}
@@ -944,7 +944,7 @@ private func reportMinimumCaseFound(_ st : CheckerState, res : TestResult) -> (I
944944 return ( st. successfulShrinkCount, st. failedShrinkStepCount - st. failedShrinkStepDistance, st. failedShrinkStepDistance)
945945}
946946
947- private func reportExistentialFailure( _ st : CheckerState , res : Result ) -> Result {
947+ private func reportExistentialFailure( _ st : CheckerState , res : QuickCheckResult ) -> QuickCheckResult {
948948 switch res {
949949 case let . existentialFailure( _, _, _, reason, _, _, lastTest) :
950950 let testMsg = " (after \( st. discardedTestCount) test "
0 commit comments