diff --git a/CMakeLists.txt b/CMakeLists.txt index acbb835e5..812ce94c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -568,12 +568,6 @@ if(ENABLE_TESTS) include (Dart) enable_testing() - if(WIN32) - # tests disabled until shared library export is fixed on Windows - message(STATUS "Tests disabled on Windows for the moment") - else() - add_subdirectory(tests) - endif() else() message(STATUS "Tests: DISABLED") endif(ENABLE_TESTS) diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index b05dfc9d0..000000000 --- a/tests/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -est-epsilon -al-info -alcinfo -gl-info -test-env-map -test-gethostname -test-mktime -test-text -test-up diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index d94d32257..000000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,117 +0,0 @@ - -set(sources - Main/options.cxx - Main/fg_commands.cxx - Main/fg_props.cxx - Main/globals.cxx - Main/locale.cxx - Main/util.cxx - Main/positioninit.cxx - Add-ons/Addon.cxx - Add-ons/AddonManager.cxx - Add-ons/AddonMetadataParser.cxx - Add-ons/AddonResourceProvider.cxx - Add-ons/AddonVersion.cxx - Add-ons/contacts.cxx - Add-ons/exceptions.cxx - Aircraft/controls.cxx - Aircraft/FlightHistory.cxx - Aircraft/flightrecorder.cxx - Aircraft/replay.cxx - Autopilot/route_mgr.cxx - Airports/airport.cxx - Airports/airport.hxx - Airports/apt_loader.cxx - Airports/airportdynamicsmanager.cxx - Airports/airportdynamicsmanager.hxx - Airports/dynamicloader.cxx - Airports/dynamics.cxx - Airports/xmlloader.cxx - Airports/runwaybase.cxx - Airports/pavement.cxx - Airports/parking.cxx - Airports/groundnetwork.cxx - Airports/gnnode.cxx - Airports/runways.cxx - Airports/runwayprefs.cxx - Airports/runwayprefloader.cxx - ATC/CommStation.cxx -# ATC/GroundController.cxx -# ATC/atc_mgr.cxx - Environment/atmosphere.cxx - Environment/environment.cxx - Environment/environment_mgr.cxx - Environment/environment_ctrl.cxx - Environment/presets.cxx - Environment/gravity.cxx - Environment/ridge_lift.cxx - Environment/magvarmanager.cxx - Navaids/airways.cxx - Navaids/fixlist.cxx - Navaids/markerbeacon.cxx - Navaids/NavDataCache.cxx - Navaids/navdb.cxx - Navaids/navlist.cxx - Navaids/navrecord.cxx - Navaids/poidb.cxx - Navaids/procedure.cxx - Navaids/positioned.cxx - Navaids/PositionedOctree.cxx - Navaids/routePath.cxx - Navaids/route.cxx - Navaids/waypoint.cxx - Navaids/FlightPlan.cxx - Navaids/LevelDXML.cxx - Network/HTTPClient.cxx - Time/TimeManager.cxx - Time/bodysolver.cxx - Scripting/NasalSys.cxx - Scripting/NasalAddons.cxx - Scripting/NasalCondition.cxx - Scripting/NasalAircraft.cxx - Scripting/NasalString.cxx - Scripting/NasalPositioned.cxx - Scripting/NasalPositioned_cppbind.cxx - Scripting/nasal-props.cxx - Scripting/NasalSGPath.cxx - Scripting/NasalHTTP.cxx - Viewer/view.cxx - Viewer/viewmgr.cxx -) - -foreach(s ${sources}) - set_property(DIRECTORY APPEND PROPERTY fgtestlib_sources "${CMAKE_SOURCE_DIR}/src/${s}") -endforeach() - -set_property(DIRECTORY APPEND PROPERTY fgtestlib_sources "${CMAKE_SOURCE_DIR}/3rdparty/cjson/cJSON.c") - -get_property(fgtestlib_sources DIRECTORY PROPERTY fgtestlib_sources) - -add_library(fgtestlib SHARED ${fgtestlib_sources} - "${CMAKE_SOURCE_DIR}/test_suite/FGTestApi/globals.cxx" - "${CMAKE_SOURCE_DIR}/test_suite/dataStore.cxx" - testStubs.cxx - fake_sgSky.cxx - fake_sgPrecipitation.cxx - fake_sound.cxx) - -set_target_properties (fgtestlib - PROPERTIES - COMPILE_DEFINITIONS "FG_TESTLIB" -) - -if(FG_HAVE_GPERFTOOLS) - target_include_directories(fgtestlib PRIVATE ${GooglePerfTools_INCLUDE_DIR}) - target_link_libraries(fgtestlib ${GooglePerfTools_LIBRARIES}) -endif() -target_link_libraries(fgtestlib SimGearCore ${PLATFORM_LIBS} ${SQLITE3_LIBRARY}) - -add_executable(fgtest fgTestDriver.cxx) -target_link_libraries(fgtest fgtestlib) - -macro(flightgear_test name sources) - add_executable(${name} ${sources}) - target_include_directories(${name} PRIVATE ${CMAKE_SOURCE_DIR}/tests) - target_link_libraries(${name} fgtestlib) - add_test(${name} ${EXECUTABLE_OUTPUT_PATH}/${name}) -endmacro() diff --git a/tests/fake_sgPrecipitation.cxx b/tests/fake_sgPrecipitation.cxx deleted file mode 100644 index d81a911fb..000000000 --- a/tests/fake_sgPrecipitation.cxx +++ /dev/null @@ -1,17 +0,0 @@ - -#include - -FGPrecipitationMgr::FGPrecipitationMgr() -{ - -} - -FGPrecipitationMgr::~FGPrecipitationMgr() -{ - -} - -void FGPrecipitationMgr::bind () {} -void FGPrecipitationMgr::unbind () {} -void FGPrecipitationMgr::init () {} -void FGPrecipitationMgr::update (double dt) {} diff --git a/tests/fake_sgSky.cxx b/tests/fake_sgSky.cxx deleted file mode 100644 index 2940d5aa9..000000000 --- a/tests/fake_sgSky.cxx +++ /dev/null @@ -1,43 +0,0 @@ -#include "fake_sgSky.hxx" - -static const std::string sEmptyString; - -void SGSky::add_cloud_layer(SGCloudLayer *layer) -{ - _cloudLayers.push_back(layer); -} - -SGCloudLayer *SGSky::get_cloud_layer(int i) -{ - return _cloudLayers.at(i); -} - -int SGSky::get_cloud_layer_count() const -{ - return _cloudLayers.size(); -} - -void SGSky::set_clouds_enabled(bool enabled) -{ - _3dcloudsEnabled = enabled; -} - -const std::string &SGCloudLayer::getCoverageString() const -{ - return sEmptyString; -} - -const std::string &SGCloudLayer::getCoverageString(SGCloudLayer::Coverage coverage) -{ - return sEmptyString; -} - -void SGCloudLayer::setCoverageString(const std::string &coverage) -{ - -} - -void SGCloudLayer::set_enable3dClouds(bool enable) -{ - -} diff --git a/tests/fake_sgSky.hxx b/tests/fake_sgSky.hxx deleted file mode 100644 index 29c3c404b..000000000 --- a/tests/fake_sgSky.hxx +++ /dev/null @@ -1,338 +0,0 @@ -#ifndef FG_TEST_FAKE_SGSKY_HXX -#define FG_TEST_FAKE_SGSKY_HXX - -#include -#include -#include - -class SGCloudLayer : public SGReferenced { -public: - - /** - * This is the list of available cloud coverages/textures - */ - enum Coverage { - SG_CLOUD_OVERCAST = 0, - SG_CLOUD_BROKEN, - SG_CLOUD_SCATTERED, - SG_CLOUD_FEW, - SG_CLOUD_CIRRUS, - SG_CLOUD_CLEAR, - SG_MAX_CLOUD_COVERAGES - }; - - static const std::string SG_CLOUD_OVERCAST_STRING; // "overcast" - static const std::string SG_CLOUD_BROKEN_STRING; // "broken" - static const std::string SG_CLOUD_SCATTERED_STRING; // "scattered" - static const std::string SG_CLOUD_FEW_STRING; // "few" - static const std::string SG_CLOUD_CIRRUS_STRING; // "cirrus" - static const std::string SG_CLOUD_CLEAR_STRING; // "clear" - - /** - * Constructor - * @param tex_path the path to the set of cloud textures - */ - SGCloudLayer( const std::string &tex_path ) { } - - /** - * Destructor - */ - ~SGCloudLayer( void ) { } - - /** get the cloud span (in meters) */ - float getSpan_m () const - { return _spanM; } - /** - * set the cloud span - * @param span_m the cloud span in meters - */ - void setSpan_m (float span_m) - { _spanM = span_m; } - - /** get the layer elevation (in meters) */ - float getElevation_m () const - { - return _elevationM; - } - /** - * set the layer elevation. Note that this specifies the bottom - * of the cloud layer. The elevation of the top of the layer is - * elevation_m + thickness_m. - * @param elevation_m the layer elevation in meters - * @param set_span defines whether it is allowed to adjust the span - */ - void setElevation_m (float elevation_m, bool set_span = true) - { - _elevationM = elevation_m; - } - - /** get the layer thickness */ - float getThickness_m () const - { - return _thicknessM; - } - /** - * set the layer thickness. - * @param thickness_m the layer thickness in meters. - */ - void setThickness_m (float thickness_m) - { - _thicknessM = thickness_m; - } - - /** get the layer visibility */ - float getVisibility_m() const - { - return _visibilityM; - } - /** - * set the layer visibility - * @param visibility_m the layer minimum visibility in meters. - */ - void setVisibility_m(float visibility_m) - { - _visibilityM = visibility_m; - } - - - - /** - * get the transition/boundary layer depth in meters. This - * allows gradual entry/exit from the cloud layer via adjusting - * visibility. - */ - float getTransition_m () const - { - return _transitionM; - } - - /** - * set the transition layer size in meters - * @param transition_m the transition layer size in meters - */ - void setTransition_m (float transition_m) - { - _transitionM = transition_m; - } - - /** get coverage type */ - Coverage getCoverage () const - { - return _coverage; - } - - /** - * set coverage type - * @param coverage the coverage type - */ - void setCoverage (Coverage coverage) - { - _coverage = coverage; - } - - /** get coverage as string */ - const std::string & getCoverageString() const; - - /** get coverage as string */ - static const std::string & getCoverageString( Coverage coverage ); - - /** get coverage type from string */ - static Coverage getCoverageType( const std::string & coverage ); - - /** set coverage as string */ - void setCoverageString( const std::string & coverage ); - - /** - * set the cloud movement direction - * @param dir the cloud movement direction - */ - inline void setDirection(float dir) { - // cout << "cloud dir = " << dir << endl; - direction = dir; - } - - /** get the cloud movement direction */ - inline float getDirection() { return direction; } - - /** - * set the cloud movement speed - * @param sp the cloud movement speed - */ - inline void setSpeed(float sp) { - // cout << "cloud speed = " << sp << endl; - speed = sp; - } - - /** get the cloud movement speed */ - float getSpeed() { return speed; } - - void setAlpha( float alpha ); - - void setMaxAlpha( float alpha ) - { - _maxAlpha = alpha; - } - - float getMaxAlpha() const - { - return _maxAlpha; - } - - /** Enable/disable 3D clouds in this layer */ - void set_enable3dClouds(bool enable); -private: - float _spanM = 0.0f; -float _elevationM = 0.0f; -float _thicknessM = 0.0f; -float _transitionM = 0.0f; -float _visibilityM = 0.0f; -Coverage _coverage; -float scale = 0.0f; -float speed = 0.0f; -float direction = 0.0f; -float _maxAlpha = 0.0f; -}; - - - -class SGSky -{ -public: - - - void add_cloud_layer (SGCloudLayer * layer); - - const SGCloudLayer * get_cloud_layer (int i) const - { - return _cloudLayers.at(i); - } - - SGCloudLayer * get_cloud_layer (int i); - - int get_cloud_layer_count () const; - - -/** @return current effective visibility */ -float get_visibility() const -{ return _visibility; } - -/** Set desired clear air visibility. -* @param v visibility in meters -*/ -void set_visibility( float v ) -{ _visibility = v; } - -/** Get 3D cloud density */ -double get_3dCloudDensity() const -{ - return _3dcloudDensity; -} - -/** Set 3D cloud density -* @param density 3D cloud density -*/ -void set_3dCloudDensity(double density) -{ - _3dcloudDensity = density; -} - -/** Get 3D cloud visibility range*/ -float get_3dCloudVisRange() const -{ - return _3dcloudVisRange; -} - -/** Set 3D cloud visibility range -* -* @param vis 3D cloud visibility range -*/ -void set_3dCloudVisRange(float vis) -{ - _3dcloudVisRange = vis; -} - -/** Get 3D cloud impostor distance*/ -float get_3dCloudImpostorDistance() const -{ - return _3dcloudImpostorDistance; -} - -/** Set 3D cloud impostor distance -* -* @param vis 3D cloud impostor distance -*/ -void set_3dCloudImpostorDistance(float vis) -{ - _3dcloudImpostorDistance = vis; -} - -/** Get 3D cloud LoD1 Range*/ -float get_3dCloudLoD1Range() const -{ - return _3dcloudLoDRange1; -} - -/** Set 3D cloud LoD1 Range -* @param vis LoD1 Range -*/ -void set_3dCloudLoD1Range(float vis) -{ - _3dcloudLoDRange1 = vis; -} - -/** Get 3D cloud LoD2 Range*/ -float get_3dCloudLoD2Range() const -{ - return _3dcloudLoDRange2; -} - -/** Set 3D cloud LoD2 Range -* @param vis LoD2 Range -*/ -void set_3dCloudLoD2Range(float vis) -{ - _3dcloudLoDRange2 = vis; -} - -/** Get 3D cloud impostor usage */ -bool get_3dCloudUseImpostors() const -{ - return _3dcloudUSeImpostors; -} - -/** Set 3D cloud impostor usage -* -* @param imp whether use impostors for 3D clouds -*/ -void set_3dCloudUseImpostors(bool imp) -{ - _3dcloudUSeImpostors = imp; -} - -/** Get 3D cloud wrapping */ -bool get_3dCloudWrap() const -{ return _3dcloudWrap; } - -/** Set 3D cloud wrapping -* @param wrap whether to wrap 3D clouds -*/ -void set_3dCloudWrap(bool wrap) -{ _3dcloudWrap = wrap; } - -void set_clouds_enabled(bool enabled); - -private: - float _visibility = 0.0; - bool _3dcloudsEnabled = false; - bool _3dcloudWrap = false; - bool _3dcloudUSeImpostors = false; - float _3dcloudImpostorDistance = 0.0; - float _3dcloudLoDRange1 = 0.0; - float _3dcloudLoDRange2 = 0.0; - float _3dcloudVisRange = 0.0; - float _3dcloudDensity = 0.0; - - std::vector _cloudLayers; -}; - -#endif diff --git a/tests/fake_sound.cxx b/tests/fake_sound.cxx deleted file mode 100644 index 5aed290a9..000000000 --- a/tests/fake_sound.cxx +++ /dev/null @@ -1,57 +0,0 @@ -#include - -class SGSoundMgr::SoundManagerPrivate -{ -public: -}; - -SGSoundMgr::SGSoundMgr() -{ - -} - -SGSoundMgr::~SGSoundMgr() -{ - -} - -void SGSoundMgr::init() -{ - -} - -void SGSoundMgr::stop() -{ - - -} - -void SGSoundMgr::suspend() -{ - -} - -void SGSoundMgr::resume() -{ - -} - -void SGSoundMgr::update(double dt) -{ -} - -void SGSoundMgr::reinit() -{ - -} - -bool SGSoundMgr::load(const std::string &samplepath, void **data, int *format, size_t *size, int *freq, int *block) -{ - return false; -} - -std::vector SGSoundMgr::get_available_devices() -{ - std::vector result; - return result; -} diff --git a/tests/fgTestDriver.cxx b/tests/fgTestDriver.cxx deleted file mode 100644 index 1a72029a6..000000000 --- a/tests/fgTestDriver.cxx +++ /dev/null @@ -1,77 +0,0 @@ -#include - -#include -#include -#include - -class TestStep -{ -public: - virtual void run() = 0; - // name for logging purposes -}; - -typedef std::vector TestStepSequence; - -class SimulateStep : public TestStep -{ -public: - void run() override - { - - } - -private: - double m_count; - double m_dt; - - SGGeod m_endPosition; - double m_endHeadingTrueDeg; - // other fake FDM data -}; - -class CommandStep : public TestStep -{ -public: - void run() override - { - // build the command and run it - } -private: - SGPropertyNode_ptr m_cmd; -}; - -class CheckStep : public TestStep -{ -public: - void run() override - { - for (auto cond : m_conditions) { - // eval - - // if failed, boom - } - } - -private: - std::vector m_conditions; -}; - -int main(int argc, char* argv[]) -{ - // parse XML - - // find test name - - // wipe working dir - - // create working dir - - // build test stages - - // read and create subsystems - - // execute in turn - - return EXIT_SUCCESS; -} diff --git a/tests/testStubs.cxx b/tests/testStubs.cxx deleted file mode 100644 index c9f632173..000000000 --- a/tests/testStubs.cxx +++ /dev/null @@ -1,410 +0,0 @@ -#include -#include - -#include -#include - -#include
-#include
-#include -#include -#include -#include -#include -#include - -// declared extern in main.hxx -std::string hostname; - -string fgBasePackageVersion(const SGPath& base_path) -{ - return ""; -} - -void fgHiResDump() -{ -} - -void fgDumpSnapShot() -{ - -} - -void fgCancelSnapShot() -{ - -} - -void fgDumpSceneGraph() -{ - -} - -void fgOSFullScreen() -{ - -} - -void guiErrorMessage(const char *txt) -{ - -} - -void guiErrorMessage(const char *txt, const sg_throwable &throwable) -{ - -} - - -void fgPrintVisibleSceneInfoCommand() -{ - -} - - -void openBrowser(const std::string& s) -{ - -} - -void fgDumpTerrainBranch() -{ - -} - -void fgOSExit(int code) -{ -} - -void postinitNasalGUI(naRef globals, naContext c) -{ - -} - -int fgGetKeyModifiers() -{ - return 0; -} - -void syncPausePopupState() -{ - -} -void -SGSetTextureFilter( int max) -{ - -} - -int -SGGetTextureFilter() -{ - return 0; -} - -bool FGScenery::get_elevation_m(const SGGeod& geod, double& alt, - const simgear::BVHMaterial** material, - const osg::Node* butNotFrom) -{ - return false; -} - -bool FGScenery::get_cart_ground_intersection(const SGVec3d& start, const SGVec3d& dir, - SGVec3d& nearestHit, - const osg::Node* butNotFrom) -{ - return false; -} - - -namespace flightgear -{ - MessageBoxResult modalMessageBox(const std::string& caption, - const std::string& msg, - const std::string& moreText) - { - return MSG_BOX_OK; - } - - MessageBoxResult fatalMessageBox(const std::string& caption, - const std::string& msg, - const std::string& moreText) - { - return MSG_BOX_OK; - } - - [[noreturn]] void fatalMessageBoxThenExit(const std::string& caption, - const std::string& msg, - const std::string& moreText, - int exitStatus) - { - exit(exitStatus); - } -} - -#ifdef __APPLE__ -string_list -FGLocale::getUserLanguage() -{ - string_list result; - const char* langEnv = ::getenv("LANG"); - if (langEnv) { - result.push_back(langEnv); - } - - return result; -} - -namespace flightgear -{ - -SGPath Options::platformDefaultRoot() const -{ - SGPath dataDir; - dataDir.append("data"); - return dataDir; -} - -} // of namespace flightgear - -#endif - - -FGATCController::FGATCController() -{ - -} - -FGATCController::~FGATCController() -{ - -} - -FGATCInstruction::FGATCInstruction() -{ - -} - -//////////////////////////////////////////////// - - -FGTowerController::FGTowerController(FGAirportDynamics*) -{ -} - -FGTowerController::~FGTowerController() -{ -} - -void FGTowerController::render(bool) -{ - -} - -void FGTowerController::signOff(int id) -{ -} - -std::string FGTowerController::getName() -{ - return "tower"; -} - -void FGTowerController::update(double dt) -{ - -} - -void FGTowerController::announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute, double lat, double lon, double hdg, double spd, double alt, double radius, int leg, FGAIAircraft *aircraft) -{ - -} - -void FGTowerController::updateAircraftInformation(int id, double lat, double lon, double heading, double speed, double alt, double dt) -{ - -} - -bool FGTowerController::hasInstruction(int id) -{ - return false; -} - -FGATCInstruction FGTowerController::getInstruction(int id) -{ - return FGATCInstruction(); -} - -////////////////////////////////////////////////////////////// -/// \brief FGApproachController::FGApproachController -/// -FGApproachController::FGApproachController(FGAirportDynamics*) -{ -} - -FGApproachController::~FGApproachController() -{ -} - - -void FGApproachController::render(bool) -{ - -} - -void FGApproachController::signOff(int id) -{ -} - -std::string FGApproachController::getName() -{ - return "approach"; -} - -void FGApproachController::update(double dt) -{ - -} - -void FGApproachController::announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute, double lat, double lon, double hdg, double spd, double alt, double radius, int leg, FGAIAircraft *aircraft) -{ - -} - -void FGApproachController::updateAircraftInformation(int id, double lat, double lon, double heading, double speed, double alt, double dt) -{ - -} - -bool FGApproachController::hasInstruction(int id) -{ - return false; -} - - -FGATCInstruction FGApproachController::getInstruction(int id) -{ - return FGATCInstruction(); -} - -////////////////////////////////////////////////////// - -FGStartupController::FGStartupController(FGAirportDynamics*) -{ -} - -FGStartupController::~FGStartupController() -{ -} - - -void FGStartupController::render(bool) -{ - -} - -void FGStartupController::signOff(int id) -{ -} - -std::string FGStartupController::getName() -{ - return "startup"; -} - -void FGStartupController::update(double dt) -{ - -} - -void FGStartupController::announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute, double lat, double lon, double hdg, double spd, double alt, double radius, int leg, FGAIAircraft *aircraft) -{ - -} - -void FGStartupController::updateAircraftInformation(int id, double lat, double lon, double heading, double speed, double alt, double dt) -{ - -} - -bool FGStartupController::hasInstruction(int id) -{ - return false; -} - - -FGATCInstruction FGStartupController::getInstruction(int id) -{ - return FGATCInstruction(); -} - -////////////////////////////////////////////////////// - -FGGroundController::FGGroundController() -{ -} - -FGGroundController::~FGGroundController() -{ -} - -void FGGroundController::init(FGAirportDynamics* pr) -{ - -} - -void FGGroundController::render(bool) -{ - -} - -void FGGroundController::signOff(int id) -{ -} - -std::string FGGroundController::getName() -{ - return "ground"; -} - -void FGGroundController::update(double dt) -{ - -} - -void FGGroundController::announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute, double lat, double lon, double hdg, double spd, double alt, double radius, int leg, FGAIAircraft *aircraft) -{ - -} - -void FGGroundController::updateAircraftInformation(int id, double lat, double lon, double heading, double speed, double alt, double dt) -{ - -} - -bool FGGroundController::hasInstruction(int id) -{ - return false; -} - - -FGATCInstruction FGGroundController::getInstruction(int id) -{ - return FGATCInstruction(); -} - - -#if defined(SG_WINDOWS) - -#include - -// this stub is needed on Windows because sg.h decleares this function as extern -void sgdMakeCoordMat4(sgdMat4 m, const SGDfloat x, const SGDfloat y, const SGDfloat z, const SGDfloat h, const SGDfloat p, const SGDfloat r) -{ -} -#endif - -FGTrafficRecord::~FGTrafficRecord() -{ - -}