Skip to content

Commit

Permalink
Add test for diofant#12
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Dec 12, 2024
1 parent 8f3e660 commit bcad76c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import math

import pytest
from hypothesis import given
from hypothesis.strategies import integers

from gmp import mpz, gcd, isqrt
from gmp import mpz, factorial, gcd, isqrt


@given(integers(min_value=0))
def test_isqrt(x):
mx = mpz(x)
assert isqrt(mx) == isqrt(x) == math.isqrt(x)
r = math.isqrt(x)
assert isqrt(mx) == isqrt(x) == r


@pytest.mark.xfail(reason="diofant/python-gmp#12")
@given(integers(min_value=0, max_value=12345))
def test_factorial(x):
mx = mpz(x)
r = math.factorial(x)
assert factorial(mx) == factorial(x) == r


@given(integers(), integers())
Expand Down

0 comments on commit bcad76c

Please sign in to comment.