From 5bd393135f8fc6203da76003edbabed7ea6b5a48 Mon Sep 17 00:00:00 2001 From: Edward d'Auvergne Date: Thu, 17 May 2018 22:41:03 +0200 Subject: [PATCH] PropertyObject: Unit test for declaration followed by definition. --- simgear/props/propertyObject_test.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/simgear/props/propertyObject_test.cxx b/simgear/props/propertyObject_test.cxx index 5873976e..7a2d814b 100644 --- a/simgear/props/propertyObject_test.cxx +++ b/simgear/props/propertyObject_test.cxx @@ -213,6 +213,26 @@ void testDeclare() PropertyObject d; } +void testDeclareThenDefine() +{ + // Declare. + PropertyObject a; + PropertyObject b; + + // Property nodes. + SGPropertyNode_ptr propsA = new SGPropertyNode; + SGPropertyNode_ptr propsB = new SGPropertyNode; + propsA->setValue(true); + propsB->setValue("test"); + + // Now define. + a = PropertyObject::create(propsA); + b = PropertyObject::create(propsB); + + assert(a == true); + assert(b == "test"); +} + int main(int argc, char* argv[]) { testRoot = new SGPropertyNode(); @@ -236,6 +256,7 @@ int main(int argc, char* argv[]) testSTLContainer(); testCreate(); testDeclare(); + testDeclareThenDefine(); return EXIT_SUCCESS; }