[opengtl-commits] [353] test for the presence of a test function

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 353
Author:   cyrille
Date:     2008-09-02 21:48:45 +0200 (Tue, 02 Sep 2008)

Log Message:
-----------
test for the presence of a test function

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
    trunk/OpenGTL/OpenShiva/tests/structures/region.shiva
    trunk/OpenGTL/OpenShiva/tools/tester/ShivaTester.cpp


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-09-02 08:04:53 UTC (rev 352)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-09-02 19:48:45 UTC (rev 353)
@@ -169,7 +169,7 @@
   // Call function
   void (*func)( int, int, int, int, const void**, void*) = ( void(*)(int, int, int, int, const void**, void*))GTLCore::VirtualMachine::instance()->getPointerToFunction( d->evaluatePixelesFunction);
   SHIVA_ASSERT(func);
-  (*func)( _region.x(), _region.y(), _region.width(), _region.height(), inputImages, owrap); // TODO s/200/width s/300/height
+  (*func)( _region.x(), _region.y(), _region.width(), _region.height(), inputImages, owrap);
   delete[] inputImages;
   delete owrap;
   SHIVA_DEBUG( "done" );
@@ -184,6 +184,12 @@
   return v.asInt32();
 }
 
+bool Kernel::hasTestFunction() const
+{
+  return d->moduleData->function( "MyKernel", "runTest");
+}
+
+
 GTLCore::String Kernel::compilationErrorsMessage() const
 {
   std::ostringstream os;

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-09-02 08:04:53 UTC (rev 352)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-09-02 19:48:45 UTC (rev 353)
@@ -82,6 +82,10 @@
        * Run the function called "int runTest()" in the Kernel.
        */
       int runTest() const;
+      /**
+       * @return true if the test function is available
+       */
+      bool hasTestFunction() const;
     private:
       struct Private;
       Private * const d;

Modified: trunk/OpenGTL/OpenShiva/tests/structures/region.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/structures/region.shiva	2008-09-02 08:04:53 UTC (rev 352)
+++ trunk/OpenGTL/OpenShiva/tests/structures/region.shiva	2008-09-02 19:48:45 UTC (rev 353)
@@ -1,4 +1,4 @@
-kernel MyKernel
+kernel RegionTestKernel
 {
   void evaluatePixel(out pixel result)
   {

Modified: trunk/OpenGTL/OpenShiva/tools/tester/ShivaTester.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/tools/tester/ShivaTester.cpp	2008-09-02 08:04:53 UTC (rev 352)
+++ trunk/OpenGTL/OpenShiva/tools/tester/ShivaTester.cpp	2008-09-02 19:48:45 UTC (rev 353)
@@ -172,7 +172,13 @@
       }
       case STM_RUN_TEST:
       case STM_DEFAULT:
-        return p.runTest();
+        if( p.hasTestFunction() )
+        {
+          return p.runTest();
+        } else {
+          std::cout << "No test function" << std::endl;
+          return EXIT_FAILURE;
+        }
     }
   }
   return EXIT_SUCCESS;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/