Logistic map tests #10
1 changed files with 8 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue