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

support zero-arg function references #48

Open
johnnychen94 opened this issue Jan 12, 2020 · 1 comment
Open

support zero-arg function references #48

johnnychen94 opened this issue Jan 12, 2020 · 1 comment

Comments

@johnnychen94
Copy link
Member

johnnychen94 commented Jan 12, 2020

For zero-arg functions such as f() = rand(), a useful feature is to repeat the tests several times and see if all of the results fall in the acceptable region.

I'm thinking of the following usage:

@test_reference "references/zero.txt" rand by=(x,y)->abs(x-y)<1 repeat=50

which is equivalent to

for _ in 1:50
    rst = rand()
    @test_reference "references/zero.txt" rst by=(x,y)->abs(x-y)<1
end
@oxinabox
Copy link
Member

Why is this specific to zero arg functions?

foo(q) = x+rand()
@test_reference "references/zero.txt" foo(500) by=(x,y)->abs(x-y)<1 repeat=50

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