[Avida-SVN] r1042 - development/source/tools

avidaedward at myxo.css.msu.edu avidaedward at myxo.css.msu.edu
Thu Oct 12 13:24:01 PDT 2006


Author: avidaedward
Date: 2006-10-12 16:24:01 -0400 (Thu, 12 Oct 2006)
New Revision: 1042

Modified:
   development/source/tools/cChangeList.cc
   development/source/tools/cChangeList.h
Log:
Bugfix failed build at r1040.
- Old test code in cChangeList was trying to use archive library that's
  been removed.
- I expect to see more of this. Sorry about that ...


Modified: development/source/tools/cChangeList.cc
===================================================================
--- development/source/tools/cChangeList.cc	2006-10-12 20:07:15 UTC (rev 1041)
+++ development/source/tools/cChangeList.cc	2006-10-12 20:24:01 UTC (rev 1042)
@@ -58,103 +58,3 @@
   }
   m_change_count = 0;
 }
-
-
-#ifdef ENABLE_UNIT_TESTS
-
-/*
-Unit tests
-*/
-#include "cFile.h"
-#include "cXMLArchive.h"
-
-#include "lightweight_test.h"
-
-#include <cstdio>    // for std::remove() to remove temporary files.
-#include <iomanip>
-#include <iostream>
-#include <fstream>
-#include <string>
-
-namespace nChangeList {
-  /*
-  Test-helpers.
-  */
-  template <class T>
-  void save_stuff(const T &s, const char * filename){
-    std::ofstream ofs(filename);
-    cXMLOArchive oa(ofs);
-    oa.ArkvObj("cChangeList_Archive", s);
-  }
-
-  template <class T>
-  void restore_stuff(T &s, const char * filename) {
-    std::ifstream ifs(filename);
-    cXMLIArchive ia(ifs);
-    ia.ArkvObj("cChangeList_Archive", s);
-  }
-
-
-  namespace utChangeList_hello_world {
-    void test(){
-      std::cout << CURRENT_FUNCTION << std::endl;
-      TEST(true);
-      TEST(false);
-    }
-  }
-
-  namespace utChangeList_archiving {
-    void test(){
-#   ifdef ENABLE_SERIALIZATION
-      std::cout << CURRENT_FUNCTION << std::endl;
-      std::string filename("./cChangeList_basic_serialization.xml");
-      int changelist_size = 10;
-      int change_count = 5;
-      tArray<int> recorded_changes(change_count);
-
-      {
-        cChangeList cl(changelist_size);
-        TEST(cl.GetSize() == changelist_size);
-
-        TEST(cl.GetChangeCount() == 0);
-        cl.PushChange(1);
-        cl.PushChange(7);
-        cl.PushChange(3);
-        cl.PushChange(5);
-        cl.PushChange(2);
-        TEST(cl.GetChangeCount() == change_count);
-
-        for(int i = 0; i < change_count; i++) {
-          recorded_changes[i] = cl.CheckChangeAt(i);
-        }
-        save_stuff<>(cl, filename.c_str());
-      }
-
-      {
-        cChangeList cl;
-        TEST(cl.GetSize() == 0);
-        TEST(cl.GetChangeCount() == 0);
-
-        restore_stuff<>(cl, filename.c_str());
-        TEST(cl.GetChangeCount() == change_count);
-        for(int i = 0; i < change_count; i++) {
-          TEST(recorded_changes[i] == cl.CheckChangeAt(i));
-        }
-      }
-
-      std::remove(filename.c_str());
-#   endif // ENABLE_SERIALIZATION
-    }
-  } // utChangeList_archiving
-
-
-
-  void UnitTests(bool full)
-  { 
-    //if(full) utChangeList_hello_world::test();
-    if(full) utChangeList_archiving::test();
-  }
-} // nChangeList
-
-#endif // ENABLE_UNIT_TESTS
-

Modified: development/source/tools/cChangeList.h
===================================================================
--- development/source/tools/cChangeList.h	2006-10-12 20:07:15 UTC (rev 1041)
+++ development/source/tools/cChangeList.h	2006-10-12 20:24:01 UTC (rev 1042)
@@ -125,15 +125,4 @@
   }
 };
 
-#ifdef ENABLE_UNIT_TESTS
-namespace nChangeList {
-  /**   
-   * Run unit tests
-   *
-   * @param full Run full test suite; if false, just the fast tests.
-   **/
-  void UnitTests(bool full = false);
-}
-#endif  
-
 #endif




More information about the Avida-cvs mailing list