diff --git a/test_suite/test_data/AI/Traffic/H/TST.xml b/test_suite/test_data/AI/Traffic/H/TST.xml index 6656aecb1..6cb31c719 100644 --- a/test_suite/test_data/AI/Traffic/H/TST.xml +++ b/test_suite/test_data/AI/Traffic/H/TST.xml @@ -10,7 +10,7 @@ BN2 0 8 - gate + ga turboprop_transport G-HEBO false @@ -24,13 +24,13 @@ BN2 0 8 - gate + ga turboprop_transport G-HEBS false - Hebridean_1000 + Test_0001 TST_BN_2 VFR @@ -40,12 +40,12 @@ 50 YSSY - + - Hr + 02Hr - Hebridean_1000 + Test_1001 TST_BN_2 VFR @@ -53,10 +53,265 @@ 50 + + YBBN + + + 02Hr + + + Test_1001 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1002 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1002 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1003 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1003 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1004 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1004 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1005 + TST_BN_2 + VFR + + YSSY + + + 50 YBBN - Hr + 02Hr + + + Test_1005 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1006 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1006 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1007 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1008 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1009 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1010 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1011 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr + + + Test_1012 + TST_BN_2 + VFR + + YSSY + + + 50 + + YBBN + + + 02Hr diff --git a/test_suite/unit_tests/AI/test_traffic.cxx b/test_suite/unit_tests/AI/test_traffic.cxx index d38af69c6..7f178c2e7 100644 --- a/test_suite/unit_tests/AI/test_traffic.cxx +++ b/test_suite/unit_tests/AI/test_traffic.cxx @@ -56,12 +56,13 @@ void TrafficTests::setUp() fgSetBool("sim/ai/enabled", true); fgSetBool("sim/traffic-manager/enabled", true); - fgSetBool("sim/signals/fdm-initialized", false); + fgSetBool("sim/signals/fdm-initialized", true); fgSetInt("/environment/visibility-m", 1000); fgSetBool("/environment/realwx/enabled", false); fgSetBool("/environment/metar/valid", false); fgSetBool("/sim/terrasync/ai-data-update-now", false); + globals->append_data_path(SGPath::fromUtf8(FG_TEST_SUITE_DATA), false); // ensure EDDF has a valid ground net for parking testing FGAirport::clearAirportsCache(); @@ -488,11 +489,11 @@ void TrafficTests::testPushforwardParkYBBNRepeat() const char* flighttype = "ga"; FGAISchedule* schedule = new FGAISchedule( - "B737", "KLM", departureAirport->getId(), "G-BLA", "ID", false, "B737", "KLM", "N", flighttype, radius, 8); - FGScheduledFlight* flight = new FGScheduledFlight("gaParkYSSY", "", departureAirport->getId(), arrivalAirport->getId(), 24, dep, arr, "WEEK", "HBR_BN_2"); + "B737", "KLM", departureAirport->getId(), "G-BLA", "TST_BN_2", false, "B737", "KLM", "N", flighttype, radius, 8); + FGScheduledFlight* flight = new FGScheduledFlight("gaParkYSSY", "VFR", departureAirport->getId(), arrivalAirport->getId(), 24, dep, arr, "WEEK", "TST_BN_2"); schedule->assign(flight); - FGScheduledFlight* returnFlight = new FGScheduledFlight("gaParkYSSY", "", arrivalAirport->getId(), departureAirport->getId(), 24, arr, ret, "WEEK", "HBR_BN_2"); + FGScheduledFlight* returnFlight = new FGScheduledFlight("gaParkYSSY", "", arrivalAirport->getId(), departureAirport->getId(), 24, arr, ret, "WEEK", "TST_BN_2"); schedule->assign(returnFlight); FGAIAircraft* aiAircraft = new FGAIAircraft{schedule}; @@ -551,6 +552,7 @@ FGAIAircraft * TrafficTests::flyAI(FGAIAircraft * aiAircraft, std::string fName) FGTestApi::setUp::logLinestringsToKML(fName); flightgear::SGGeodVec geods = flightgear::SGGeodVec(); char buffer[50]; + int iteration = 1; int lastLeg = -1; double lastHeading = 0; for (size_t i = 0; i < 12000000 && !(aiAircraft->getDie()) && aiAircraft->GetFlightPlan()->getLeg() < 10; i++) { @@ -574,19 +576,23 @@ FGAIAircraft * TrafficTests::flyAI(FGAIAircraft * aiAircraft, std::string fName) if (aiAircraft->GetFlightPlan()->getLeg() == 9) { this->dump(aiAircraft); } - if (aiAircraft->GetFlightPlan()->getLeg() > lastLeg) { - sprintf(buffer, "AI Leg %d", lastLeg); + if (aiAircraft->GetFlightPlan()->getLeg() != lastLeg) { + sprintf(buffer, "AI Leg %d Callsign %s Iteration %d", lastLeg, aiAircraft->getCallSign().c_str(), iteration); FGTestApi::writeGeodsToKML(buffer, geods); + if (aiAircraft->GetFlightPlan()->getLeg() < lastLeg) { + iteration++; + } lastLeg = aiAircraft->GetFlightPlan()->getLeg(); SGGeod last = geods.back(); geods.clear(); geods.insert(geods.end(), last); } CPPUNIT_ASSERT_LESSEQUAL(10, aiAircraft->GetFlightPlan()->getLeg()); + CPPUNIT_ASSERT_MESSAGE( "Aircraft has not completed test in time.", i < 30000); FGTestApi::runForTime(3); } lastLeg = aiAircraft->GetFlightPlan()->getLeg(); - sprintf(buffer, "AI Leg %d", lastLeg); + sprintf(buffer, "AI Leg %d Callsign %s Iteration %d", lastLeg, aiAircraft->getCallSign().c_str(), iteration); FGTestApi::writeGeodsToKML(buffer, geods); geods.clear(); return aiAircraft;