test: add 3-drone air-based formation integration test

Scenario_3DronesAirBased: 3 piston drones in Formation (Z=0/50/100), 3 air-standard platforms, all destroyed. Verifies air-based multi-lane intercept end-to-end.

193 tests pass.
This commit is contained in:
tian 2026-06-14 22:02:00 +08:00
parent 008df4a86c
commit 19780b54b9

View File

@ -538,5 +538,67 @@ namespace CounterDrone.Core.Tests
Assert.True(launched > 0, msg);
Assert.True(eng.Drones.All(d => d.Status == DroneStatus.Destroyed), msg);
}
// ═══════════════════════════════════════════════
// 场景 73 架活塞编队 + 空基平台(横排 Z=0/50/100— 空基多无人机端到端
// 验证空基平台对多车道编队的拦截能力
// ═══════════════════════════════════════════════
[Fact]
public void Scenario_3DronesAirBased_AllDestroyed()
{
var task = _scenario.CreateTask("3架空基编队拦截测试", "");
_taskId = task.Id;
_scenario.SaveScene(_taskId, new CombatScene { WindSpeed = 0 });
_scenario.SaveTarget(_taskId, new TargetConfig
{
GroupId = "default", TargetType = (int)TargetType.Piston,
PowerType = (int)PowerType.Piston,
Quantity = 3,
TypicalSpeed = 150, TypicalAltitude = 500,
});
// 3 架横排编队Formation 模式,横向间距 50mZ=0/50/100
_scenario.SaveRoute(_taskId, "default", new RoutePlan
{
FormationMode = (int)FormationMode.Formation,
LateralSpacing = 50,
LateralCount = 3,
LongitudinalCount = 1,
},
new List<Waypoint>
{
new Waypoint { PosX = 0, PosY = 500, PosZ = 0, Speed = 150 },
new Waypoint { PosX = 10000, PosY = 500, PosZ = 0, Speed = 150 },
});
// 3 个空基平台单元,部署在航路前方
_scenario.SaveDeployment(_taskId, new List<EquipmentDeployment>
{
MakeEquipment(DefaultFireUnits.GetById("air-standard"), AerosolType.InertGas, 3, 1500, 1000, 0),
});
_scenario.SaveCloudDispersal(_taskId, new CloudDispersal { AerosolType = (int)AerosolType.InertGas, DisperseHeight = 500 });
// 验证:空基 PlatformType 正确持久化
var savedAir = _scenario.GetTaskDetail(_taskId)!;
Assert.All(savedAir.Equipment, eq => Assert.Equal((int?)0, eq.PlatformType));
var eng = RunSimulation(8000);
// 诊断:空基发射事件应有"空基"描述
Assert.All(eng.Events.Where(e => e.Type == SimEventType.MunitionLaunched),
e => Assert.Contains("空基", e.Description));
var launched = eng.Events.Count(e => e.Type == SimEventType.MunitionLaunched);
var clouds = eng.Events.Count(e => e.Type == SimEventType.CloudGenerated);
// 验证3 架无人机都被击毁
var msg = $"3DronesAir: launched={launched} clouds={clouds} drones={eng.Drones.Count}";
foreach (var d in eng.Drones)
msg += $" [{d.Status} hp={d.Hp:F2} pos=({d.PosX:F0},{d.PosZ:F0})]";
VerifyAndExportReport(eng, eng.Drones[0]);
Assert.Equal(3, eng.Drones.Count);
Assert.True(launched > 0, msg);
Assert.True(eng.Drones.All(d => d.Status == DroneStatus.Destroyed), msg);
}
}
}