From 45243c96e8676c251198d15a6b60ca4fc10280a4 Mon Sep 17 00:00:00 2001 From: Edward d'Auvergne Date: Mon, 7 May 2018 12:00:33 +0200 Subject: [PATCH] TestSuite: System tests for subsystem creation via the global registrations. This covers all instantiated SGSubsystem derived classes, i.e. those that are not base classes, including subsystem groups. Both non-instanced and instanced subsystem creation is tested. The tests for subsystems yet to be registered are commented out. --- test_suite/CMakeLists.txt | 2 + test_suite/system_tests/CMakeLists.txt | 1 + .../system_tests/subsystems/CMakeLists.txt | 14 ++ .../system_tests/subsystems/TestSuite.cxx | 26 ++ .../subsystems/test_instanced_creation.cxx | 99 ++++++++ .../subsystems/test_instanced_creation.hxx | 113 +++++++++ .../subsystems/test_noninstanced_creation.cxx | 149 ++++++++++++ .../subsystems/test_noninstanced_creation.hxx | 229 ++++++++++++++++++ 8 files changed, 633 insertions(+) create mode 100644 test_suite/system_tests/subsystems/CMakeLists.txt create mode 100644 test_suite/system_tests/subsystems/TestSuite.cxx create mode 100644 test_suite/system_tests/subsystems/test_instanced_creation.cxx create mode 100644 test_suite/system_tests/subsystems/test_instanced_creation.hxx create mode 100644 test_suite/system_tests/subsystems/test_noninstanced_creation.cxx create mode 100644 test_suite/system_tests/subsystems/test_noninstanced_creation.hxx diff --git a/test_suite/CMakeLists.txt b/test_suite/CMakeLists.txt index 3701b5fe5..15f8153e5 100644 --- a/test_suite/CMakeLists.txt +++ b/test_suite/CMakeLists.txt @@ -69,7 +69,9 @@ include(Dart) # System test suites. add_test(AeroMeshSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s AeroMeshTests) #add_test(GPSSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s GPSTests) +add_test(InstancedSubsystemSystemTests ${TESTSUITE_OUTPUT_DIR}/run_test_suite --ctest -s InstancedSubsystemTests) #add_test(NavaidsSystemTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -s NavaidsTests) +add_test(NonInstancedSubsystemSystemTests ${TESTSUITE_OUTPUT_DIR}/run_test_suite --ctest -s NonInstancedSubsystemTests) # Unit test suites. add_test(AddonManagementUnitTests ${TESTSUITE_OUTPUT_DIR}/fgfs_test_suite --ctest -u AddonManagementTests) diff --git a/test_suite/system_tests/CMakeLists.txt b/test_suite/system_tests/CMakeLists.txt index 6861a6a71..054becdc8 100644 --- a/test_suite/system_tests/CMakeLists.txt +++ b/test_suite/system_tests/CMakeLists.txt @@ -4,6 +4,7 @@ foreach( system_test_category Instrumentation Navaids Main + subsystems ) add_subdirectory(${system_test_category}) diff --git a/test_suite/system_tests/subsystems/CMakeLists.txt b/test_suite/system_tests/subsystems/CMakeLists.txt new file mode 100644 index 000000000..416cffc2e --- /dev/null +++ b/test_suite/system_tests/subsystems/CMakeLists.txt @@ -0,0 +1,14 @@ +set(TESTSUITE_SOURCES + ${TESTSUITE_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/TestSuite.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/test_instanced_creation.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/test_noninstanced_creation.cxx + PARENT_SCOPE +) + +set(TESTSUITE_HEADERS + ${TESTSUITE_HEADERS} + ${CMAKE_CURRENT_SOURCE_DIR}/test_instanced_creation.hxx + ${CMAKE_CURRENT_SOURCE_DIR}/test_noninstanced_creation.hxx + PARENT_SCOPE +) diff --git a/test_suite/system_tests/subsystems/TestSuite.cxx b/test_suite/system_tests/subsystems/TestSuite.cxx new file mode 100644 index 000000000..2a4f30c01 --- /dev/null +++ b/test_suite/system_tests/subsystems/TestSuite.cxx @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2018 Edward d'Auvergne + * + * This file is part of the program FlightGear. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "test_instanced_creation.hxx" +#include "test_noninstanced_creation.hxx" + + +// Set up the unit tests. +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(InstancedSubsystemTests, "System tests"); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(NonInstancedSubsystemTests, "System tests"); diff --git a/test_suite/system_tests/subsystems/test_instanced_creation.cxx b/test_suite/system_tests/subsystems/test_instanced_creation.cxx new file mode 100644 index 000000000..137378812 --- /dev/null +++ b/test_suite/system_tests/subsystems/test_instanced_creation.cxx @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2018 Edward d'Auvergne + * + * This file is part of the program FlightGear. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "test_suite/FGTestApi/testGlobals.hxx" + +#include "test_instanced_creation.hxx" + + +// Set up function for each test. +void InstancedSubsystemTests::setUp() +{ + // First set up the globals object. + FGTestApi::setUp::initTestGlobals("InstancedSubsystemCreationTests"); + + // The subsystem manager. + _mgr.reset(new SGSubsystemMgr()); +} + + +// Clean up after each test. +void InstancedSubsystemTests::tearDown() +{ + // Remove the manager. + _mgr.reset(); + + // Clean up globals. + FGTestApi::tearDown::shutdownTestGlobals(); +} + + +// Helper functions. +void InstancedSubsystemTests::create(const char* name) +{ + // Create two subsystem instances and add them to the manager. + _mgr->addInstance(name, "inst1"); + _mgr->addInstance(name, "inst2"); + auto sub1 = _mgr->get_subsystem(name, "inst1"); + auto sub2 = _mgr->get_subsystem(name, "inst2"); + + // Check the first subsystem. + CPPUNIT_ASSERT(sub1); + CPPUNIT_ASSERT_EQUAL(sub1->subsystemId(), std::string(name) + ".inst1"); + CPPUNIT_ASSERT_EQUAL(sub1->subsystemClassId(), std::string(name)); + CPPUNIT_ASSERT_EQUAL(sub1->subsystemInstanceId(), std::string("inst1")); + + // Check the second subsystem. + CPPUNIT_ASSERT(sub2); + CPPUNIT_ASSERT_EQUAL(sub2->subsystemId(), std::string(name) + ".inst2"); + CPPUNIT_ASSERT_EQUAL(sub2->subsystemClassId(), std::string(name)); + CPPUNIT_ASSERT_EQUAL(sub2->subsystemInstanceId(), std::string("inst2")); +} + + +// The instanced subsystems. +void InstancedSubsystemTests::testADF() { create("adf"); } +void InstancedSubsystemTests::testAirspeedIndicator() { create("airspeed-indicator"); } +void InstancedSubsystemTests::testAltimeter() { create("altimeter"); } +void InstancedSubsystemTests::testAttitudeIndicator() { create("attitude-indicator"); } +void InstancedSubsystemTests::testClock() { create("clock"); } +void InstancedSubsystemTests::testCommRadio() { create("comm-radio"); } +void InstancedSubsystemTests::testDME() { create("dme"); } +void InstancedSubsystemTests::testFGKR_87() { create("KR-87"); } +void InstancedSubsystemTests::testFGMarkerBeacon() { create("marker-beacon"); } +void InstancedSubsystemTests::testFGNavRadio() { create("old-navradio"); } +void InstancedSubsystemTests::testGPS() { create("gps"); } +void InstancedSubsystemTests::testGSDI() { create("gsdi"); } +void InstancedSubsystemTests::testHeadingIndicator() { create("heading-indicator"); } +void InstancedSubsystemTests::testHeadingIndicatorDG() { create("heading-indicator-dg"); } +void InstancedSubsystemTests::testHeadingIndicatorFG() { create("heading-indicator-fg"); } +void InstancedSubsystemTests::testHUD() { create("hud"); } +void InstancedSubsystemTests::testInstVerticalSpeedIndicator() { create("inst-vertical-speed-indicator"); } +void InstancedSubsystemTests::testKLN89() { create("kln89"); } +void InstancedSubsystemTests::testMagCompass() { create("magnetic-compass"); } +void InstancedSubsystemTests::testMasterReferenceGyro() { create("master-reference-gyro"); } +void InstancedSubsystemTests::testMK_VIII() { create("mk-viii"); } +void InstancedSubsystemTests::testNavRadio() { create("nav-radio"); } +void InstancedSubsystemTests::testRadarAltimeter() { create("radar-altimeter"); } +void InstancedSubsystemTests::testSlipSkidBall() { create("slip-skid-ball"); } +void InstancedSubsystemTests::testTACAN() { create("tacan"); } +void InstancedSubsystemTests::testTCAS() { create("tcas"); } +void InstancedSubsystemTests::testTransponder() { create("transponder"); } +void InstancedSubsystemTests::testTurnIndicator() { create("turn-indicator"); } +void InstancedSubsystemTests::testVerticalSpeedIndicator() { create("vertical-speed-indicator"); } diff --git a/test_suite/system_tests/subsystems/test_instanced_creation.hxx b/test_suite/system_tests/subsystems/test_instanced_creation.hxx new file mode 100644 index 000000000..891711768 --- /dev/null +++ b/test_suite/system_tests/subsystems/test_instanced_creation.hxx @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2018 Edward d'Auvergne + * + * This file is part of the program FlightGear. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef _FG_INSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX +#define _FG_INSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX + + +#include +#include + +#include + + +// The system tests. +class InstancedSubsystemTests : public CppUnit::TestFixture +{ + // Set up the test suite. + CPPUNIT_TEST_SUITE(InstancedSubsystemTests); + //CPPUNIT_TEST(testADF); // Not registered yet. + //CPPUNIT_TEST(testAirspeedIndicator); // Not registered yet. + //CPPUNIT_TEST(testAltimeter); // Not registered yet. + //CPPUNIT_TEST(testAttitudeIndicator); // Not registered yet. + //CPPUNIT_TEST(testCommRadio); // Not registered yet. + //CPPUNIT_TEST(testClock); // Not registered yet. + //CPPUNIT_TEST(testDME); // Not registered yet. + //CPPUNIT_TEST(testFGKR_87); // Not registered yet. + //CPPUNIT_TEST(testFGMarkerBeacon); // Not registered yet. + //CPPUNIT_TEST(testFGNavRadio); // Not registered yet. + //CPPUNIT_TEST(testGPS); // Not registered yet. + //CPPUNIT_TEST(testGSDI); // Not registered yet. + //CPPUNIT_TEST(testHeadingIndicator); // Not registered yet. + //CPPUNIT_TEST(testHeadingIndicatorDG); // Not registered yet. + //CPPUNIT_TEST(testHeadingIndicatorFG); // Not registered yet. + //CPPUNIT_TEST(testHUD); // Segfault. + //CPPUNIT_TEST(testInstVerticalSpeedIndicator); // Not registered yet. + //CPPUNIT_TEST(testKLN89); // Not registered yet. + //CPPUNIT_TEST(testMagCompass); // Not registered yet. + //CPPUNIT_TEST(testMasterReferenceGyro); // Not registered yet. + //CPPUNIT_TEST(testMK_VIII); // Not registered yet. + //CPPUNIT_TEST(testNavRadio); // Segfault. + //CPPUNIT_TEST(testRadarAltimeter); // Not registered yet. + //CPPUNIT_TEST(testSlipSkidBall); // Not registered yet. + //CPPUNIT_TEST(testTACAN); // Not registered yet. + //CPPUNIT_TEST(testTCAS); // Not registered yet. + //CPPUNIT_TEST(testTransponder); // Not registered yet. + //CPPUNIT_TEST(testTurnIndicator); // Not registered yet. + //CPPUNIT_TEST(testVerticalSpeedIndicator); // Not registered yet. + CPPUNIT_TEST_SUITE_END(); + +public: + // Set up function for each test. + void setUp(); + + // Clean up after each test. + void tearDown(); + + // The subsystem tests. + void testADF(); + void testAirspeedIndicator(); + void testAltimeter(); + void testAttitudeIndicator(); + void testClock(); + void testCommRadio(); + void testDME(); + void testFGKR_87(); + void testFGMarkerBeacon(); + void testFGNavRadio(); + void testGPS(); + void testGSDI(); + void testHeadingIndicator(); + void testHeadingIndicatorDG(); + void testHeadingIndicatorFG(); + void testHUD(); + void testInstVerticalSpeedIndicator(); + void testKLN89(); + void testMagCompass(); + void testMasterReferenceGyro(); + void testMK_VIII(); + void testNavRadio(); + void testRadarAltimeter(); + void testSlipSkidBall(); + void testTACAN(); + void testTCAS(); + void testTransponder(); + void testTurnIndicator(); + void testVerticalSpeedIndicator(); + +private: + // The subsystem manager. + std::unique_ptr _mgr; + + // Helper functions. + void create(const char* name); +}; + +#endif // _FG_INSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX diff --git a/test_suite/system_tests/subsystems/test_noninstanced_creation.cxx b/test_suite/system_tests/subsystems/test_noninstanced_creation.cxx new file mode 100644 index 000000000..3a1b87b37 --- /dev/null +++ b/test_suite/system_tests/subsystems/test_noninstanced_creation.cxx @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2018 Edward d'Auvergne + * + * This file is part of the program FlightGear. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "test_suite/FGTestApi/testGlobals.hxx" + +#include "test_noninstanced_creation.hxx" + + +// Set up function for each test. +void NonInstancedSubsystemTests::setUp() +{ + // First set up the globals object. + FGTestApi::setUp::initTestGlobals("NonInstancedSubsystemCreationTests"); + + // The subsystem manager. + _mgr.reset(new SGSubsystemMgr()); +} + + +// Clean up after each test. +void NonInstancedSubsystemTests::tearDown() +{ + // Remove the manager. + _mgr.reset(); + + // Clean up globals. + FGTestApi::tearDown::shutdownTestGlobals(); +} + + +// Helper functions. +void NonInstancedSubsystemTests::create(const char* name) +{ + // Create the subsystem. + _mgr->add(name); + auto sub = _mgr->get_subsystem(name); + + // Check the subsystem. + CPPUNIT_ASSERT(sub); + CPPUNIT_ASSERT_EQUAL(sub->subsystemId(), std::string(name)); + CPPUNIT_ASSERT_EQUAL(sub->subsystemClassId(), std::string(name)); + CPPUNIT_ASSERT_EQUAL(sub->subsystemInstanceId(), std::string()); +} + + +// The non-instanced subsystems. +void NonInstancedSubsystemTests::testagRadar() { create("air-ground-radar"); } +void NonInstancedSubsystemTests::testAirportDynamicsManager() { create("airport-dynamics"); } +void NonInstancedSubsystemTests::testAreaSampler() { create("area"); } +void NonInstancedSubsystemTests::testAutopilot() { create("autopilot"); } +void NonInstancedSubsystemTests::testCanvasMgr() { create("Canvas"); } +void NonInstancedSubsystemTests::testCockpitDisplayManager() { create("cockpit-displays"); } +void NonInstancedSubsystemTests::testDigitalFilter() { create("filter"); } +void NonInstancedSubsystemTests::testEphemeris() { create("ephemeris"); } +void NonInstancedSubsystemTests::testErrorReporter() { create("error-reporting"); } +void NonInstancedSubsystemTests::testFDMShell() { create("flight"); } +void NonInstancedSubsystemTests::testFGACMS() { create("acms"); } +void NonInstancedSubsystemTests::testFGADA() { create("ada"); } +void NonInstancedSubsystemTests::testFGAIManager() { create("ai-model"); } +void NonInstancedSubsystemTests::testFGAircraftModel() { create("aircraft-model"); } +void NonInstancedSubsystemTests::testFGATCManager() { create("ATC"); } +void NonInstancedSubsystemTests::testFGBalloonSim() { create("balloon"); } +void NonInstancedSubsystemTests::testFGCom() { create("fgcom"); } +void NonInstancedSubsystemTests::testFGControls() { create("controls"); } +void NonInstancedSubsystemTests::testFGDNSClient() { create("dns"); } +void NonInstancedSubsystemTests::testFGElectricalSystem() { create("electrical"); } +void NonInstancedSubsystemTests::testFGEnvironmentMgr() { create("environment"); } +void NonInstancedSubsystemTests::testFGExternalNet() { create("network"); } +void NonInstancedSubsystemTests::testFGExternalPipe() { create("pipe"); } +void NonInstancedSubsystemTests::testFGFlightHistory() { create("history"); } +void NonInstancedSubsystemTests::testFGHIDEventInput() { create("input-event-hid"); } +void NonInstancedSubsystemTests::testFGHTTPClient() { create("http"); } +void NonInstancedSubsystemTests::testFGHttpd() { create("httpd"); } +void NonInstancedSubsystemTests::testFGInput() { create("input"); } +void NonInstancedSubsystemTests::testFGInstrumentMgr() { create("instrumentation"); } +void NonInstancedSubsystemTests::testFGInterpolator() { create("prop-interpolator"); } +void NonInstancedSubsystemTests::testFGIO() { create("io"); } +void NonInstancedSubsystemTests::testFGJoystickInput() { create("input-joystick"); } +void NonInstancedSubsystemTests::testFGJSBsim() { create("jsb"); } +void NonInstancedSubsystemTests::testFGKeyboardInput() { create("input-keyboard"); } +void NonInstancedSubsystemTests::testFGLaRCsim() { create("larcsim"); } +void NonInstancedSubsystemTests::testFGLight() { create("lighting"); } +void NonInstancedSubsystemTests::testFGLinuxEventInput() { create("input-event"); } +void NonInstancedSubsystemTests::testFGLogger() { create("logger"); } +void NonInstancedSubsystemTests::testFGMacOSXEventInput() { create("input-event"); } +void NonInstancedSubsystemTests::testFGMagicCarpet() { create("magic"); } +void NonInstancedSubsystemTests::testFGMagVarManager() { create("magvar"); } +void NonInstancedSubsystemTests::testFGModelMgr() { create("model-manager"); } +void NonInstancedSubsystemTests::testFGMouseInput() { create("input-mouse"); } +void NonInstancedSubsystemTests::testFGMultiplayMgr() { create("mp"); } +void NonInstancedSubsystemTests::testFGNasalSys() { create("nasal"); } +void NonInstancedSubsystemTests::testFGNullFDM() { create("null"); } +void NonInstancedSubsystemTests::testFGPanel() { create("panel"); } +void NonInstancedSubsystemTests::testFGPrecipitationMgr() { create("precipitation"); } +void NonInstancedSubsystemTests::testFGProperties() { create("properties"); } +void NonInstancedSubsystemTests::testFGReplay() { create("replay"); } +void NonInstancedSubsystemTests::testFGRidgeLift() { create("ridgelift"); } +void NonInstancedSubsystemTests::testFGRouteMgr() { create("route-manager"); } +void NonInstancedSubsystemTests::testFGScenery() { create("scenery"); } +void NonInstancedSubsystemTests::testFGSoundManager() { create("sound"); } +void NonInstancedSubsystemTests::testFGSubmodelMgr() { create("submodel-mgr"); } +void NonInstancedSubsystemTests::testFGSystemMgr() { create("systems"); } +void NonInstancedSubsystemTests::testFGTrafficManager() { create("traffic-manager"); } +void NonInstancedSubsystemTests::testFGUFO() { create("ufo"); } +void NonInstancedSubsystemTests::testFGViewMgr() { create("view-manager"); } +void NonInstancedSubsystemTests::testFGVoiceMgr() { create("voice"); } +void NonInstancedSubsystemTests::testFGXMLAutopilotGroup() { create("xml-rules"); } +void NonInstancedSubsystemTests::testFlipFlop() { create("flipflop"); } +void NonInstancedSubsystemTests::testGraphicsPresets() { create("graphics-presets"); } +void NonInstancedSubsystemTests::testGroundRadar() { create("groundradar"); } +void NonInstancedSubsystemTests::testGUIMgr() { create("CanvasGUI"); } +void NonInstancedSubsystemTests::testHighlight() { create("reflect"); } +void NonInstancedSubsystemTests::testInstrumentGroup() { create("instruments"); } +void NonInstancedSubsystemTests::testLogic() { create("logic"); } +void NonInstancedSubsystemTests::testNavDisplay() { create("navigation-display"); } +void NonInstancedSubsystemTests::testNewGUI() { create("gui"); } +void NonInstancedSubsystemTests::testNoaaMetarRealWxController() { create("noaa-metar"); } +void NonInstancedSubsystemTests::testPerformanceDB() { create("aircraft-performance-db"); } +void NonInstancedSubsystemTests::testPIDController() { create("pid-controller"); } +void NonInstancedSubsystemTests::testPISimpleController() { create("pi-simple-controller"); } +void NonInstancedSubsystemTests::testPitotSystem() { create("pitot"); } +void NonInstancedSubsystemTests::testPredictor() { create("predict-simple"); } +void NonInstancedSubsystemTests::testSGEventMgr() { create("events"); } +void NonInstancedSubsystemTests::testSGPerformanceMonitor() { create("performance-mon"); } +void NonInstancedSubsystemTests::testSGSoundMgr() { create("sound"); } +void NonInstancedSubsystemTests::testSGTerraSync() { create("terrasync"); } +void NonInstancedSubsystemTests::testStateMachineComponent() { create("state-machine"); } +void NonInstancedSubsystemTests::testStaticSystem() { create("static"); } +void NonInstancedSubsystemTests::testTimeManager() { create("time"); } +void NonInstancedSubsystemTests::testVacuumSystem() { create("vacuum"); } +void NonInstancedSubsystemTests::testView() { create("view"); } +void NonInstancedSubsystemTests::testwxRadarBg() { create("radar"); } +void NonInstancedSubsystemTests::testYASim() { create("yasim"); } diff --git a/test_suite/system_tests/subsystems/test_noninstanced_creation.hxx b/test_suite/system_tests/subsystems/test_noninstanced_creation.hxx new file mode 100644 index 000000000..65404c71d --- /dev/null +++ b/test_suite/system_tests/subsystems/test_noninstanced_creation.hxx @@ -0,0 +1,229 @@ +/* + * Copyright (C) 2018 Edward d'Auvergne + * + * This file is part of the program FlightGear. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef _FG_NONINSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX +#define _FG_NONINSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX + + +#include +#include + +#include + + +// The system tests. +class NonInstancedSubsystemTests : public CppUnit::TestFixture +{ + // Set up the test suite. + CPPUNIT_TEST_SUITE(NonInstancedSubsystemTests); + //CPPUNIT_TEST(testagRadar); // Not registered yet. + CPPUNIT_TEST(testAirportDynamicsManager); + //CPPUNIT_TEST(testAreaSampler); // Not registered yet. + //CPPUNIT_TEST(testAutopilot); // Not registered yet. + CPPUNIT_TEST(testCanvasMgr); + CPPUNIT_TEST(testCockpitDisplayManager); + CPPUNIT_TEST(testDigitalFilter); + CPPUNIT_TEST(testEphemeris); + CPPUNIT_TEST(testErrorReporter); + CPPUNIT_TEST(testFDMShell); + //CPPUNIT_TEST(testFGACMS); // Not registered yet. + //CPPUNIT_TEST(testFGADA); // Not registered yet. + CPPUNIT_TEST(testFGAIManager); + CPPUNIT_TEST(testFGAircraftModel); + CPPUNIT_TEST(testFGATCManager); + //CPPUNIT_TEST(testFGBalloonSim); // Not registered yet. + CPPUNIT_TEST(testFGCom); + CPPUNIT_TEST(testFGControls); + CPPUNIT_TEST(testFGDNSClient); + //CPPUNIT_TEST(testFGElectricalSystem); // Not registered yet. + //CPPUNIT_TEST(testFGEnvironmentMgr); // Segfault. + //CPPUNIT_TEST(testFGExternalNet); // Not registered yet. + //CPPUNIT_TEST(testFGExternalPipe); // Not registered yet. + CPPUNIT_TEST(testFGFlightHistory); + CPPUNIT_TEST(testFGHIDEventInput); + CPPUNIT_TEST(testFGHTTPClient); + //CPPUNIT_TEST(testFGHttpd); // Not registered yet. + //CPPUNIT_TEST(testFGInput); // Segfault. + CPPUNIT_TEST(testFGInstrumentMgr); + CPPUNIT_TEST(testFGInterpolator); + CPPUNIT_TEST(testFGIO); + //CPPUNIT_TEST(testFGJoystickInput); // Segfault. + //CPPUNIT_TEST(testFGJSBsim); // Not registered yet. + CPPUNIT_TEST(testFGKeyboardInput); + //CPPUNIT_TEST(testFGLaRCsim); // Not registered yet. + CPPUNIT_TEST(testFGLight); + //CPPUNIT_TEST(testFGLinuxEventInput); // Need to handle #define INPUTEVENT_CLASS FGLinuxEventInput. + CPPUNIT_TEST(testFGLogger); + //CPPUNIT_TEST(testFGMacOSXEventInput); // Need to handle #define INPUTEVENT_CLASS FGMacOSXEventInput. + //CPPUNIT_TEST(testFGMagicCarpet); // Not registered yet. + CPPUNIT_TEST(testFGMagVarManager); + CPPUNIT_TEST(testFGModelMgr); + CPPUNIT_TEST(testFGMouseInput); + //CPPUNIT_TEST(testFGMultiplayMgr); // double free or corruption (fasttop): 0x0000000006423860 + CPPUNIT_TEST(testFGNasalSys); + //CPPUNIT_TEST(testFGNullFDM); // Not registered yet. + //CPPUNIT_TEST(testFGPanel); // Not registered yet. + //CPPUNIT_TEST(testFGPrecipitationMgr); // Segfault. + CPPUNIT_TEST(testFGProperties); + //CPPUNIT_TEST(testFGReplay); // Segfault. + CPPUNIT_TEST(testFGRidgeLift); + //CPPUNIT_TEST(testFGRouteMgr); // Partially unstable (sometimes segfault or sometimes double free or corruption). + //CPPUNIT_TEST(testFGScenery); // Segfault. + CPPUNIT_TEST(testFGSoundManager); + CPPUNIT_TEST(testFGSubmodelMgr); + CPPUNIT_TEST(testFGSystemMgr); + CPPUNIT_TEST(testFGTrafficManager); + //CPPUNIT_TEST(testFGUFO); // Not registered yet. + //CPPUNIT_TEST(testFGViewMgr); // Not registered yet. + CPPUNIT_TEST(testFGVoiceMgr); + //CPPUNIT_TEST(testFGXMLAutopilotGroup); // Not registered yet. + CPPUNIT_TEST(testFlipFlop); + CPPUNIT_TEST(testGraphicsPresets); + //CPPUNIT_TEST(testGroundRadar); // Not registered yet. + CPPUNIT_TEST(testGUIMgr); + CPPUNIT_TEST(testHighlight); + //CPPUNIT_TEST(testInstrumentGroup); // Not registered yet. + CPPUNIT_TEST(testLogic); + //CPPUNIT_TEST(testNavDisplay); // Not registered yet. + //CPPUNIT_TEST(testNewGUI); // double free or corruption (fasttop): 0x000000000701d950 + //CPPUNIT_TEST(testNoaaMetarRealWxController); // Not registered yet. + CPPUNIT_TEST(testPerformanceDB); + CPPUNIT_TEST(testPIDController); + CPPUNIT_TEST(testPISimpleController); + //CPPUNIT_TEST(testPitotSystem); // Not registered yet. + CPPUNIT_TEST(testPredictor); + CPPUNIT_TEST(testSGEventMgr); + //CPPUNIT_TEST(testSGPerformanceMonitor); // Not registered yet. + CPPUNIT_TEST(testSGSoundMgr); + CPPUNIT_TEST(testSGTerraSync); + //CPPUNIT_TEST(testStateMachineComponent); // Not registered yet. + //CPPUNIT_TEST(testStaticSystem); // Not registered yet. + //CPPUNIT_TEST(testTimeManager); // Segfault. + //CPPUNIT_TEST(testVacuumSystem); // Not registered yet. + //CPPUNIT_TEST(testView); // Not registered yet. + //CPPUNIT_TEST(testwxRadarBg); // Not registered yet. + //CPPUNIT_TEST(testYASim); // Not registered yet. + CPPUNIT_TEST_SUITE_END(); + +public: + // Set up function for each test. + void setUp(); + + // Clean up after each test. + void tearDown(); + + // The subsystem tests. + void testagRadar(); + void testAirportDynamicsManager(); + void testAreaSampler(); + void testAutopilot(); + void testCanvasMgr(); + void testCockpitDisplayManager(); + void testDigitalFilter(); + void testEphemeris(); + void testErrorReporter(); + void testFDMShell(); + void testFGACMS(); + void testFGADA(); + void testFGAIManager(); + void testFGAircraftModel(); + void testFGATCManager(); + void testFGBalloonSim(); + void testFGCom(); + void testFGControls(); + void testFGDNSClient(); + void testFGElectricalSystem(); + void testFGEnvironmentMgr(); + void testFGExternalNet(); + void testFGExternalPipe(); + void testFGFlightHistory(); + void testFGHIDEventInput(); + void testFGHTTPClient(); + void testFGHttpd(); + void testFGInput(); + void testFGInstrumentMgr(); + void testFGInterpolator(); + void testFGIO(); + void testFGJoystickInput(); + void testFGJSBsim(); + void testFGKeyboardInput(); + void testFGLaRCsim(); + void testFGLight(); + void testFGLinuxEventInput(); + void testFGLogger(); + void testFGMacOSXEventInput(); + void testFGMagicCarpet(); + void testFGMagVarManager(); + void testFGModelMgr(); + void testFGMouseInput(); + void testFGMultiplayMgr(); + void testFGNasalSys(); + void testFGNullFDM(); + void testFGPanel(); + void testFGPrecipitationMgr(); + void testFGProperties(); + void testFGReplay(); + void testFGRidgeLift(); + void testFGRouteMgr(); + void testFGScenery(); + void testFGSoundManager(); + void testFGSubmodelMgr(); + void testFGSystemMgr(); + void testFGTrafficManager(); + void testFGUFO(); + void testFGViewMgr(); + void testFGVoiceMgr(); + void testFGXMLAutopilotGroup(); + void testFlipFlop(); + void testGraphicsPresets(); + void testGroundRadar(); + void testGUIMgr(); + void testHighlight(); + void testInstrumentGroup(); + void testLogic(); + void testNavDisplay(); + void testNewGUI(); + void testNoaaMetarRealWxController(); + void testPerformanceDB(); + void testPIDController(); + void testPISimpleController(); + void testPitotSystem(); + void testPredictor(); + void testSGEventMgr(); + void testSGPerformanceMonitor(); + void testSGSoundMgr(); + void testSGTerraSync(); + void testStateMachineComponent(); + void testStaticSystem(); + void testTimeManager(); + void testVacuumSystem(); + void testView(); + void testwxRadarBg(); + void testYASim(); + +private: + // The subsystem manager. + std::unique_ptr _mgr; + + // Helper functions. + void create(const char* name); +}; + +#endif // _FG_NONINSTANCED_SUBSYSTEM_SYSTEM_TESTS_HXX