2 # include <simgear_config.h>
6 // Always enable DEBUG mode in test application, otherwise "assert" test
7 // statements have no effect and don't actually test anything (catch 17 ;-) ).
11 #include <simgear/compiler.h>
18 #include <simgear/misc/test_macros.hxx>
19 #include <simgear/structure/exception.hxx>
20 #include <simgear/structure/SGExpression.hxx>
21 #include <simgear/props/condition.hxx>
22 #include <simgear/props/props.hxx>
23 #include <simgear/props/props_io.hxx>
26 using namespace simgear;
28 SGPropertyNode_ptr propertyTree;
32 const char* xml = "<?xml version=\"1.0\"?>"
40 "<thing-1 type=\"bool\">false</thing-1>"
44 propertyTree = new SGPropertyNode;
45 readProperties(xml, strlen(xml), propertyTree.ptr());
57 const char* xml = "<?xml version=\"1.0\"?>"
62 "<property>/group-a/bar</property>"
66 "<property>/group-a/zot</property>"
73 const char* xml2 = "<?xml version=\"1.0\"?>"
77 "<property>/group-a/bar</property>"
78 "<property>/group-a/zot</property>"
79 "<property>/group-b/thing-1</property>"
84 SGPropertyNode* desc = new SGPropertyNode;
85 readProperties(xml2, strlen(xml2), desc);
87 SGSharedPtr<SGExpressiond> expr = SGReadDoubleExpression(propertyTree, desc->getChild(0));
89 std::set<const SGPropertyNode*> deps;
90 expr->collectDependentProperties(deps);
92 COMPARE(deps.size(), 3);
93 SGPropertyNode* barProp = propertyTree->getNode("group-a/bar");
94 VERIFY(deps.find(barProp) != deps.end());
96 VERIFY(deps.find(propertyTree->getNode("group-a/zot")) != deps.end());
97 VERIFY(deps.find(propertyTree->getNode("group-b/thing-1")) != deps.end());
100 int main(int argc, char* argv[])
102 sglog().setLogLevels( SG_ALL, SG_INFO );
107 cout << __FILE__ << ": All tests passed" << endl;