forked from IQ.Lvbs/IQ.Pilot
IQ.Pilot Prebuilt Release @ ab07000
This commit is contained in:
20
selfdrive/ui/tests/test_ui/test_scroll_panel2.py
Normal file
20
selfdrive/ui/tests/test_ui/test_scroll_panel2.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from collections import deque
|
||||
|
||||
from openpilot.system.ui.lib.scroll_panel2 import weighted_velocity
|
||||
|
||||
|
||||
def test_weighted_velocity_empty():
|
||||
assert weighted_velocity(deque()) == 0.0
|
||||
|
||||
|
||||
def test_weighted_velocity_single():
|
||||
assert weighted_velocity(deque([120.0])) == 120.0
|
||||
|
||||
|
||||
def test_weighted_velocity_two_samples():
|
||||
assert weighted_velocity(deque([100.0, 200.0])) == 130.0
|
||||
|
||||
|
||||
def test_weighted_velocity_three_samples_biases_older():
|
||||
velocity = weighted_velocity(deque([300.0, 180.0, 20.0]))
|
||||
assert velocity == 244.0
|
||||
Reference in New Issue
Block a user