]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/props_test.cxx
Melchior FRANZ: fix SGPropertyNode::LAST_USED_ATTRIBUTE
[simgear.git] / simgear / props / props_test.cxx
index ab29deee8eda4f6e691dfd231b7c04b8e55d8eab..b310982149aa53da008836b2b60fa28cf73fc97a 100644 (file)
@@ -5,13 +5,13 @@
 
 #include <simgear/compiler.h>
 
-#include STL_IOSTREAM
+#include <iostream>
 #include "props.hxx"
 #include "props_io.hxx"
 
-SG_USING_STD(cout);
-SG_USING_STD(cerr);
-SG_USING_STD(endl);
+using std::cout;
+using std::cerr;
+using std::endl;
 
 
 \f
@@ -311,7 +311,7 @@ test_property_nodes ()
   cout << endl;
 
   cout << "Looking for all /hack[0]/bar children" << endl;
-  vector<SGPropertyNode_ptr> bar = child->getChildren("bar");
+  std::vector<SGPropertyNode_ptr> bar = child->getChildren("bar");
   cout << "There are " << bar.size() << " matches" << endl;
   for (int i = 0; i < (int)bar.size(); i++)
     cout << bar[i]->getName() << '[' << bar[i]->getIndex() << ']' << endl;
@@ -324,6 +324,26 @@ test_property_nodes ()
   cout << endl;
 }
 
+void test_addChild()
+{
+  SGPropertyNode root;
+
+  cout << "Testing the addChild function " << endl;
+  cout << "Created root node " << root.getPath() << endl;
+
+  SGPropertyNode *test = root.getChild("test", 0, true);
+  SGPropertyNode *n = test->getNode("foo", true);
+  n->getChild("child", 1, true)->setIntValue(1);
+  n->getChild("child", 2, true)->setIntValue(2);
+  n->getChild("child", 4, true)->setIntValue(2);
+  dump_node(&root);
+
+  SGPropertyNode *ch = n->addChild("child");
+  ch->setIntValue(3);
+  cerr << endl << "ADDED: " << ch->getPath() << endl << endl;
+  dump_node(&root);
+}
+
 
 int main (int ac, char ** av)
 {
@@ -337,10 +357,12 @@ int main (int ac, char ** av)
       readProperties(av[i], &root);
       writeProperties(cout, &root, true);
       cout << endl;
-    } catch (string &message) {
+    } catch (std::string &message) {
       cout << "Aborted with " << message << endl;
     }
   }
 
+  test_addChild();
+
   return 0;
 }