Tests: resolve several memory leaks
This commit is contained in:
committed by
Alessandro Menti
parent
f6ded69fa3
commit
53e6bec425
@@ -7,7 +7,7 @@
|
||||
#include <simgear/misc/test_macros.hxx>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define VERIFY_COLOR(str, r, g, b, a) \
|
||||
SG_VERIFY(simgear::parseColor(str, color)) \
|
||||
@@ -28,7 +28,7 @@ int main (int ac, char ** av)
|
||||
SGPropertyNode color_node, color_arg;
|
||||
color_arg.setStringValue("#000000");
|
||||
|
||||
simgear::PropertyInterpolator* interp = new simgear::ColorInterpolator;
|
||||
auto interp = std::unique_ptr<simgear::ColorInterpolator>(new simgear::ColorInterpolator);
|
||||
interp->reset(color_arg);
|
||||
|
||||
interp->update(color_node, 0.5); // with no color it should immediately set to the target
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include <simgear/misc/test_macros.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
@@ -81,8 +82,8 @@ void testParse()
|
||||
"</sqr>"
|
||||
"</PropertyList>";
|
||||
|
||||
SGPropertyNode* desc = new SGPropertyNode;
|
||||
readProperties(xml2, strlen(xml2), desc);
|
||||
auto desc = std::unique_ptr<SGPropertyNode>(new SGPropertyNode);
|
||||
readProperties(xml2, strlen(xml2), desc.get());
|
||||
|
||||
SGSharedPtr<SGExpressiond> expr = SGReadDoubleExpression(propertyTree, desc->getChild(0));
|
||||
|
||||
@@ -107,4 +108,3 @@ int main(int argc, char* argv[])
|
||||
cout << __FILE__ << ": All tests passed" << endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "StateMachine.hxx"
|
||||
|
||||
@@ -230,11 +231,11 @@ void testParse()
|
||||
</state>
|
||||
</PropertyList>)";
|
||||
|
||||
SGPropertyNode* desc = new SGPropertyNode;
|
||||
readProperties(xml, strlen(xml), desc);
|
||||
auto desc = std::unique_ptr<SGPropertyNode>(new SGPropertyNode);
|
||||
readProperties(xml, strlen(xml), desc.get());
|
||||
|
||||
SGPropertyNode_ptr root(new SGPropertyNode);
|
||||
StateMachine_ptr sm = StateMachine::createFromPlist(desc, root);
|
||||
StateMachine_ptr sm = StateMachine::createFromPlist(desc.get(), root);
|
||||
|
||||
SG_VERIFY(sm->findStateByName("one") != NULL);
|
||||
SG_VERIFY(sm->findStateByName("two") != NULL);
|
||||
@@ -250,4 +251,3 @@ int main(int argc, char* argv[])
|
||||
cout << __FILE__ << ": All tests passed" << endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user