1
0
Fork 0

Test case for re-alias-ing

* Ensure alias()ing an already alisaed node fails, but also ensure it
  doesn't deadlock.
This commit is contained in:
James Turner 2023-09-06 21:42:52 +01:00
parent d569d72ea8
commit 6c949c30d3
2 changed files with 21 additions and 0 deletions
test_suite/simgear_tests/props

View file

@ -52,6 +52,24 @@ void SimgearPropsTests::testAliasLeak()
alias->alias("test-node", false);
}
void SimgearPropsTests::testDoubleAlias()
{
// Declarations.
SGPropertyNode* alias;
// Create a new node.
tree->getNode("test-node", true);
tree->getNode("another-node", true);
// Aliased node.
alias = tree->getNode("test-alias", true);
CPPUNIT_ASSERT(alias->alias("test-node", false));
CPPUNIT_ASSERT(!alias->alias("another-node", false));
}
void SimgearPropsTests::testPropsCopyIf()
{
// dummy property tree structure

View file

@ -35,6 +35,7 @@ class SimgearPropsTests : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE(SimgearPropsTests);
CPPUNIT_TEST(testAliasLeak);
CPPUNIT_TEST(testPropsCopyIf);
CPPUNIT_TEST(testDoubleAlias);
CPPUNIT_TEST_SUITE_END();
public:
@ -47,6 +48,8 @@ public:
// The tests.
void testAliasLeak();
void testPropsCopyIf();
void testDoubleAlias();
private:
// A property tree.
SGPropertyNode *tree;