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

avidaedward at myxo.css.msu.edu avidaedward at myxo.css.msu.edu
Sat Jan 27 22:17:06 PST 2007


Author: avidaedward
Date: 2007-01-28 01:17:06 -0500 (Sun, 28 Jan 2007)
New Revision: 1226

Modified:
   extras/
   extras/source/testsuites/nTestLib.cpp
   extras/source/tools/cTestDriver.cpp
   extras/source/tools/cTestDriver.h
   extras/source/tools/cTestLib.cpp
   extras/source/tools/cTestLib.h
Log:
 r1243 at clearly:  kaben | 2007-01-21 19:49:05 -0500
 Removed as many traces as I could find of "test attributes".



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

Modified: extras/source/testsuites/nTestLib.cpp
===================================================================
--- extras/source/testsuites/nTestLib.cpp	2007-01-28 06:17:02 UTC (rev 1225)
+++ extras/source/testsuites/nTestLib.cpp	2007-01-28 06:17:06 UTC (rev 1226)
@@ -96,9 +96,10 @@
         ));
 
         /* Test 'tryRun'. */
+        cTestSettings ts;
         cTestLib::getLib().tryRun(
           "cTestLib_Regression_ErrorLoadingTestrunnerByKey_testVoid",
-          cStringList()
+          ts
         );
 
         /* Unregister testVoid function. */
@@ -113,7 +114,7 @@
     cAddTestSuite t1("cTestLib_Regression_ErrorLoadingTestrunnerByKey1", test1);
 
   /* cTestLib_Regression_ErrorLoadingTestrunnerByKey2 {{{2 */
