[Avida-SVN] r1132 - in extras: . source/tools

avidaedward at myxo.css.msu.edu avidaedward at myxo.css.msu.edu
Mon Dec 11 19:36:04 PST 2006


Author: avidaedward
Date: 2006-12-11 22:36:03 -0500 (Mon, 11 Dec 2006)
New Revision: 1132

Modified:
   extras/
   extras/source/tools/cTestDriver.cpp
   extras/source/tools/cTestDriver.h
Log:
 r1136 at Kaben-Nanlohys-MacBook-Pro-15:  kaben | 2006-12-10 00:23:44 -0500
 TestAvida will all now run all tests if none are specified.



Property changes on: extras
___________________________________________________________________
Name: svk:merge
   - 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1122
   + 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1136

Modified: extras/source/tools/cTestDriver.cpp
===================================================================
--- extras/source/tools/cTestDriver.cpp	2006-12-12 03:36:01 UTC (rev 1131)
+++ extras/source/tools/cTestDriver.cpp	2006-12-12 03:36:03 UTC (rev 1132)
@@ -20,6 +20,41 @@
   return report_errors();
 }
 
+int cTestDriver::TestAll(cStringList &attrs){
+  cout << "------ Running all known tests ..." << endl;
+  {
+    /* Get a list of names of known test suites. */
+    tList<cString> name_list;
+    tList<Testrunner> test_list;
+    cTestLib::getLib().asLists(name_list, test_list);
+    /* Iterate through list of test suite names. */
+    tListIterator<cString> list_it(name_list);
+    while(list_it.Next() != 0) {
+      /* Run each test suite by name. */
+      cout << "--- '" << *list_it.Get() << "' : testing ..." << endl;
+      cTestLib::getLib().run(*list_it.Get());
+      cout << "*** '" << *list_it.Get() << "' : done." << endl;
+    }
+  }
+  /* XXX Attributes */
+  {
+    /* Get a list of names of known test suites. */
+    tList<cString> name_list;
+    tList<TestrunnerWithAttrs> test_list;
+    cTestLib::getLib().asLists(name_list, test_list);
+    /* Iterate through list of test suite names. */
+    tListIterator<cString> list_it(name_list);
+    while(list_it.Next() != 0) {
+      /* Run each test suite by name. */
+      cout << "--- '" << *list_it.Get() << "' : testing ..." << endl;
+      cTestLib::getLib().run(*list_it.Get(), attrs);
+      cout << "*** '" << *list_it.Get() << "' : done." << endl;
+    }
+  }
+  cout << "****** Done running all known tests." << endl;
+}
+
+
 int cTestDriver::Tests(cStringList &args){
   /* Whether to be verbose (enable cout) or quiet (disable cout). */
   cout << "...... Being verbose by default." << endl;
@@ -28,6 +63,8 @@
   streambuf *cout_buf = cout.rdbuf();
   streambuf *clog_buf = clog.rdbuf();
 
+  bool did_already_test_something = false;
+
   while(args.GetSize() > 0){
     cString test_name(args.Pop());
     if(test_name.Find("Enable_") == 0){
@@ -63,46 +100,27 @@
       clog.rdbuf(clog_buf);
       cout << "...... Being verbose ..." << endl;
     } else if (test_name == "All"){
-      cout << "------ Running all known tests ..." << endl;
-      {
-        /* Get a list of names of known test suites. */
-        tList<cString> name_list;
-        tList<Testrunner> test_list;
-        cTestLib::getLib().asLists(name_list, test_list);
-        /* Iterate through list of test suite names. */
-        tListIterator<cString> list_it(name_list);
-        while(list_it.Next() != 0) {
-          /* Run each test suite by name. */
-          cout << "--- '" << *list_it.Get() << "' : testing ..." << endl;
-          cTestLib::getLib().run(*list_it.Get());
-          cout << "*** '" << *list_it.Get() << "' : done." << endl;
-        }
-      }
-      /* XXX Attributes */
-      {
-        /* Get a list of names of known test suites. */
-        tList<cString> name_list;
-        tList<TestrunnerWithAttrs> test_list;
-        cTestLib::getLib().asLists(name_list, test_list);
-        /* Iterate through list of test suite names. */
-        tListIterator<cString> list_it(name_list);
-        while(list_it.Next() != 0) {
-          /* Run each test suite by name. */
-          cout << "--- '" << *list_it.Get() << "' : testing ..." << endl;
-          cTestLib::getLib().run(*list_it.Get(), m_test_attributes);
-          cout << "*** '" << *list_it.Get() << "' : done." << endl;
-        }
-      }
-      cout << "****** Done running all known tests." << endl;
+      /*
+      Test everything.
+      */
+      did_already_test_something = true;
+      TestAll(m_test_attributes);
     } else {
       /*
       Look for and try to run a test suite by name.
       */
+      did_already_test_something = true;
       cout << "--- '" << test_name << "' : testing ..." << endl;
       cTestLib::getLib().tryRun(test_name, m_test_attributes);
       cout << "*** '" << test_name << "' : done." << endl;
     }
   }
+  if(!did_already_test_something){
+    /*
+    Test everything if nothing has been tested yet.
+    */
+    TestAll(m_test_attributes);
+  }
   cout.flush();
   clog.flush();
   cout.rdbuf(cout_buf);

Modified: extras/source/tools/cTestDriver.h
===================================================================
--- extras/source/tools/cTestDriver.h	2006-12-12 03:36:01 UTC (rev 1131)
+++ extras/source/tools/cTestDriver.h	2006-12-12 03:36:03 UTC (rev 1132)
@@ -12,6 +12,7 @@
   int & testErrors(void);
   void resetTestErrors(void);
   int reportErrors(void);
+  int TestAll(cStringList &attrs);
   int Tests(cStringList &args);
   int Tests(int argc, char * argv[]);
 };




More information about the Avida-cvs mailing list