From f6ae92ecf8f1fad60f41bdb8f3f012a2eb4e3391 Mon Sep 17 00:00:00 2001 From: Chris Birkhold Date: Sun, 24 Nov 2024 08:42:22 -0800 Subject: [PATCH] Fix: Don't pollute global namespace with std. (#1193) --- matlab/JSBSimInterface.cpp | 2 +- src/initialization/FGLinearization.h | 2 +- src/initialization/FGTrim.h | 2 +- src/input_output/FGPropertyManager.h | 6 +- src/math/FGParameterValue.h | 10 +- src/math/FGPropertyValue.cpp | 2 + src/models/FGAerodynamics.h | 4 +- src/models/FGAtmosphere.cpp | 2 + src/models/FGAtmosphere.h | 4 +- .../atmosphere/FGStandardAtmosphere.cpp | 2 + src/models/propulsion/FGTurbine.h | 4 +- src/simgear/props/props.cxx | 1 + src/simgear/props/props.hxx | 2 - tests/unit_tests/FGConditionTest.h | 208 +++++++++--------- tests/unit_tests/FGInitialConditionTest.h | 2 + tests/unit_tests/FGLocationTest.h | 2 + tests/unit_tests/FGMSISTest.h | 8 +- tests/unit_tests/FGParameterValueTest.h | 20 +- tests/unit_tests/FGPropertyValueTest.h | 10 +- tests/unit_tests/FGTableTest.h | 80 +++---- 20 files changed, 191 insertions(+), 182 deletions(-) diff --git a/matlab/JSBSimInterface.cpp b/matlab/JSBSimInterface.cpp index e0675a0172..ab850b0e59 100644 --- a/matlab/JSBSimInterface.cpp +++ b/matlab/JSBSimInterface.cpp @@ -81,7 +81,7 @@ JSBSimInterface::~JSBSimInterface(void) } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -bool JSBSimInterface::OpenAircraft(const string& acName) +bool JSBSimInterface::OpenAircraft(const std::string& acName) { if (!fdmExec->GetAircraft()->GetAircraftName().empty()) return false; diff --git a/src/initialization/FGLinearization.h b/src/initialization/FGLinearization.h index 58b59711a1..e64c0b95e5 100644 --- a/src/initialization/FGLinearization.h +++ b/src/initialization/FGLinearization.h @@ -40,7 +40,7 @@ class JSBSIM_API FGLinearization { Vector2D A,B,C,D; std::vector x0, u0, y0; - std::vector x_names, u_names, y_names, x_units, u_units, y_units; + std::vector x_names, u_names, y_names, x_units, u_units, y_units; std::string aircraft_name; public: /** diff --git a/src/initialization/FGTrim.h b/src/initialization/FGTrim.h index 8f1ef42c47..666b8cc70c 100644 --- a/src/initialization/FGTrim.h +++ b/src/initialization/FGTrim.h @@ -110,7 +110,7 @@ CLASS DOCUMENTATION fgic->SetAltitudeFtIC(1000); fgic->SetClimbRate(500); if( !fgt.DoTrim() ) { - cout << "Trim Failed" << endl; + std::cout << "Trim Failed" << std::endl; } fgt.Report(); @endcode diff --git a/src/input_output/FGPropertyManager.h b/src/input_output/FGPropertyManager.h index 07271f8cde..60da807519 100644 --- a/src/input_output/FGPropertyManager.h +++ b/src/input_output/FGPropertyManager.h @@ -468,15 +468,15 @@ class JSBSIM_API FGPropertyManager { SGPropertyNode* property = root->getNode(name.c_str(), true); if (!property) { - cerr << "Could not get or create property " << name << endl; + std::cerr << "Could not get or create property " << name << std::endl; return; } if (!property->tie(SGRawValuePointer(pointer), false)) - cerr << "Failed to tie property " << name << " to a pointer" << endl; + std::cerr << "Failed to tie property " << name << " to a pointer" << std::endl; else { tied_properties.push_back(PropertyState(property, nullptr)); - if (FGJSBBase::debug_lvl & 0x20) cout << name << endl; + if (FGJSBBase::debug_lvl & 0x20) std::cout << name << std::endl; } } diff --git a/src/math/FGParameterValue.h b/src/math/FGParameterValue.h index 2b38abcca8..be52560d9a 100644 --- a/src/math/FGParameterValue.h +++ b/src/math/FGParameterValue.h @@ -64,13 +64,13 @@ class JSBSIM_API FGParameterValue : public FGParameter FGParameterValue(Element* el, std::shared_ptr pm) : FGParameterValue(el->GetDataLine(), pm, el) { - string value = el->GetDataLine(); + std::string value = el->GetDataLine(); if (el->GetNumDataLines() != 1 || value.empty()) { - cerr << el->ReadFrom() - << "The element <" << el->GetName() - << "> must either contain a value number or a property name." - << endl; + std::cerr << el->ReadFrom() + << "The element <" << el->GetName() + << "> must either contain a value number or a property name." + << std::endl; throw BaseException("FGParameterValue: Illegal argument defining: " + el->GetName()); } } diff --git a/src/math/FGPropertyValue.cpp b/src/math/FGPropertyValue.cpp index cef989f510..e982b262de 100644 --- a/src/math/FGPropertyValue.cpp +++ b/src/math/FGPropertyValue.cpp @@ -33,6 +33,8 @@ INCLUDES #include "FGPropertyValue.h" +using namespace std; + namespace JSBSim { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/models/FGAerodynamics.h b/src/models/FGAerodynamics.h index 1952925369..b62370e143 100644 --- a/src/models/FGAerodynamics.h +++ b/src/models/FGAerodynamics.h @@ -278,8 +278,8 @@ class JSBSIM_API FGAerodynamics : public FGModel typedef double (FGAerodynamics::*PMF)(int) const; void DetermineAxisSystem(Element* document); void ProcessAxesNameAndFrame(FGAerodynamics::eAxisType& axisType, - const string& name, const string& frame, - Element* el, const string& validNames); + const std::string& name, const std::string& frame, + Element* el, const std::string& validNames); void bind(void); void BuildStabilityTransformMatrices(void); diff --git a/src/models/FGAtmosphere.cpp b/src/models/FGAtmosphere.cpp index 4ce21592bd..37f3d47c0f 100644 --- a/src/models/FGAtmosphere.cpp +++ b/src/models/FGAtmosphere.cpp @@ -46,6 +46,8 @@ INCLUDES #include "FGAtmosphere.h" #include "input_output/FGLog.h" +using namespace std; + namespace JSBSim { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/models/FGAtmosphere.h b/src/models/FGAtmosphere.h index c943b70aa0..79e4e33c74 100644 --- a/src/models/FGAtmosphere.h +++ b/src/models/FGAtmosphere.h @@ -268,12 +268,12 @@ class JSBSIM_API FGAtmosphere : public FGModel { /// Check that the pressure is within plausible boundaries. /// @param msg Message to display if the pressure is out of boundaries /// @param quiet Don't display the message if set to true - double ValidatePressure(double p, const string& msg, bool quiet=false) const; + double ValidatePressure(double p, const std::string& msg, bool quiet=false) const; /// Check that the temperature is within plausible boundaries. /// @param msg Message to display if the pressure is out of boundaries /// @param quiet Don't display the message if set to true - double ValidateTemperature(double t, const string& msg, bool quiet=false) const; + double ValidateTemperature(double t, const std::string& msg, bool quiet=false) const; /// @name ISA constants //@{ diff --git a/src/models/atmosphere/FGStandardAtmosphere.cpp b/src/models/atmosphere/FGStandardAtmosphere.cpp index f2c4f395ec..f735b7fb8b 100644 --- a/src/models/atmosphere/FGStandardAtmosphere.cpp +++ b/src/models/atmosphere/FGStandardAtmosphere.cpp @@ -51,6 +51,8 @@ INCLUDES #include "FGStandardAtmosphere.h" #include "input_output/FGLog.h" +using namespace std; + namespace JSBSim { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/models/propulsion/FGTurbine.h b/src/models/propulsion/FGTurbine.h index 663c06c701..413e2f283f 100644 --- a/src/models/propulsion/FGTurbine.h +++ b/src/models/propulsion/FGTurbine.h @@ -328,7 +328,7 @@ class FGSpoolUp : public FGParameter public: FGSpoolUp(FGTurbine* _turb, double BPR, double factor) : turb(_turb), delay(factor * 90.0 / (BPR + 3.0)) {} - string GetName(void) const { return string(); }; + std::string GetName(void) const { return std::string(); }; double GetValue(void) const { // adjust acceleration for N2 and atmospheric density double n = std::min(1.0, turb->N2norm + 0.1); @@ -345,7 +345,7 @@ class FGSimplifiedTSFC : public FGParameter FGSimplifiedTSFC(FGTurbine* _turb, double tsfcVal) : turb(_turb), tsfc(tsfcVal) {} - string GetName(void) const { return string(); } + std::string GetName(void) const { return std::string(); } double GetValue(void) const { // Correction/denormalisation for temp and thrust diff --git a/src/simgear/props/props.cxx b/src/simgear/props/props.cxx index f37bd10cef..42842025d1 100644 --- a/src/simgear/props/props.cxx +++ b/src/simgear/props/props.cxx @@ -52,6 +52,7 @@ using std::vector; using std::stringstream; using namespace simgear; +using namespace std; //////////////////////////////////////////////////////////////////////// // Local classes. diff --git a/src/simgear/props/props.hxx b/src/simgear/props/props.hxx index 5cf40023f3..b06aee9bdc 100644 --- a/src/simgear/props/props.hxx +++ b/src/simgear/props/props.hxx @@ -73,8 +73,6 @@ namespace boost { // XXX This whole file should be in the simgear namespace, but I don't // have the guts yet... -using namespace std; - namespace simgear { diff --git a/tests/unit_tests/FGConditionTest.h b/tests/unit_tests/FGConditionTest.h index 4757bd3768..159b09d475 100644 --- a/tests/unit_tests/FGConditionTest.h +++ b/tests/unit_tests/FGConditionTest.h @@ -11,12 +11,12 @@ class FGConditionTest : public CxxTest::TestSuite { public: void testXMLEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array XML{" x == 1.0 ", - " x EQ 1.0 ", - " x eq 1.0 "}; - for(const string& line: XML) { + const std::array XML{" x == 1.0 ", + " x EQ 1.0 ", + " x eq 1.0 "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -28,10 +28,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array conditions{"x == 1.0", "x EQ 1.0", "x eq 1.0"}; - for(const string& line: conditions) { + const std::array conditions{"x == 1.0", "x EQ 1.0", "x eq 1.0"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -42,12 +42,12 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLNotEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array XML{" x != 1.0 ", - " x NE 1.0 ", - " x ne 1.0 "}; - for(const string& line: XML) { + const std::array XML{" x != 1.0 ", + " x NE 1.0 ", + " x ne 1.0 "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -59,10 +59,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testNotEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array conditions{"x != 1.0", "x NE 1.0", "x ne 1.0"}; - for(const string& line: conditions) { + const std::array conditions{"x != 1.0", "x NE 1.0", "x ne 1.0"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -73,12 +73,12 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLGreaterThanConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array XML{" x > 1.0 ", + const std::array XML{" x > 1.0 ", " x GT 1.0 ", " x gt 1.0 "}; - for(const string& line: XML) { + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -92,10 +92,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testGreaterThanConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array conditions{"x > 1.0", "x GT 1.0", "x gt 1.0"}; - for(const string& line: conditions) { + const std::array conditions{"x > 1.0", "x GT 1.0", "x gt 1.0"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -108,12 +108,12 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLGreaterOrEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array XML{" x >= 1.0 ", + const std::array XML{" x >= 1.0 ", " x GE 1.0 ", " x ge 1.0 "}; - for(const string& line: XML) { + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -127,10 +127,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testGreaterOrEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array conditions{"x >= 1.0", "x GE 1.0", "x ge 1.0"}; - for(const string& line: conditions) { + const std::array conditions{"x >= 1.0", "x GE 1.0", "x ge 1.0"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -143,12 +143,12 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLLowerThanConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array XML{" x < 1.0 ", + const std::array XML{" x < 1.0 ", " x LT 1.0 ", " x lt 1.0 "}; - for(const string& line: XML) { + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -162,10 +162,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testLowerThanConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array conditions{"x < 1.0", "x LT 1.0", "x lt 1.0"}; - for(const string& line: conditions) { + const std::array conditions{"x < 1.0", "x LT 1.0", "x lt 1.0"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -178,12 +178,12 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLLowerOrEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array XML{" x <= 1.0 ", - " x LE 1.0 ", - " x le 1.0 "}; - for(const string& line: XML) { + const std::array XML{" x <= 1.0 ", + " x LE 1.0 ", + " x le 1.0 "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -197,10 +197,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testLowerOrEqualConstant() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); - const array conditions{"x <= 1.0", "x LE 1.0", "x le 1.0"}; - for(const string& line: conditions) { + const std::array conditions{"x <= 1.0", "x LE 1.0", "x le 1.0"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -213,13 +213,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" x == y ", - " x EQ y ", - " x eq y "}; - for(const string& line: XML) { + const std::array XML{" x == y ", + " x EQ y ", + " x eq y "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -238,11 +238,11 @@ class FGConditionTest : public CxxTest::TestSuite } void testEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array conditions{"x == y", "x EQ y", "x eq y"}; - for(const string& line: conditions) { + const std::array conditions{"x == y", "x EQ y", "x eq y"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -260,13 +260,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLNotEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" x != y ", - " x NE y ", - " x ne y "}; - for(const string& line: XML) { + const std::array XML{" x != y ", + " x NE y ", + " x ne y "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -285,11 +285,11 @@ class FGConditionTest : public CxxTest::TestSuite } void testNotEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array conditions{"x != y", "x NE y", "x ne y"}; - for(const string& line: conditions) { + const std::array conditions{"x != y", "x NE y", "x ne y"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(0.0); @@ -307,13 +307,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLGreaterThanProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" x > y ", - " x GT y ", - " x gt y "}; - for(const string& line: XML) { + const std::array XML{" x > y ", + " x GT y ", + " x gt y "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -336,11 +336,11 @@ class FGConditionTest : public CxxTest::TestSuite } void testGreaterThanProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array conditions{"x > y", "x GT y", "x gt y"}; - for(const string& line: conditions) { + const std::array conditions{"x > y", "x GT y", "x gt y"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(-1.0); @@ -362,13 +362,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLGreaterOrEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" x >= y ", - " x GE y ", - " x ge y "}; - for(const string& line: XML) { + const std::array XML{" x >= y ", + " x GE y ", + " x ge y "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -391,11 +391,11 @@ class FGConditionTest : public CxxTest::TestSuite } void testGreaterOrEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array conditions{"x >= y", "x GE y", "x ge y"}; - for(const string& line: conditions) { + const std::array conditions{"x >= y", "x GE y", "x ge y"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(-1.0); @@ -417,13 +417,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLLowerThanProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" x < y ", - " x LT y ", - " x lt y "}; - for(const string& line: XML) { + const std::array XML{" x < y ", + " x LT y ", + " x lt y "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -446,11 +446,11 @@ class FGConditionTest : public CxxTest::TestSuite } void testLowerThanProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array conditions{"x < y", "x LT y", "x lt y"}; - for(const string& line: conditions) { + const std::array conditions{"x < y", "x LT y", "x lt y"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(-1.0); @@ -472,13 +472,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testXMLLowerOrEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" x <= y ", - " x LE y ", - " x le y "}; - for(const string& line: XML) { + const std::array XML{" x <= y ", + " x LE y ", + " x le y "}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -501,11 +501,11 @@ class FGConditionTest : public CxxTest::TestSuite } void testLowerOrEqualProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array conditions{"x <= y", "x LE y", "x le y"}; - for(const string& line: conditions) { + const std::array conditions{"x <= y", "x LE y", "x le y"}; + for(const std::string& line: conditions) { FGCondition cond(line, pm, nullptr); x->setDoubleValue(-1.0); @@ -527,13 +527,13 @@ class FGConditionTest : public CxxTest::TestSuite } void testAND() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto onoff = pm->GetNode("on-off", true); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); - const array XML{" on-off == 1\nx GE y", - " on-off == 1\nx GE y"}; - for(const string& line: XML) { + const std::array XML{" on-off == 1\nx GE y", + " on-off == 1\nx GE y"}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -558,10 +558,10 @@ class FGConditionTest : public CxxTest::TestSuite } void testANDLateBound() { - auto pm = make_shared(); - const array XML{" on-off == 1\nx GE y", - " on-off == 1\nx GE y"}; - for(const string& line: XML) { + auto pm = std::make_shared(); + const std::array XML{" on-off == 1\nx GE y", + " on-off == 1\nx GE y"}; + for(const std::string& line: XML) { Element_ptr elm = readFromXML(line); FGCondition cond(elm, pm); @@ -590,7 +590,7 @@ class FGConditionTest : public CxxTest::TestSuite } void testOR() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto onoff = pm->GetNode("on-off", true); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); @@ -620,7 +620,7 @@ class FGConditionTest : public CxxTest::TestSuite } void testNested() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto onoff = pm->GetNode("on-off", true); auto x = pm->GetNode("x", true); auto y = pm->GetNode("y", true); @@ -656,7 +656,7 @@ class FGConditionTest : public CxxTest::TestSuite } void testIllegalLOGIC() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML("" " on-off == 1\n" " x GE y" @@ -665,7 +665,7 @@ class FGConditionTest : public CxxTest::TestSuite } void testWrongNumberOfElements() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML(" on-off == "); TS_ASSERT_THROWS(FGCondition cond(elm, pm), BaseException&); @@ -680,7 +680,7 @@ class FGConditionTest : public CxxTest::TestSuite } void testIllegalNested() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML("" " on-off == 1" " " @@ -692,7 +692,7 @@ class FGConditionTest : public CxxTest::TestSuite } void testIllegalOperation() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML(" on-off # 0.0 "); TS_ASSERT_THROWS(FGCondition cond(elm, pm), BaseException&); } diff --git a/tests/unit_tests/FGInitialConditionTest.h b/tests/unit_tests/FGInitialConditionTest.h index 3fada9df9e..53a0cdc146 100644 --- a/tests/unit_tests/FGInitialConditionTest.h +++ b/tests/unit_tests/FGInitialConditionTest.h @@ -273,6 +273,8 @@ class FGInitialConditionTest : public CxxTest::TestSuite } void testBodyVelocity() { + using namespace std; + FGFDMExec fdmex; FGInitialCondition ic(&fdmex); diff --git a/tests/unit_tests/FGLocationTest.h b/tests/unit_tests/FGLocationTest.h index 44ddd30793..e1e524718e 100644 --- a/tests/unit_tests/FGLocationTest.h +++ b/tests/unit_tests/FGLocationTest.h @@ -656,6 +656,8 @@ class FGLocationTest : public CxxTest::TestSuite void testNavigationOnOblateEarth() { + using namespace std; + const double a = 20925646.32546; // WGS84 semimajor axis length in feet const double b = 20855486.5951; // WGS84 semiminor axis length in feet JSBSim::FGLocation l; diff --git a/tests/unit_tests/FGMSISTest.h b/tests/unit_tests/FGMSISTest.h index a47036a776..170d098144 100644 --- a/tests/unit_tests/FGMSISTest.h +++ b/tests/unit_tests/FGMSISTest.h @@ -52,9 +52,9 @@ class FGMSISTest : public CxxTest::TestSuite, FGJSBBase FGFDMExec fdmex; std::shared_ptr std_atm; - vector MSIS_iyd, MSIS_sec; - vector MSIS_alt, MSIS_glat, MSIS_glon, MSIS_f107a, MSIS_f107, MSIS_ap, - MSIS_T, MSIS_rho, MSIS_mair; + std::vector MSIS_iyd, MSIS_sec; + std::vector MSIS_alt, MSIS_glat, MSIS_glon, MSIS_f107a, MSIS_f107, MSIS_ap, + MSIS_T, MSIS_rho, MSIS_mair; FGMSISTest() { std_atm = fdmex.GetAtmosphere(); @@ -254,7 +254,7 @@ class FGMSISTest : public CxxTest::TestSuite, FGJSBBase s << "" << " " << MSIS_iyd[i] << "" << " " << MSIS_sec[i] << "" - << "" << endl; + << "" << std::endl; Element_ptr elm = readFromXML(s.str()); TS_ASSERT(atm.Load(elm)); diff --git a/tests/unit_tests/FGParameterValueTest.h b/tests/unit_tests/FGParameterValueTest.h index 8767ccdd82..3d9e457630 100644 --- a/tests/unit_tests/FGParameterValueTest.h +++ b/tests/unit_tests/FGParameterValueTest.h @@ -9,7 +9,7 @@ class FGParameterValueTest : public CxxTest::TestSuite { public: void testRealConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGParameterValue x("1.2", pm, nullptr); TS_ASSERT(x.IsConstant()); @@ -19,7 +19,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testPropertyConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto node = pm->GetNode("x", true); FGParameterValue x("x", pm, nullptr); @@ -34,7 +34,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testLateBoundPropertyConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGParameterValue x("x", pm, nullptr); TS_ASSERT(!x.IsConstant()); @@ -50,7 +50,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testLateBoundPropertyIllegalAccess() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGParameterValue x("x", pm, nullptr); TS_ASSERT(!x.IsConstant()); @@ -60,7 +60,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testXMLRealConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML(" 1.2 "); FGParameterValue x(elm, pm); @@ -71,7 +71,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testXMLPropertyConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto node = pm->GetNode("x", true); Element_ptr elm = readFromXML(" x "); FGParameterValue x(elm, pm); @@ -87,7 +87,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testXMLLateBoundPropertyConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML(" x "); FGParameterValue x(elm, pm); @@ -104,7 +104,7 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testXMLLateBoundPropertyIllegalAccess() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML(" x "); FGParameterValue x(elm, pm); @@ -115,13 +115,13 @@ class FGParameterValueTest : public CxxTest::TestSuite } void testXMLEmptyNameConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML(""); TS_ASSERT_THROWS(FGParameterValue x(elm, pm), BaseException&); } void testXMLMultiLinesConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); Element_ptr elm = readFromXML("x\ny"); TS_ASSERT_THROWS(FGParameterValue x(elm, pm), BaseException&); } diff --git a/tests/unit_tests/FGPropertyValueTest.h b/tests/unit_tests/FGPropertyValueTest.h index b3976be499..24ebbdafb1 100644 --- a/tests/unit_tests/FGPropertyValueTest.h +++ b/tests/unit_tests/FGPropertyValueTest.h @@ -46,7 +46,7 @@ class FGPropertyValueTest : public CxxTest::TestSuite } void testConstant_ness() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGPropertyNode_ptr node = pm->GetNode("x", true); FGPropertyValue property(node); @@ -58,7 +58,7 @@ class FGPropertyValueTest : public CxxTest::TestSuite void testTiedPropertiesAreNotConstant() { // Check that tied properties are not constant even if the underlying // property is set to READ ONLY. - auto pm = make_shared(); + auto pm = std::make_shared(); double value = 0.0; FGPropertyNode_ptr node = pm->GetNode("x", true); FGPropertyValue property(node); @@ -86,7 +86,7 @@ class FGPropertyValueTest : public CxxTest::TestSuite } void testConstructorLateBound() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGPropertyValue property("x", pm, nullptr); TS_ASSERT_EQUALS(property.IsLateBound(), true); @@ -102,7 +102,7 @@ class FGPropertyValueTest : public CxxTest::TestSuite } void testInstantiateLateBound() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGPropertyValue property("x", pm, nullptr); TS_ASSERT_EQUALS(property.IsLateBound(), true); @@ -124,7 +124,7 @@ class FGPropertyValueTest : public CxxTest::TestSuite } void testSignedProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); FGPropertyValue property("-x", pm, nullptr); TS_ASSERT_EQUALS(property.IsLateBound(), true); diff --git a/tests/unit_tests/FGTableTest.h b/tests/unit_tests/FGTableTest.h index 425618fd34..7029fddf58 100644 --- a/tests/unit_tests/FGTableTest.h +++ b/tests/unit_tests/FGTableTest.h @@ -102,7 +102,7 @@ class FGTable1DTest : public CxxTest::TestSuite } void testLookupProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto node = pm->GetNode("x", true); FGTable t(2); t << 1.0 << -1.0 @@ -162,7 +162,7 @@ class FGTable1DTest : public CxxTest::TestSuite } void testLoadInternalFromXML() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects to be the child of another XML element, hence the // element. Element_ptr elm0 = readFromXML("" @@ -225,7 +225,7 @@ class FGTable1DTest : public CxxTest::TestSuite } void testLoadIndepVarFromXML() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); // FGTable expects
to be the child of another XML element, hence the // element. @@ -304,7 +304,7 @@ class FGTable1DTest : public CxxTest::TestSuite } void testLoadWithNumericPrefix() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x2", true); // FGTable expects
to be the child of another XML element, hence the // element. @@ -336,7 +336,7 @@ class FGTable1DTest : public CxxTest::TestSuite } void testLoadWithStringPrefix() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto x = pm->GetNode("x", true); // FGTable expects
to be the child of another XML element, hence the // element. @@ -368,7 +368,7 @@ class FGTable1DTest : public CxxTest::TestSuite } void testMonoticallyIncreasingRows() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -615,7 +615,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testLookupProperty() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto row = pm->GetNode("x", true); auto column = pm->GetNode("y", true); FGTable t_2x2(2,2); @@ -688,7 +688,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testLoadInternalFromXML() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm0h = readFromXML("" @@ -788,7 +788,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testLoadIndepVarFromXML() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto row = pm->GetNode("x", true); auto column = pm->GetNode("y", true); // FGTable expects
to be the child of another XML element, hence the @@ -1076,7 +1076,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testLoadWithNumericPrefix() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto row = pm->GetNode("x", true); auto column = pm->GetNode("y2", true); // FGTable expects
to be the child of another XML element, hence the @@ -1116,7 +1116,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testLoadWithStringPrefix() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto row = pm->GetNode("x", true); auto column = pm->GetNode("y", true); // FGTable expects
to be the child of another XML element, hence the @@ -1156,7 +1156,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testMonoticallyIncreasingRows() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1175,7 +1175,7 @@ class FGTable2DTest : public CxxTest::TestSuite } void testMonoticallyIncreasingColumns() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1197,7 +1197,7 @@ class FGTable3DTest : public CxxTest::TestSuite { public: void testLoadIndepVarFromXML() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto row = pm->GetNode("x", true); auto column = pm->GetNode("y", true); auto table = pm->GetNode("z", true); @@ -1337,7 +1337,7 @@ class FGTable3DTest : public CxxTest::TestSuite } void testCopyConstructor() { - auto pm = make_shared(); + auto pm = std::make_shared(); auto row = pm->GetNode("x", true); auto column = pm->GetNode("y", true); auto table = pm->GetNode("z", true); @@ -1411,7 +1411,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite { public: void testTypeError() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1428,7 +1428,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testLookupNameError() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1448,7 +1448,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testMalformedData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1465,7 +1465,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testPropertyAlreadyTied() { - auto pm = make_shared(); + auto pm = std::make_shared(); static double value = 0; pm->Tie("test", &value); @@ -1486,7 +1486,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testUnexpectedPrefix() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. @@ -1505,7 +1505,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test1DInternalMissingTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1518,7 +1518,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test1DInternalEmptyTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1532,7 +1532,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test1DMissingTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1546,7 +1546,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test1DEmptyTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1567,7 +1567,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test1DMissingLookupAxis() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1584,7 +1584,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test1DBadNumberOfColumns() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm0 = readFromXML("" @@ -1660,7 +1660,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test2DMissingColumnLookupAxis1() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1679,7 +1679,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test2DMissingColumnLookupAxis2() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1698,7 +1698,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test2DMissingRowLookupAxis() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1717,7 +1717,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test2DMissingTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1732,7 +1732,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test2DEmptyTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1761,7 +1761,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testXMLRowsNotIncreasing() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1778,7 +1778,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testXMLColumnsNotIncreasing() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1798,7 +1798,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void testBreakpointsNotIncreasing() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1824,7 +1824,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test3DMissingRowLookupAxis() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1849,7 +1849,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test3DMissingColumnLookupAxis() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1874,7 +1874,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test3DMissingTableLookupAxis() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1899,7 +1899,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test3DMissingTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1915,7 +1915,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test3DEmptyTableData() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML("" @@ -1932,7 +1932,7 @@ class FGTableErrorsTest : public CxxTest::TestSuite } void test3DEmptyTableData2() { - auto pm = make_shared(); + auto pm = std::make_shared(); // FGTable expects
to be the child of another XML element, hence the // element. Element_ptr elm = readFromXML(""