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

InEpsilon does not fail when passed a NaN value #918

Closed
hectorj opened this issue Apr 1, 2020 · 2 comments · Fixed by #919
Closed

InEpsilon does not fail when passed a NaN value #918

hectorj opened this issue Apr 1, 2020 · 2 comments · Fixed by #919

Comments

@hectorj
Copy link
Contributor

hectorj commented Apr 1, 2020

Hi! We ran into a small isue today with require.InEpsilon, at version 1.5.1

func TestInEpsilonNaN(t *testing.T) {
	require.InEpsilon(t, 42, math.NaN(), 1)
}

Actual result : test passes

Expected result : an error

@hectorj
Copy link
Contributor Author

hectorj commented Apr 1, 2020

This is highly similar to #162

I'll make a PR with the equivalent changes

@ybrustin-te
Copy link

func TestInEpsilon1(t *testing.T) {
	div := 0.0
	require.InEpsilon(t, 1, 1/div, 0.001)
}

func TestInEpsilon2(t *testing.T) {
	div := 0.0
	require.InEpsilon(t, 1/div, 1, 0.001)
}
> go test -v -run InEps | grep -E '(PASS|FAIL)'
--- FAIL: TestInEpsilon1 (0.00s)
--- PASS: TestInEpsilon2 (0.00s)

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

Successfully merging a pull request may close this issue.

2 participants