add generic test for logistics function fix2 #15
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,15 @@ def test_f_corner_cases():
|
||||||
# x=0.2, r=3.4 => f(x, r)=0.544
|
# x=0.2, r=3.4 => f(x, r)=0.544
|
||||||
# x=0.5, r=2 => f(x, r)=0.5
|
# x=0.5, r=2 => f(x, r)=0.5
|
||||||
|
|
||||||
|
def test_f_normal_cases():
|
||||||
|
cases = [
|
||||||
|
(.1, 2.2, .198),
|
||||||
|
(.2, 3.4, .544),
|
||||||
|
(.5, 2, .5),
|
||||||
|
]
|
||||||
|
for x, r, expected in cases:
|
||||||
|
result = f(x, r)
|
||||||
|
assert_allclose(result, expected)
|
||||||
|
|
||||||
# Hands on 2:
|
# Hands on 2:
|
||||||
# parametrize the above test using @pytest.mark.parametrize
|
# parametrize the above test using @pytest.mark.parametrize
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue