You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.7 KiB
Python
67 lines
1.7 KiB
Python
from pathlib import Path
|
|
import sys
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(PROJECT_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
from track_score_policy import required_track_score, track_passes_score_gate
|
|
|
|
|
|
def test_required_track_score_is_stricter_for_switch_than_for_acquire():
|
|
acquire_floor = required_track_score(
|
|
confirmed=False,
|
|
is_switch_candidate=False,
|
|
weak_reacq_guard=False,
|
|
)
|
|
switch_floor = required_track_score(
|
|
confirmed=True,
|
|
is_switch_candidate=True,
|
|
weak_reacq_guard=False,
|
|
)
|
|
|
|
assert switch_floor > acquire_floor
|
|
|
|
|
|
def test_weak_reacquire_uses_reacquire_floor():
|
|
reacquire_floor = required_track_score(
|
|
confirmed=True,
|
|
is_switch_candidate=False,
|
|
weak_reacq_guard=True,
|
|
)
|
|
|
|
assert track_passes_score_gate(
|
|
track_score=reacquire_floor,
|
|
confirmed=True,
|
|
is_switch_candidate=False,
|
|
weak_reacq_guard=True,
|
|
)
|
|
assert not track_passes_score_gate(
|
|
track_score=reacquire_floor - 0.01,
|
|
confirmed=True,
|
|
is_switch_candidate=False,
|
|
weak_reacq_guard=True,
|
|
)
|
|
|
|
|
|
def test_switch_candidate_must_clear_switch_floor():
|
|
switch_floor = required_track_score(
|
|
confirmed=True,
|
|
is_switch_candidate=True,
|
|
weak_reacq_guard=False,
|
|
)
|
|
|
|
assert track_passes_score_gate(
|
|
track_score=switch_floor,
|
|
confirmed=True,
|
|
is_switch_candidate=True,
|
|
weak_reacq_guard=False,
|
|
)
|
|
assert not track_passes_score_gate(
|
|
track_score=switch_floor - 0.01,
|
|
confirmed=True,
|
|
is_switch_candidate=True,
|
|
weak_reacq_guard=False,
|
|
)
|