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

Implement purity tests for FFI based on property testing #162

Open
wende opened this issue Jul 26, 2017 · 2 comments
Open

Implement purity tests for FFI based on property testing #162

wende opened this issue Jul 26, 2017 · 2 comments

Comments

@wende
Copy link
Owner

wende commented Jul 26, 2017

Along with typetests which verify the spec of a function we want a property test that checks whether used FFI call is pure and total.

For example:

myDivision : Float -> Float -> Float
myDivision =
  ffi "Kernel" "/"

Should verify "all" possible incomes and outcomes:

  • Check the params for 0 and any possible random floats -2^128 - 2^128
  • Verify if there is a return value of type float. If not fail the test
    ->
    Function throws an error when second parameter is a 0. It has to be fixed by using different module like ffi "NativeBasics "safe_div"

Example 2

myMap : (Bool -> Int) -> List Bool -> List Int
  1. Generate a function verifying that it took a bool and returning a random int
  2. Generate a list of random length with random bools inside
  3. Check if function always returns a list of integers. If not throw

Etc

@OvermindDL1
Copy link

You might be able to generate these with some of the elixir property testing libraries to save work.

@wende wende added the Blocked label Oct 2, 2017
@wende
Copy link
Owner Author

wende commented Oct 2, 2017

Blocked by #202

@wende wende removed the Blocked label Jan 31, 2018
@wende wende changed the title Implement pureness tests for FFI based on property testing Implement purity tests for FFI based on property testing Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants