added local maxima function
This commit is contained in:
parent
952f8b97a5
commit
c62e1e8797
3 changed files with 56 additions and 4 deletions
41
hands_on/local_maxima/test_local_maxima.py
Normal file
41
hands_on/local_maxima/test_local_maxima.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
from local_maxima import find_maxima
|
||||
|
||||
|
||||
|
||||
def test_local_maxima_empty():
|
||||
value = []
|
||||
expected = []
|
||||
|
||||
result = find_maxima(value)
|
||||
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_local_maxima_plateau():
|
||||
value = [1, 2, 2, 1]
|
||||
expected = []
|
||||
|
||||
result = find_maxima(value)
|
||||
|
||||
assert result == expected
|
||||
|
||||
def test_local_maxima_array1():
|
||||
value = [1, 3, 5, 2, 1]
|
||||
expected = [2]
|
||||
|
||||
result = find_maxima(value)
|
||||
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_local_maxima_array2():
|
||||
value = [5, 4, 4, 5]
|
||||
expected = []
|
||||
|
||||
result = find_maxima(value)
|
||||
|
||||
assert result == expected
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue