test generic cases of logistic equation #11

Open
niklasho wants to merge 1 commit from niklasho/2025-plovdiv-testing-debugging:fix-1 into main
2 changed files with 15 additions and 0 deletions
Showing only changes of commit f5261cb2c7 - Show all commits

View file

@ -1 +1,3 @@
# Your code goes here # Your code goes here
def f(x, r):
return r * x * (1 - x)

View file

@ -13,6 +13,19 @@ def test_f_corner_cases():
result = f(x, r) result = f(x, r)
assert_allclose(result, expected) assert_allclose(result, expected)
def test_f_generic_cases():
# Test cases are (x, r, expected)
cases = [
(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)
# 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:
# x=0.1, r=2.2 => f(x, r)=0.198 # x=0.1, r=2.2 => f(x, r)=0.198