[Avida-cvs] [avida-svn] r716 - development/source/tools

kaben@myxo.css.msu.edu kaben at myxo.css.msu.edu
Sat May 27 03:26:27 PDT 2006


Author: kaben
Date: 2006-05-27 06:26:27 -0400 (Sat, 27 May 2006)
New Revision: 716

Modified:
   development/source/tools/nTemplateTests.cc
Log:

Added unit test to verify that tArrays of pointers work as expected.



Modified: development/source/tools/nTemplateTests.cc
===================================================================
--- development/source/tools/nTemplateTests.cc	2006-05-27 10:26:03 UTC (rev 715)
+++ development/source/tools/nTemplateTests.cc	2006-05-27 10:26:27 UTC (rev 716)
@@ -277,6 +277,22 @@
     }
   } // utList_archive_structure
 
+  namespace utArrays_of_pointers {
+    void test(){
+      const int num_instances = 3;
+      tArray<A *> instance_array(num_instances);
+      BOOST_TEST(0 == tMemTrack<A>::Instances());
+      for (int i = 0; i < num_instances; i++){
+        instance_array[i] = new A();
+      }
+      BOOST_TEST(num_instances == tMemTrack<A>::Instances());
+      for (int i = 0; i < num_instances; i++){
+        delete instance_array[i];
+      }
+      BOOST_TEST(0 == tMemTrack<A>::Instances());
+    }
+  } // utArrays_of_pointers
+
   namespace utArray_basic_serialization {
     void test(){
       std::string filename("./tArray_basic_serialization.xml");
@@ -725,6 +741,10 @@
       utList_archive_structure::test();
     }
     if(full) {
+      std::cout << "utArrays_of_pointers" << std::endl;
+      utArrays_of_pointers::test();
+    }
+    if(full) {
       std::cout << "utArray_basic_serialization" << std::endl;
       utArray_basic_serialization::test();
     }




More information about the Avida-cvs mailing list