Add required test suite and websocket fixes

This commit is contained in:
ameer
2026-05-02 03:08:48 +08:00
parent dfebfe2ee8
commit 63a03c0367
14 changed files with 516 additions and 29 deletions

View File

@@ -1,2 +1,26 @@
def test_placeholder_scoring():
assert True
from app.scoring import SCORE_FNS
def test_linear_decay_values():
fn = SCORE_FNS["linear_decay"]
assert fn(True, 0, 60_000) == 1000
assert fn(True, 30_000, 60_000) == 750
assert fn(True, 60_000, 60_000) == 500
assert fn(True, 90_000, 60_000) == 500
assert fn(False, 0, 60_000) == 0
def test_flat_values():
fn = SCORE_FNS["flat"]
assert fn(True, 0, 60_000) == 1000
assert fn(True, 60_000, 60_000) == 1000
assert fn(True, 90_000, 60_000) == 1000
assert fn(False, 0, 60_000) == 0
def test_exponential_decay_values():
fn = SCORE_FNS["exponential_decay"]
assert fn(True, 0, 60_000) == 1000
assert 560 < fn(True, 60_000, 60_000) < 570
assert fn(True, 90_000, 60_000) == fn(True, 60_000, 60_000)
assert fn(False, 0, 60_000) == 0