Browse Source

update test_sgraph

David Rose 24 years ago
parent
commit
4343bb8c98
2 changed files with 33 additions and 3 deletions
  1. 2 0
      panda/src/sgraph/Sources.pp
  2. 31 3
      panda/src/sgraph/test_sgraph.cxx

+ 2 - 0
panda/src/sgraph/Sources.pp

@@ -36,6 +36,8 @@
   #define TARGET test_sgraph
   #define LOCAL_LIBS \
     sgraph mathutil graph putil
+  #define OTHER_LIBS \
+    pystub
 
   #define SOURCES \
     test_sgraph.cxx

+ 31 - 3
panda/src/sgraph/test_sgraph.cxx

@@ -16,12 +16,40 @@
 //
 ////////////////////////////////////////////////////////////////////
 
-#include "camera.h"
+#include "geomNode.h"
 
-#include <notify.h>
+#include "pointerTo.h"
+#include "clockObject.h"
+#include "notify.h"
 
 int main() {
   nout << "running test_sgraph" << endl;
-  PT(Camera) cam = new Camera("camera");
+
+  ClockObject *c = ClockObject::get_global_clock();
+  int i;
+  int count = 100000;
+  double start, finish;
+  PT(Node) node;
+
+  node = new GeomNode("foo");
+  start = c->get_real_time();
+  for (i = 0; i < count; i++) {
+    node->is_of_type(GeomNode::get_class_type());
+  }
+  finish = c->get_real_time();
+
+  cerr << "test 1: " << (finish - start) / (double)count * 1000.0 
+       << " ms\n";
+
+  node = new NamedNode("foo");
+  start = c->get_real_time();
+  for (i = 0; i < count; i++) {
+    node->is_of_type(GeomNode::get_class_type());
+  }
+  finish = c->get_real_time();
+
+  cerr << "test 2: " << (finish - start) / (double)count * 1000.0
+       << " ms\n";
+
   return 0;
 }