1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2024-10-27 20:34:12 +00:00

check more cases

This commit is contained in:
Alden 2023-02-13 01:56:56 -05:00
parent 0f36747c05
commit 727eae8053

View File

@ -39,11 +39,12 @@ def assert_matches(x, mpfunc, jsfunc=None):
integers(min_value=-99, max_value=99), integers(min_value=-99, max_value=99),
).map(lambda tup: tup[0] * Decimal(10) ** tup[1]) ).map(lambda tup: tup[0] * Decimal(10) ** tup[1])
) )
@settings(max_examples=1000)
def test_matches(x, fn): def test_matches(x, fn):
assert_matches(x, fn) assert_matches(x, fn)
@pytest.mark.parametrize("fn", "ln log10".split()) @pytest.mark.parametrize("fn", "ln log10 sqrt".split())
@given( @given(
x=tuples( x=tuples(
decimals( decimals(
@ -56,6 +57,7 @@ def test_matches(x, fn):
integers(min_value=-99, max_value=99), integers(min_value=-99, max_value=99),
).map(lambda tup: tup[0] * Decimal(10) ** tup[1]) ).map(lambda tup: tup[0] * Decimal(10) ** tup[1])
) )
@settings(max_examples=1000)
def test_positive_domain(x, fn): def test_positive_domain(x, fn):
assert_matches(x, fn) assert_matches(x, fn)
@ -66,11 +68,12 @@ def test_positive_domain(x, fn):
allow_nan=False, allow_infinity=False, min_value=-1, max_value=1, places=14 allow_nan=False, allow_infinity=False, min_value=-1, max_value=1, places=14
) )
) )
@settings(max_examples=1000)
def test_inverse_trig(x, fn): def test_inverse_trig(x, fn):
assert_matches(x, fn) assert_matches(x, fn)
@pytest.mark.parametrize("fn", "sinh cosh tanh".split()) @pytest.mark.parametrize("fn", "sinh cosh tanh exp".split())
@given( @given(
x=tuples( x=tuples(
decimals( decimals(
@ -79,5 +82,6 @@ def test_inverse_trig(x, fn):
integers(min_value=-99, max_value=3), integers(min_value=-99, max_value=3),
).map(lambda tup: tup[0] * Decimal(10) ** tup[1]) ).map(lambda tup: tup[0] * Decimal(10) ** tup[1])
) )
@settings(max_examples=1000)
def test_small_domain(x, fn): def test_small_domain(x, fn):
assert_matches(x, fn) assert_matches(x, fn)