Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code from README doesn't compile #299

Open
xavierLowmiller opened this issue Jul 20, 2020 · 0 comments
Open

Code from README doesn't compile #299

xavierLowmiller opened this issue Jul 20, 2020 · 0 comments

Comments

@xavierLowmiller
Copy link

Version

077c096c3ddfc38db223ac8e525ad16ffb987138

Environment

macOS 10.15.6, Swift 5.2, Xcode 11.6

Description

I was following the steps from README.md to learn about SwiftCheck.
Unfortunately, the example for complex properties doesn't compile:

property("Shrunken lists of integers always contain [] or [0]") <- forAll { (l : [Int]) in
  // Here we use the Implication Operator `==>` to define a precondition for
  // this test.  If the precondition fails the test is discarded.  If it holds
  // the test proceeds.
  return (!l.isEmpty && l != [0]) ==> {
    let ls = self.shrinkArbitrary(l)
    //       ^ Value of type 'ExampleTests' has no member 'shrinkArbitrary'
    return (ls.filter({ $0 == [] || $0 == [0] }).count >= 1)
  }
}

I'm no expert on QuickCheck (or SwiftCheck), so I don't know how to fix this message.

Steps To Reproduce

  1. Create a new test function
  2. Copy the code block from README.md

Expected Result

The code compiles and produces a passing test case.

Actual Result

There is a compiler error:
Value of type 'ExampleTests' has no member 'shrinkArbitrary'

Additional information

--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant