Logistic map tests #10

Open
eceku wants to merge 5 commits from eceku/2025-plovdiv-testing-debugging:test-2 into main
2 changed files with 13 additions and 0 deletions
Showing only changes of commit d464e60b06 - Show all commits

View file

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

View file

@ -13,6 +13,16 @@ 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():
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