-    void testAttr(const cStringList &attributes){}
+    void testSettings(cTestSettings &settings){}
     void test2(){
       {
         /* Sanity check. */
@@ -123,16 +124,17 @@
         /* Register testAttr function. */
         cTestLib::getLib().reg(
           "cTestLib_Regression_ErrorLoadingTestrunnerByKey_testAttr",
-          testAttr
+          testSettings
         );
         TEST(cTestLib::getLib().supports(
           "cTestLib_Regression_ErrorLoadingTestrunnerByKey_testAttr"
         ));
 
         /* Test 'tryRun'. */
+        cTestSettings ts;
         cTestLib::getLib().tryRun(
           "cTestLib_Regression_ErrorLoadingTestrunnerByKey_testAttr",
-          cStringList()
+          ts
         );
 
         /* Unregister testAttr function. */

Modified: extras/source/tools/cTestDriver.cpp
===================================================================
--- extras/source/tools/cTestDriver.cpp	2007-01-28 06:17:02 UTC (rev 1225)
+++ extras/source/tools/cTestDriver.cpp	2007-01-28 06:17:06 UTC (rev 1226)
@@ -19,39 +19,6 @@
   return report_errors();
 }
 
-void 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;
-}
 void cTestDriver::TestAll(cTestSettings &settings){
   cout << "------ Running all known tests ..." << endl;
   {
@@ -100,22 +67,6 @@
     cString test_name(args.Pop());
     if(m_test_settings.ParseSettingString(test_name)){
       // Do nothing extra...
-    } else if(test_name.Find("Enable_") == 0){
-      test_name.ClipFront(7);
-      cStringList attributes(test_name, '_');
-      while(attributes.GetSize() > 0){
-        cString attribute(attributes.Pop());
-        cout << "...... Enabling '" << attribute << "' tests ..." << endl;
-        m_test_attributes.Push(attribute);
-      }
-    } else if(test_name.Find("Disable_") == 0){
-      test_name.ClipFront(8);
-      cStringList attributes(test_name, '_');
-      while(attributes.GetSize() > 0){
-        cString attribute(attributes.Pop());
-        cout << "...... Disabling '" << attribute << "' tests ..." << endl;
-        m_test_attributes.PopString(attribute);
-      }
     } else if (test_name == "Quiet"){
       /*
       Turn slow tests off; i.e., skip tests that we think take a long
@@ -137,7 +88,6 @@
       Test everything.
       */
       did_already_test_something = true;
-      TestAll(m_test_attributes);
       TestAll(m_test_settings);
     } else {
       /*
@@ -154,7 +104,6 @@
     /*
     Test everything if nothing has been tested yet.
     */
-    TestAll(m_test_attributes);
     TestAll(m_test_settings);
   }
   cout.flush();

Modified: extras/source/tools/cTestDriver.h
===================================================================
--- extras/source/tools/cTestDriver.h	2007-01-28 06:17:02 UTC (rev 1225)
+++ extras/source/tools/cTestDriver.h	2007-01-28 06:17:06 UTC (rev 1226)
@@ -11,13 +11,11 @@
 
 class cTestDriver {
 protected:
-  cStringList m_test_attributes;
   cTestSettings m_test_settings;
 public:
   int & testErrors(void);
   void resetTestErrors(void);
   int reportErrors(void);
-  void TestAll(cStringList &attrs);
   void TestAll(cTestSettings &settings);
   int Tests(cStringList &args);
   int Tests(int argc, char * argv[]);

Modified: extras/source/tools/cTestLib.cpp
===================================================================
--- extras/source/tools/cTestLib.cpp	2007-01-28 06:17:02 UTC (rev 1225)
+++ extras/source/tools/cTestLib.cpp	2007-01-28 06:17:06 UTC (rev 1226)
@@ -14,12 +14,6 @@
   m_test_runners.Add(key, test_runner);
   return true;
 }
-bool cTestLib::reg(const cString &key, TestrunnerWithAttrs test_runner){
-  TestrunnerWithAttrs tr;
-  if(m_test_runners_with_attributes.Find(key, tr)) { return false; }
-  m_test_runners_with_attributes.Add(key, test_runner);
-  return true;
-}
 bool cTestLib::reg(const cString &key, TestrunnerWithSettings test_runner){
   TestrunnerWithSettings tr;
   if(m_test_runners_with_settings.Find(key, tr)) { return false; }
@@ -29,21 +23,13 @@
 
 bool cTestLib::unreg(const cString &key){
   Testrunner tr(0);
-  TestrunnerWithAttrs tra(0);
   TestrunnerWithSettings trs(0);
   if(m_test_runners.Find(key, tr)){ tr = m_test_runners.Remove(key); }
-  if(m_test_runners_with_attributes.Find(key, tra)){ tra = m_test_runners_with_attributes.Remove(key); }
   if(m_test_runners_with_settings.Find(key, trs)){ trs = m_test_runners_with_settings.Remove(key); }
-  return (tr || tra || trs);
+  return (tr || trs);
 }
 bool cTestLib::supports(const cString &key){
-  return (
-    m_test_runners.HasEntry(key)
-    ||
-    m_test_runners_with_attributes.HasEntry(key)
-    ||
-    m_test_runners_with_settings.HasEntry(key)
-  );
+  return (m_test_runners.HasEntry(key) || m_test_runners_with_settings.HasEntry(key));
 }
 
 void cTestLib::run(cString key){
@@ -52,13 +38,6 @@
   if(m_test_runners.Find(key, test_runner)) test_runner();
   else ERROR(cString("error loading test runner by key '") + key + "'");
 }
-/* XXX Needs tests relating to Attributes -- @kgn */
-void cTestLib::run(cString key, const cStringList &attributes){
-  TestrunnerWithAttrs tr;
-
-  if(m_test_runners_with_attributes.Find(key, tr)) tr(attributes);
-  else ERROR(cString("error loading test runner by key '") + key + "'");
-}
 /* XXX Needs tests relating to Settings -- @kgn */
 void cTestLib::run(cString key, cTestSettings &settings){
   TestrunnerWithSettings tr;
@@ -66,56 +45,6 @@
   if(m_test_runners_with_settings.Find(key, tr)) tr(settings);
   else ERROR(cString("error loading test runner by key '") + key + "'");
 }
-/* XXX Needs tests relating to Attributes -- @kgn */
-void cTestLib::tryRun(cString key, const cStringList &attributes){
-  if(supports(key)){
-    if(m_test_runners.HasEntry(key)){
-      run(key);
-    } else if(m_test_runners_with_attributes.HasEntry(key)){
-      run(key, attributes);
-    }
-  } else {
-    bool found_match = false;
-    {
-      tList<cString> keys;
-      tList<Testrunner> runners;
-
-      asLists(keys, runners);
-      tListIterator<cString> list_it(keys);
-
-      while (list_it.Next() != 0) {
-        cString test_key(*list_it.Get());
-        if(0 <= test_key.Find(key)){
-          found_match = true;
-          cout << "--- '" << test_key << "' (matches '" << key << "') : testing ..." << endl;
-          /* FIXME : convert to no-args but key. @kgn */
-          run(test_key);
-          cout << "*** '" << test_key << "' (matches '" << key << "') : done." << endl;
-        }
-      }
-    }
-    {
-      tList<cString> keys;
-      tList<TestrunnerWithAttrs> runners;
-
-      asLists(keys, runners);
-      tListIterator<cString> list_it(keys);
-
-      while (list_it.Next() != 0) {
-        cString test_key(*list_it.Get());
-        if(0 <= test_key.Find(key)){
-          found_match = true;
-          cout << "--- '" << test_key << "' (matches '" << key << "') : testing ..." << endl;
-          run(test_key, attributes);
-          cout << "*** '" << test_key << "' (matches '" << key << "') : done." << endl;
-        }
-      }
-    }
-    if(!found_match){
-      ERROR(cString("key '") + key + "' not supported");
-    }
-  }
-}
 /* XXX Needs tests relating to Settings -- @kgn */
 void cTestLib::tryRun(cString key, cTestSettings &settings){
   if(supports(key)){
@@ -169,10 +98,6 @@
 void cTestLib::asLists(tList<cString> & name_list, tList<Testrunner> & value_list){
   m_test_runners.AsLists(name_list, value_list);
 }
-/* XXX Needs tests relating to Attributes -- @kgn */
-void cTestLib::asLists(tList<cString> & name_list, tList<TestrunnerWithAttrs> & value_list){
-  m_test_runners_with_attributes.AsLists(name_list, value_list);
-}
 /* XXX Needs tests relating to Settings -- @kgn */
 void cTestLib::asLists(tList<cString> & name_list, tList<TestrunnerWithSettings> & value_list){
   m_test_runners_with_settings.AsLists(name_list, value_list);
@@ -189,11 +114,6 @@
     ERROR(cString("error adding test runner by '") + key + "'");
   }
 }
-//void addTestSuite(const cString &key, TestrunnerWithAttrs test_runner){
-//  if(!cTestLib::getLib().reg(key, test_runner)){
-//    ERROR(cString("error adding test runner by '") + key + "'");
-//  }
-//}
 void addTestSuite(const cString &key, TestrunnerWithSettings test_runner){
   if(!cTestLib::getLib().reg(key, test_runner)){
     ERROR(cString("error adding test runner by '") + key + "'");
@@ -203,9 +123,6 @@
 cAddTestSuite::cAddTestSuite(const cString &key, Testrunner test_runner){
   addTestSuite(key, test_runner);
 }
-//cAddTestSuite::cAddTestSuite(const cString &key, TestrunnerWithAttrs test_runner){
-//  addTestSuite(key, test_runner);
-//}
 cAddTestSuite::cAddTestSuite(const cString &key, TestrunnerWithSettings test_runner){
   addTestSuite(key, test_runner);
 }

Modified: extras/source/tools/cTestLib.h
===================================================================
--- extras/source/tools/cTestLib.h	2007-01-28 06:17:02 UTC (rev 1225)
+++ extras/source/tools/cTestLib.h	2007-01-28 06:17:06 UTC (rev 1226)
@@ -15,28 +15,22 @@
 #endif
 
 typedef void(*Testrunner)(void);
-typedef void(*TestrunnerWithAttrs)(const cStringList &);
 typedef void(*TestrunnerWithSettings)(cTestSettings &);
 
 class cTestLib {
 protected:
   tDictionary<Testrunner> m_test_runners;
-  tDictionary<TestrunnerWithAttrs> m_test_runners_with_attributes;
   tDictionary<TestrunnerWithSettings> m_test_runners_with_settings;
 public:
   virtual ~cTestLib(){}
   bool reg(const cString &key, Testrunner test_runner);
-  bool reg(const cString &key, TestrunnerWithAttrs test_runner);
   bool reg(const cString &key, TestrunnerWithSettings test_runner);
   bool unreg(const cString &key);
   bool supports(const cString &key);
   void asLists(tList<cString> & name_list, tList<Testrunner> & value_list);
-  void asLists(tList<cString> & name_list, tList<TestrunnerWithAttrs> & value_list);
   void asLists(tList<cString> & name_list, tList<TestrunnerWithSettings> & value_list);
-  void tryRun(cString key, const cStringList &attributes);
   void tryRun(cString key, cTestSettings &settings);
   void run(cString key);
-  void run(cString key, const cStringList &attributes);
   void run(cString key, cTestSettings &settings);
 public:
   static cTestLib &getLib();
@@ -49,11 +43,9 @@
   cAddTestSuite& operator=(const cAddTestSuite&); // @not_implemented
 public:
   cAddTestSuite(const cString &key, Testrunner test_runner);
-  //cAddTestSuite(const cString &key, TestrunnerWithAttrs test_runner);
   cAddTestSuite(const cString &key, TestrunnerWithSettings test_runner);
 };
 void addTestSuite(const cString &key, Testrunner test_runner);
-//void addTestSuite(const cString &key, TestrunnerWithAttrs test_runner);
 void addTestSuite(const cString &key, TestrunnerWithSettings test_runner);
 
 #endif




More information about the Avida-cvs mailing list