[MOAB-dev] r4148 - MOAB/trunk/test

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Sep 24 14:47:10 CDT 2010


Author: kraftche
Date: 2010-09-24 14:47:10 -0500 (Fri, 24 Sep 2010)
New Revision: 4148

Added:
   MOAB/trunk/test/TestRunner.hpp
Log:
forgot this

Added: MOAB/trunk/test/TestRunner.hpp
===================================================================
--- MOAB/trunk/test/TestRunner.hpp	                        (rev 0)
+++ MOAB/trunk/test/TestRunner.hpp	2010-09-24 19:47:10 UTC (rev 4148)
@@ -0,0 +1,319 @@
+#ifndef TEST_RUNNER_HPP
+#define TEST_RUNNER_HPP
+
+#include "TestUtil.hpp"
+
+
+
+/***************************************************************************************
+ * Begin test runner implememtation.
+ * This is a higher-level API that can be used to register tests,
+ * test dependencies, and to run-time select a subset of tests to 
+ * run.
+ ***************************************************************************************/
+
+/* Register a test to be run */
+#define REGISTER_TEST( TEST_FUNC ) \
+  runner_register_test( __FILE__, __LINE__, #TEST_FUNC, (TEST_FUNC), NULL )
+
+/* Mark a dependency between tests.  The second argument must be
+ * an alredy-regsitered test.  The first argument will be registered
+ * as a test if it has not already been registered.  The test specified
+ * by the first argument will be run only if the test specified by
+ * the second argument is run and succeeds.
+ */
+#define REGISTER_DEP_TEST( TEST_FUNC, REQUIRED_FUNC ) \
+  runner_register_test( __FILE__, __LINE__, #TEST_FUNC, (TEST_FUNC), (REQUIRED_FUNC) )
+
+/* Run registered tests.  
+ * Arguments should be argc and argv passed to main.
+ * If ARGC is less than or equal to 1 then all tests are run.
+ * Otherwse only tests specified in the argument list are run.
+ * Returns number of failed tests.
+ */
+#define RUN_TESTS( ARGC, ARGV ) \
+  runner_run_tests( (ARGC), (ARGV) )
+
+
+
+/***************************************************************************************
+ * NOTE: The remainder of this file contains the implementation of the above macros.
+ *       The above macros constitute the entire intended API.
+ ***************************************************************************************/
+
+
+
+static void runner_register_test( const char* filename, int line_number,


More information about the moab-dev mailing list