add generic test for logistics function fix2 #15

Open
jiamengwu wants to merge 5 commits from jiamengwu/2025-plovdiv-testing-debugging:logistic into main
Showing only changes of commit c11156fb80 - Show all commits

View file

@ -1,17 +1,13 @@
from numpy.testing import assert_allclose from numpy.testing import assert_allclose
import pytest
from logistic import f from logistic import f
def test_f_corner_cases(): @pytest.mark.parametrize('x,r,expected', [(0, 1.1, 0),(1, 3.7, 0)])
def test_f_corner_cases(x, r, expected):
# Test cases are (x, r, expected) # Test cases are (x, r, expected)
cases = [ result = f(x, r)
(0, 1.1, 0), assert_allclose(result, expected)
(1, 3.7, 0),
]
for x, r, expected in cases:
result = f(x, r)
assert_allclose(result, expected)
# Hands on 1 # Hands on 1
#Add a new test for these generic cases using the for-loop pattern: #Add a new test for these generic cases using the for-loop pattern: