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

Shrink NaN to canonical form #4277

Open
jobh opened this issue Feb 26, 2025 · 0 comments
Open

Shrink NaN to canonical form #4277

jobh opened this issue Feb 26, 2025 · 0 comments
Labels
test-case-reduction about efficiently finding smaller failing examples

Comments

@jobh
Copy link
Contributor

jobh commented Feb 26, 2025

for s in [0, 2, 4]:
    @given(st.lists(st.integers()|st.floats()))
    @seed(s)
    def sort_is_reversible(l):
        assert sorted(l, reverse=True) == list(reversed(sorted(l)))
    try:
        sort_is_reversible()
    except AssertionError as e:
        print(e.__notes__[0].replace("\n", ""))

Falsifying example: sort_is_reversible(l=[0, -nan],)
Falsifying example: sort_is_reversible(l=[0, nan],)
Falsifying example: sort_is_reversible(l=[0, struct.unpack('d', struct.pack('Q', 0xfff8000000000001))[0]],)
@jobh jobh mentioned this issue Feb 26, 2025
@Zac-HD Zac-HD added the test-case-reduction about efficiently finding smaller failing examples label Feb 26, 2025
@jobh jobh changed the title Shrink NaN to canonical representation Shrink NaN to canonical form Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test-case-reduction about efficiently finding smaller failing examples
Projects
None yet
Development

No branches or pull requests

2 participants