mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Migrate sweep ingress's tasks to waypoint actions.
This commit is contained in:
38
tests/flightplan/waypointactions/test_engagetargets.py
Normal file
38
tests/flightplan/waypointactions/test_engagetargets.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from dcs.task import Targets
|
||||
|
||||
from game.ato.flightstate.actionstate import ActionState
|
||||
from game.flightplan.waypointactions.engagetargets import EngageTargets
|
||||
from game.flightplan.waypointactions.taskcontext import TaskContext
|
||||
from game.utils import meters
|
||||
|
||||
|
||||
def test_engage_targets() -> None:
|
||||
tasks = list(
|
||||
EngageTargets(
|
||||
meters(100), [Targets.All.Air.Planes, Targets.All.Air.Helicopters]
|
||||
).iter_tasks(TaskContext(datetime.now()))
|
||||
)
|
||||
assert len(tasks) == 1
|
||||
task = tasks[0]
|
||||
assert task.id == "EngageTargets"
|
||||
assert task.params["targetTypes"] == {
|
||||
1: Targets.All.Air.Planes,
|
||||
2: Targets.All.Air.Helicopters,
|
||||
}
|
||||
assert task.params["value"] == "Planes;Helicopters"
|
||||
assert task.params["maxDist"] == 100
|
||||
|
||||
|
||||
def test_engage_targets_update_state() -> None:
|
||||
task = EngageTargets(meters(100), [Targets.All])
|
||||
state = ActionState(task)
|
||||
assert not task.update_state(state, datetime.now(), timedelta())
|
||||
assert state.is_finished()
|
||||
|
||||
|
||||
def test_engage_targets_description() -> None:
|
||||
assert (
|
||||
EngageTargets(meters(100), [Targets.All]).describe() == "Searching for targets"
|
||||
)
|
||||
0
tests/flightplan/waypointoptions/__init__.py
Normal file
0
tests/flightplan/waypointoptions/__init__.py
Normal file
13
tests/flightplan/waypointoptions/test_formation.py
Normal file
13
tests/flightplan/waypointoptions/test_formation.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from datetime import datetime
|
||||
|
||||
from dcs.task import OptFormation
|
||||
|
||||
from game.flightplan.waypointactions.taskcontext import TaskContext
|
||||
from game.flightplan.waypointoptions.formation import Formation
|
||||
|
||||
|
||||
def test_formation() -> None:
|
||||
tasks = list(Formation.LINE_ABREAST_OPEN.iter_tasks(TaskContext(datetime.now())))
|
||||
assert len(tasks) == 1
|
||||
task = tasks[0]
|
||||
assert task.dict() == OptFormation.line_abreast_open().dict()
|
||||
Reference in New Issue
Block a user