Logistic map tests #10

Open
eceku wants to merge 5 commits from eceku/2025-plovdiv-testing-debugging:test-2 into main
Showing only changes of commit 4736cc7ac9 - Show all commits

View file

@ -1,3 +1,4 @@
import pytest
from numpy.testing import assert_allclose
from logistic import f
@ -13,15 +14,17 @@ def test_f_corner_cases():
result = f(x, r)
assert_allclose(result, expected)
def test_f_generic_cases():
cases = [
@pytest.mark.parametrize(
'x, r, expected',
[
(0.1, 2.2 ,0.198),
(0.2, 3.4 ,0.544),
(0.5, 2 ,0.5)
]
for x, r, expected in cases:
result = f(x, r)
assert_allclose(result, expected)
)
def test_f_generic_cases(x, r, expected):
result = f(x, r)
assert_allclose(result, expected)
# Hands on 1
#Add a new test for these generic cases using the for-loop pattern: