[Avida-cvs] [avida-svn] r844 - in development/source: testsuites tools
avidaedward@myxo.css.msu.edu
avidaedward at myxo.css.msu.edu
Wed Jul 19 13:00:57 PDT 2006
Author: avidaedward
Date: 2006-07-19 16:00:57 -0400 (Wed, 19 Jul 2006)
New Revision: 844
Added:
development/source/tools/cUnitTestDemo.cc
Modified:
development/source/testsuites/cInitFile-unit-tests.cc
development/source/testsuites/full-unit-tests.cc
development/source/tools/cFixedCoords.cc
development/source/tools/cSchedule.cc
development/source/tools/cString.cc
development/source/tools/nTemplateTests.cc
Log:
Updated unit tests to remove deps on Boost.
Modified: development/source/testsuites/cInitFile-unit-tests.cc
===================================================================
--- development/source/testsuites/cInitFile-unit-tests.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/testsuites/cInitFile-unit-tests.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -1,11 +1,11 @@
#include "cInitFile.h"
-#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test.h"
int main() {
nInitFile::UnitTests(true);
- return boost::report_errors();
+ return report_errors();
}
Modified: development/source/testsuites/full-unit-tests.cc
===================================================================
--- development/source/testsuites/full-unit-tests.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/testsuites/full-unit-tests.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -9,7 +9,7 @@
#include "cString.h"
#include "nTemplateTests.h"
-#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test.h"
int main() {
@@ -26,6 +26,6 @@
nStringList::UnitTests(true);
nTemplateTests::UnitTests(true);
- return boost::report_errors();
+ return report_errors();
}
Modified: development/source/tools/cFixedCoords.cc
===================================================================
--- development/source/tools/cFixedCoords.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/tools/cFixedCoords.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -16,7 +16,7 @@
*/
#include "cXMLArchive.h"
-#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test.h"
#include <cstdio> // for std::remove() to remove temporary files.
#include <iomanip>
@@ -45,16 +45,16 @@
namespace utFixedCoords_hello_world {
void test(){
- std::cout << "utFixedCoords_hello_world" << std::endl;
- BOOST_TEST(true);
- BOOST_TEST(false);
+ std::cout << CURRENT_FUNCTION << std::endl;
+ TEST(true);
+ TEST(false);
}
}
namespace utFixedCoords_archiving {
void test(){
# ifdef ENABLE_SERIALIZATION
- std::cout << "utFixedCoords_archiving" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./cFixedCoords_basic_serialization.xml");
/*
@@ -62,11 +62,11 @@
*/
{
cFixedCoords fc;
- BOOST_TEST(0 == fc.GetBlockNum());
- BOOST_TEST(0 == fc.GetOffset());
+ TEST(0 == fc.GetBlockNum());
+ TEST(0 == fc.GetOffset());
fc(2,3);
- BOOST_TEST(2 == fc.GetBlockNum());
- BOOST_TEST(3 == fc.GetOffset());
+ TEST(2 == fc.GetBlockNum());
+ TEST(3 == fc.GetOffset());
save_stuff<>(fc, filename.c_str());
}
/*
@@ -74,11 +74,11 @@
*/
{
cFixedCoords fc;
- BOOST_TEST(0 == fc.GetBlockNum());
- BOOST_TEST(0 == fc.GetOffset());
+ TEST(0 == fc.GetBlockNum());
+ TEST(0 == fc.GetOffset());
restore_stuff<>(fc, filename.c_str());
- BOOST_TEST(2 == fc.GetBlockNum());
- BOOST_TEST(3 == fc.GetOffset());
+ TEST(2 == fc.GetBlockNum());
+ TEST(3 == fc.GetOffset());
}
std::remove(filename.c_str());
Modified: development/source/tools/cSchedule.cc
===================================================================
--- development/source/tools/cSchedule.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/tools/cSchedule.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -41,7 +41,7 @@
#include "cFile.h"
#include "cXMLArchive.h"
-#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test.h"
#include <cstdio> // for std::remove() to remove temporary files.
#include <iomanip>
@@ -76,15 +76,17 @@
namespace utSchedule_hello_world {
void test(){
- BOOST_TEST(true);
- BOOST_TEST(false);
+ std::cout << CURRENT_FUNCTION << std::endl;
+ TEST(true);
+ TEST(false);
}
}
namespace utSchedule_archiving {
void test(){
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./cSchedule_basic_serialization.xml");
- BOOST_TEST(tMemTrack<cChangeList>::Instances() == 0);
+ TEST(tMemTrack<cChangeList>::Instances() == 0);
{
}
{
@@ -97,14 +99,8 @@
void UnitTests(bool full)
{
- //if(full) {
- // std::cout << "utSchedule_hello_world" << std::endl;
- // utSchedule_hello_world::test();
- //}
- if(full) {
- std::cout << "utSchedule_archiving" << std::endl;
- utSchedule_archiving::test();
- }
+ //if(full) utSchedule_hello_world::test();
+ if(full) utSchedule_archiving::test();
}
} // nSchedule
Modified: development/source/tools/cString.cc
===================================================================
--- development/source/tools/cString.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/tools/cString.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -719,6 +719,40 @@
TEST(false);
}
}
+
+ namespace utString_string_manip {
+ void test() {
+ std::cout << CURRENT_FUNCTION << std::endl;
+ cString test_str("string is string 321");
+ TEST(test_str.Replace("ring", "rung", 9) != -1);
+ TEST(test_str[3] == 'i');
+ TEST(test_str[13] == 'u');
+ TEST(test_str.PopWord() == "string");
+ TEST(test_str.Pop('s') == "i");
+ TEST(test_str.LeftJustify() == 1);
+ test_str.Reverse();
+ TEST(test_str == "123 gnurts");
+ TEST(test_str.GetWord(1) == "gnurts");
+ TEST(test_str.GetWordAt(6) == "urts");
+ TEST(test_str.ToUpper() == "123 GNURTS");
+ TEST(test_str.IsWhitespace(2) == false);
+ TEST(test_str.IsWhitespace(3) == true);
+ TEST(test_str.IsWhitespace(4) == false);
+ TEST(test_str.CountNumWords() == 2);
+ TEST(test_str.PopWord().AsInt() == 123);
+ TEST(test_str.Find('T') == 4);
+ TEST((test_str += " 4fun") == "GNURTS 4fun");
+ TEST(test_str.ToLower() == "gnurts 4fun");
+ TEST(test_str.Insert(" should r", 3, 6) == "gnu should run");
+ TEST(test_str.ClipEnd(3) == "gnu should ");
+ test_str.CompressWhitespace();
+ TEST(test_str == "gnu should");
+ test_str.RemoveChar('u');
+ TEST(test_str == "gn shold");
+
+ std::cout << "Finished: " << CURRENT_FUNCTION << std::endl;
+ }
+ }
namespace utString_archiving {
void test() {
@@ -859,6 +893,7 @@
void UnitTests(bool full)
{
//if(full) utString_hello_world::test();
+ if(full) utString_string_manip::test();
if(full) utString_archiving::test();
}
} // nString
Added: development/source/tools/cUnitTestDemo.cc
===================================================================
--- development/source/tools/cUnitTestDemo.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/tools/cUnitTestDemo.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -0,0 +1,85 @@
+
+using namespace std;
+
+/*
+cUnitTestDemo Declarations
+*/
+class cUnitTestDemo {
+public:
+ bool blah();
+};
+
+/*
+Declare a function "UnitTests" that runs the testsuite for
+cUnitTestDemo. It lives in a special namespace "nUnitTestDemo" named
+after cUnitTestDemo.
+*/
+namespace nUnitTestDemo {
+ void UnitTests(bool full = false);
+}
+
+/*
+cUnitTestDemo Definitions
+*/
+bool cUnitTestDemo::blah(){
+ return false;
+}
+
+/* Include the unit-testing header file. */
+#include "lightweight_test.h"
+
+#include <iostream>
+using namespace std;
+
+/*
+Define a testsuite for cUnitTestDemo. It consists of a bunch of tests,
+each in its own namespace, and a function "UnitTests" to run all of the
+tests.
+*/
+namespace nUnitTestDemo {
+ /* A unit test. */
+ namespace ut_hello_world {
+ void test(){
+ /*
+ CURRENT_FUNCTION is part of lightweight_test.h. It expands to a
+ string containing the name of this function.
+ */
+ cout << CURRENT_FUNCTION << endl;
+ /*
+ 'TEST()' is used in the same way as 'assert()', except that on a
+ failure, it doesn't abort. Instead it tells you about the failure,
+ including the line number and file name.
+ */
+ /* This test should pass... */
+ TEST(true);
+ /* This test should fail... */
+ TEST(false);
+ cout << "finished " << CURRENT_FUNCTION << endl;
+ }
+ }
+ /* Another unit test. */
+ namespace ut_blah {
+ void test(){
+ cout << CURRENT_FUNCTION << endl;
+ cUnitTestDemo d;
+ TEST(!d.blah());
+ cout << "finished " << CURRENT_FUNCTION << endl;
+ }
+ }
+ /* A function to run all of the above tests. */
+ void UnitTests(bool full)
+ {
+ if(full) ut_hello_world::test();
+ if(full) ut_blah::test();
+ }
+}
+
+/*
+Calls "UnitTests" for "cUnitTestDemo". If you had more classes to tests,
+each would have its own "UnitTests", and they would be called here.
+*/
+int main(){
+ /* Run all of the unit tests for cUnitTestDemo. */
+ nUnitTestDemo::UnitTests(true);
+ return report_errors();
+}
Modified: development/source/tools/nTemplateTests.cc
===================================================================
--- development/source/tools/nTemplateTests.cc 2006-07-17 22:34:59 UTC (rev 843)
+++ development/source/tools/nTemplateTests.cc 2006-07-19 20:00:57 UTC (rev 844)
@@ -24,7 +24,7 @@
#include "tMemTrack.h"
#include "tSmartArray.h"
-#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test.h"
#include <cstdio> // for std::remove() to remove temporary files.
#include <iomanip>
@@ -78,28 +78,28 @@
namespace utTemplateTests_hello_world {
void test(){
- std::cout << "utTemplateTests_hello_world" << std::endl;
- BOOST_TEST(true);
- BOOST_TEST(false);
+ std::cout << CURRENT_FUNCTION << std::endl;
+ TEST(true);
+ TEST(false);
}
}
namespace utMemTrack {
void test() {
- std::cout << "utMemTrack" << std::endl;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ std::cout << CURRENT_FUNCTION << std::endl;
+ TEST(0 == tMemTrack<A>::Instances());
{
A a;
- BOOST_TEST(1 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<A>::Instances());
}
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
A *p;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
p = new A();
- BOOST_TEST(1 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<A>::Instances());
delete p;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
}
}
@@ -107,36 +107,36 @@
namespace utList_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utList_basic_serialization" << std::endl;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ std::cout << CURRENT_FUNCTION << std::endl;
+ TEST(0 == tMemTrack<A>::Instances());
A *a;
tList<A> l;
tListIterator<A> it(l);
std::string filename("./tList_basic_serialization.xml");
int i, listsize = 10;
- BOOST_TEST(1 == tMemTrack<tList<A> >::Instances());
- BOOST_TEST(1 == tMemTrack<tListNode<A> >::Instances());
+ TEST(1 == tMemTrack<tList<A> >::Instances());
+ TEST(1 == tMemTrack<tListNode<A> >::Instances());
/*
Construct basic list.
*/
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
for(i=0; i<listsize; i++){
a = new A;
a->m_i = i;
l.PushRear(a);
}
- BOOST_TEST(listsize == tMemTrack<A>::Instances());
- BOOST_TEST(1 + listsize == tMemTrack<tListNode<A> >::Instances());
+ TEST(listsize == tMemTrack<A>::Instances());
+ TEST(1 + listsize == tMemTrack<tListNode<A> >::Instances());
/*
Verify basic list contents.
*/
- BOOST_TEST(listsize == tMemTrack<A>::Instances());
+ TEST(listsize == tMemTrack<A>::Instances());
it.Reset();
for(i=0; (a = it.Next()); i++){
- BOOST_TEST(i == a->m_i);
+ TEST(i == a->m_i);
}
/*
@@ -148,30 +148,30 @@
delete a;
}
l.Clear();
- BOOST_TEST(0 == tMemTrack<A>::Instances());
- BOOST_TEST(1 == tMemTrack<tList<A> >::Instances());
- BOOST_TEST(1 == tMemTrack<tListNode<A> >::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<tList<A> >::Instances());
+ TEST(1 == tMemTrack<tListNode<A> >::Instances());
/*
Reload basic list.
*/
restore_stuff<>(l, filename.c_str());
- BOOST_TEST(1 == tMemTrack<tList<A> >::Instances());
- BOOST_TEST(listsize == tMemTrack<A>::Instances());
- BOOST_TEST(1 + listsize == tMemTrack<tListNode<A> >::Instances());
+ TEST(1 == tMemTrack<tList<A> >::Instances());
+ TEST(listsize == tMemTrack<A>::Instances());
+ TEST(1 + listsize == tMemTrack<tListNode<A> >::Instances());
/*
Verify contents of reloaded basic list.
*/
for(i=0; i<listsize; i++){
a = l.Pop();
- BOOST_TEST(i == a->m_i);
+ TEST(i == a->m_i);
delete a;
}
- BOOST_TEST(0 == tMemTrack<A>::Instances());
- BOOST_TEST(1 == tMemTrack<tList<A> >::Instances());
- BOOST_TEST(1 == tMemTrack<tListNode<A> >::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<tList<A> >::Instances());
+ TEST(1 == tMemTrack<tListNode<A> >::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -181,7 +181,7 @@
namespace utList_archive_structure {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utList_archive_structure" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tList_archive_structure.xml");
A *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10;
@@ -192,15 +192,15 @@
/*
Construct list...
*/
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
a1 = new A;
a2 = new A;
- BOOST_TEST(2 == tMemTrack<A>::Instances());
+ TEST(2 == tMemTrack<A>::Instances());
l.PushRear(a1);
l.PushRear(a2);
l.PushRear(a1);
l.PushRear(a2);
- BOOST_TEST(2 == tMemTrack<A>::Instances());
+ TEST(2 == tMemTrack<A>::Instances());
/*
Verify list structure. It should now contain two copies each,
@@ -211,23 +211,23 @@
a4 = it.Next();
a5 = it.Next();
a6 = it.Next();
- BOOST_TEST(2 == tMemTrack<A>::Instances());
+ TEST(2 == tMemTrack<A>::Instances());
a1->m_i = 3;
a2->m_i = 5;
- BOOST_TEST(3 == a3->m_i);
- BOOST_TEST(5 == a4->m_i);
- BOOST_TEST(3 == a5->m_i);
- BOOST_TEST(5 == a6->m_i);
+ TEST(3 == a3->m_i);
+ TEST(5 == a4->m_i);
+ TEST(3 == a5->m_i);
+ TEST(5 == a6->m_i);
/*
Save to disk, clear, and reload.
*/
save_stuff<>(l, filename.c_str());
- BOOST_TEST(2 == tMemTrack<A>::Instances());
+ TEST(2 == tMemTrack<A>::Instances());
l.Clear();
- BOOST_TEST(2 == tMemTrack<A>::Instances());
+ TEST(2 == tMemTrack<A>::Instances());
restore_stuff<>(l, filename.c_str());
@@ -235,7 +235,7 @@
New list should contain two copies each, interleaved, of the two
new instances of A.
*/
- BOOST_TEST(4 == tMemTrack<A>::Instances());
+ TEST(4 == tMemTrack<A>::Instances());
/*
Verify new list structure.
@@ -245,12 +245,12 @@
a8 = it.Next();
a9 = it.Next();
a10 = it.Next();
- BOOST_TEST(4 == tMemTrack<A>::Instances());
+ TEST(4 == tMemTrack<A>::Instances());
- BOOST_TEST(3 == a7->m_i);
- BOOST_TEST(5 == a8->m_i);
- BOOST_TEST(3 == a9->m_i);
- BOOST_TEST(5 == a10->m_i);
+ TEST(3 == a7->m_i);
+ TEST(5 == a8->m_i);
+ TEST(3 == a9->m_i);
+ TEST(5 == a10->m_i);
/*
Verify that elements of old and new lists are independent.
@@ -258,14 +258,14 @@
a1->m_i = 7;
a7->m_i = 11;
a8->m_i = 13;
- BOOST_TEST(7 == a3->m_i);
- BOOST_TEST(5 == a4->m_i);
- BOOST_TEST(7 == a5->m_i);
- BOOST_TEST(5 == a6->m_i);
- BOOST_TEST(11 == a7->m_i);
- BOOST_TEST(13 == a8->m_i);
- BOOST_TEST(11 == a9->m_i);
- BOOST_TEST(13 == a10->m_i);
+ TEST(7 == a3->m_i);
+ TEST(5 == a4->m_i);
+ TEST(7 == a5->m_i);
+ TEST(5 == a6->m_i);
+ TEST(11 == a7->m_i);
+ TEST(13 == a8->m_i);
+ TEST(11 == a9->m_i);
+ TEST(13 == a10->m_i);
l.Clear();
/*
@@ -278,7 +278,7 @@
*/
delete a7;
delete a8;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -288,18 +288,18 @@
namespace utArrays_of_pointers {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utArrays_of_pointers" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
const int num_instances = 3;
tArray<A *> instance_array(num_instances);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ 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());
+ TEST(num_instances == tMemTrack<A>::Instances());
for (int i = 0; i < num_instances; i++){
delete instance_array[i];
}
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
# endif // ENABLE_SERIALIZATION
}
} // utArrays_of_pointers
@@ -307,13 +307,13 @@
namespace utArray_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utArray_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tArray_basic_serialization.xml");
int i, arraysize = 10;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
tArray<A> l(arraysize);
- BOOST_TEST(arraysize == tMemTrack<A>::Instances());
+ TEST(arraysize == tMemTrack<A>::Instances());
/*
Construct basic array.
@@ -326,7 +326,7 @@
Verify basic array contents.
*/
for(i=0; i<arraysize; i++){
- BOOST_TEST(i == l[i].m_i);
+ TEST(i == l[i].m_i);
}
/*
@@ -334,23 +334,23 @@
*/
save_stuff<>(l, filename.c_str());
l.ResizeClear(0);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
/*
Reload basic array.
*/
restore_stuff<>(l, filename.c_str());
- BOOST_TEST(arraysize == tMemTrack<A>::Instances());
+ TEST(arraysize == tMemTrack<A>::Instances());
/*
Verify contents of reloaded basic array.
*/
for(i=0; i<arraysize; i++){
- BOOST_TEST(i == l[i].m_i);
+ TEST(i == l[i].m_i);
}
l.ResizeClear(0);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -360,22 +360,22 @@
namespace utHashTable_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utHashTable_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tHashTable_basic_serialization.xml");
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
tHashTable<cString, A> d;
char keystr[9] = "number 0";
int i, dictsize = 10;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
// Sanity checks.
- BOOST_TEST(d.OK());
- BOOST_TEST(0 == d.GetSize());
- BOOST_TEST(!d.HasEntry("blah"));
+ TEST(d.OK());
+ TEST(0 == d.GetSize());
+ TEST(!d.HasEntry("blah"));
{
A a;
- BOOST_TEST(!d.Find("blah", a));
+ TEST(!d.Find("blah", a));
}
/*
@@ -387,7 +387,7 @@
a.m_i = i;
d.Add(cString(keystr), a);
}
- BOOST_TEST(dictsize == tMemTrack<A>::Instances());
+ TEST(dictsize == tMemTrack<A>::Instances());
/*
Verify basic dict contents.
@@ -395,16 +395,16 @@
for(i=0; i<dictsize; i++){
A a;
keystr[7] = '0' + i;
- BOOST_TEST(d.Find(cString(keystr), a));
- BOOST_TEST(i == a.m_i);
+ TEST(d.Find(cString(keystr), a));
+ TEST(i == a.m_i);
}
- BOOST_TEST(d.OK());
+ TEST(d.OK());
/*
Save basic table.
*/
save_stuff<>(d, filename.c_str());
- BOOST_TEST(dictsize == tMemTrack<A>::Instances());
+ TEST(dictsize == tMemTrack<A>::Instances());
/*
Reload basic table.
@@ -412,8 +412,8 @@
{
tHashTable<cString, A> d2;
restore_stuff<>(d2, filename.c_str());
- BOOST_TEST(2 * dictsize == tMemTrack<A>::Instances());
- BOOST_TEST(d2.OK());
+ TEST(2 * dictsize == tMemTrack<A>::Instances());
+ TEST(d2.OK());
/*
Verify contents of reloaded basic dict.
@@ -421,13 +421,13 @@
for(i=0; i<dictsize; i++){
A a;
keystr[7] = '0' + i;
- BOOST_TEST(d2.Find(cString(keystr), a));
- BOOST_TEST(i == a.m_i);
+ TEST(d2.Find(cString(keystr), a));
+ TEST(i == a.m_i);
}
- BOOST_TEST(2 * dictsize == tMemTrack<A>::Instances());
+ TEST(2 * dictsize == tMemTrack<A>::Instances());
}
- BOOST_TEST(dictsize == tMemTrack<A>::Instances());
+ TEST(dictsize == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -437,24 +437,24 @@
namespace utDictionary_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utDictionary_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tDictionary_basic_serialization.xml");
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
tDictionary<A> d;
char keystr[9] = "number 0";
int i, dictsize = 10;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
// Sanity checks.
- BOOST_TEST(d.OK());
- BOOST_TEST(0 == d.GetSize());
- BOOST_TEST(!d.HasEntry("blah"));
+ TEST(d.OK());
+ TEST(0 == d.GetSize());
+ TEST(!d.HasEntry("blah"));
{
A a;
- BOOST_TEST(!d.Find("blah", a));
+ TEST(!d.Find("blah", a));
}
- BOOST_TEST(cString("") == d.NearMatch("blah"));
+ TEST(cString("") == d.NearMatch("blah"));
/*
Construct basic dict.
@@ -465,7 +465,7 @@
a.m_i = i;
d.Add(cString(keystr), a);
}
- BOOST_TEST(dictsize == tMemTrack<A>::Instances());
+ TEST(dictsize == tMemTrack<A>::Instances());
/*
Verify basic dict contents.
@@ -473,16 +473,16 @@
for(i=0; i<dictsize; i++){
A a;
keystr[7] = '0' + i;
- BOOST_TEST(d.Find(cString(keystr), a));
- BOOST_TEST(i == a.m_i);
+ TEST(d.Find(cString(keystr), a));
+ TEST(i == a.m_i);
}
- BOOST_TEST(d.OK());
+ TEST(d.OK());
/*
Save basic list.
*/
save_stuff<>(d, filename.c_str());
- BOOST_TEST(dictsize == tMemTrack<A>::Instances());
+ TEST(dictsize == tMemTrack<A>::Instances());
/*
Reload basic list.
@@ -490,8 +490,8 @@
{
tDictionary<A> d2;
restore_stuff<>(d2, filename.c_str());
- BOOST_TEST(2 * dictsize == tMemTrack<A>::Instances());
- BOOST_TEST(d2.OK());
+ TEST(2 * dictsize == tMemTrack<A>::Instances());
+ TEST(d2.OK());
/*
Verify contents of reloaded basic dict.
@@ -499,13 +499,13 @@
for(i=0; i<dictsize; i++){
A a;
keystr[7] = '0' + i;
- BOOST_TEST(d2.Find(cString(keystr), a));
- BOOST_TEST(i == a.m_i);
+ TEST(d2.Find(cString(keystr), a));
+ TEST(i == a.m_i);
}
- BOOST_TEST(2 * dictsize == tMemTrack<A>::Instances());
+ TEST(2 * dictsize == tMemTrack<A>::Instances());
}
- BOOST_TEST(dictsize == tMemTrack<A>::Instances());
+ TEST(dictsize == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -515,14 +515,14 @@
namespace utBuffer_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utBuffer_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tBuffer_basic_serialization.xml");
A a;
int i, buffer_size = 10;
- BOOST_TEST(1 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<A>::Instances());
tBuffer<A> b(buffer_size);
- BOOST_TEST(1 + buffer_size == tMemTrack<A>::Instances());
+ TEST(1 + buffer_size == tMemTrack<A>::Instances());
/*
Construct basic buffer.
@@ -536,12 +536,12 @@
Verify basic buffer contents.
*/
for(i=0; i < buffer_size - 1; i++){
- BOOST_TEST(buffer_size - 2 - i == b[i].m_i);
+ TEST(buffer_size - 2 - i == b[i].m_i);
}
- BOOST_TEST(b.GetCapacity() == buffer_size);
- BOOST_TEST(b.GetTotal() == buffer_size - 1);
- BOOST_TEST(b.GetNumStored() == buffer_size - 1);
- BOOST_TEST(b.GetNum() == buffer_size - 1);
+ TEST(b.GetCapacity() == buffer_size);
+ TEST(b.GetTotal() == buffer_size - 1);
+ TEST(b.GetNumStored() == buffer_size - 1);
+ TEST(b.GetNum() == buffer_size - 1);
/*
Save and clear basic buffer.
@@ -553,30 +553,30 @@
b.Add(a);
}
for(i=0; i < buffer_size - 1; i++){
- BOOST_TEST(0 == b[i].m_i);
+ TEST(0 == b[i].m_i);
}
b.Clear();
- BOOST_TEST(b.GetCapacity() == buffer_size);
- BOOST_TEST(b.GetTotal() == 0);
- BOOST_TEST(b.GetNumStored() == 0);
- BOOST_TEST(b.GetNum() == 0);
+ TEST(b.GetCapacity() == buffer_size);
+ TEST(b.GetTotal() == 0);
+ TEST(b.GetNumStored() == 0);
+ TEST(b.GetNum() == 0);
/*
Reload basic buffer.
*/
restore_stuff<>(b, filename.c_str());
- BOOST_TEST(1 + buffer_size == tMemTrack<A>::Instances());
+ TEST(1 + buffer_size == tMemTrack<A>::Instances());
/*
Verify contents of reloaded basic buffer.
*/
for(i=0; i < buffer_size - 1; i++){
- BOOST_TEST(buffer_size - 2 - i == b[i].m_i);
+ TEST(buffer_size - 2 - i == b[i].m_i);
}
- BOOST_TEST(b.GetCapacity() == buffer_size);
- BOOST_TEST(b.GetTotal() == buffer_size - 1);
- BOOST_TEST(b.GetNumStored() == buffer_size - 1);
- BOOST_TEST(b.GetNum() == buffer_size - 1);
+ TEST(b.GetCapacity() == buffer_size);
+ TEST(b.GetTotal() == buffer_size - 1);
+ TEST(b.GetNumStored() == buffer_size - 1);
+ TEST(b.GetNum() == buffer_size - 1);
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -586,13 +586,13 @@
namespace utManagedPointerArray_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utManagedPointerArray_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tManagedPointerArray_basic_serialization.xml");
int i, arraysize = 10;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
tManagedPointerArray<A> l(arraysize);
- BOOST_TEST(arraysize == tMemTrack<A>::Instances());
+ TEST(arraysize == tMemTrack<A>::Instances());
/*
Construct basic array.
@@ -605,7 +605,7 @@
Verify basic array contents.
*/
for(i=0; i<arraysize; i++){
- BOOST_TEST(i == l[i].m_i);
+ TEST(i == l[i].m_i);
}
/*
@@ -613,23 +613,23 @@
*/
save_stuff<>(l, filename.c_str());
l.ResizeClear(0);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
/*
Reload basic array.
*/
restore_stuff<>(l, filename.c_str());
- BOOST_TEST(arraysize == tMemTrack<A>::Instances());
+ TEST(arraysize == tMemTrack<A>::Instances());
/*
Verify contents of reloaded basic array.
*/
for(i=0; i<arraysize; i++){
- BOOST_TEST(i == l[i].m_i);
+ TEST(i == l[i].m_i);
}
l.ResizeClear(0);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -639,13 +639,13 @@
namespace utSmartArray_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utSmartArray_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tSmartArray_basic_serialization.xml");
int i, arraysize = 10;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
tSmartArray<A> l(arraysize);
- BOOST_TEST(arraysize == tMemTrack<A>::Instances());
+ TEST(arraysize == tMemTrack<A>::Instances());
/*
Construct basic array.
@@ -658,7 +658,7 @@
Verify basic array contents.
*/
for(i=0; i<arraysize; i++){
- BOOST_TEST(i == l[i].m_i);
+ TEST(i == l[i].m_i);
}
/*
@@ -666,23 +666,23 @@
*/
save_stuff<>(l, filename.c_str());
l.ResizeClear(0);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
/*
Reload basic array.
*/
restore_stuff<>(l, filename.c_str());
- BOOST_TEST(arraysize == tMemTrack<A>::Instances());
+ TEST(arraysize == tMemTrack<A>::Instances());
/*
Verify contents of reloaded basic array.
*/
for(i=0; i<arraysize; i++){
- BOOST_TEST(i == l[i].m_i);
+ TEST(i == l[i].m_i);
}
l.ResizeClear(0);
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
@@ -692,13 +692,13 @@
namespace utMatrix_basic_serialization {
void test() {
# ifdef ENABLE_SERIALIZATION
- std::cout << "utMatrix_basic_serialization" << std::endl;
+ std::cout << CURRENT_FUNCTION << std::endl;
std::string filename("./tMatrix_basic_serialization.xml");
int i, j, rows = 3, cols = 5;
- BOOST_TEST(0 == tMemTrack<A>::Instances());
+ TEST(0 == tMemTrack<A>::Instances());
tMatrix<A> m(rows, cols);
- BOOST_TEST(rows * cols == tMemTrack<A>::Instances());
+ TEST(rows * cols == tMemTrack<A>::Instances());
/*
Construct basic matrix.
@@ -715,8 +715,8 @@
*/
for(i=0; i<rows; i++){
for(j=0; j<cols; j++){
- BOOST_TEST(i == m[i][j].m_i);
- BOOST_TEST(j == m[i][j].m_j);
+ TEST(i == m[i][j].m_i);
+ TEST(j == m[i][j].m_j);
}
}
@@ -725,26 +725,26 @@
*/
save_stuff<>(m, filename.c_str());
m.ResizeClear(1,1);
- BOOST_TEST(1 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<A>::Instances());
/*
Reload basic matrix.
*/
restore_stuff<>(m, filename.c_str());
- BOOST_TEST(rows * cols == tMemTrack<A>::Instances());
+ TEST(rows * cols == tMemTrack<A>::Instances());
/*
Verify contents of reloaded basic matrix.
*/
for(i=0; i<rows; i++){
for(j=0; j<cols; j++){
- BOOST_TEST(i == m[i][j].m_i);
- BOOST_TEST(j == m[i][j].m_j);
+ TEST(i == m[i][j].m_i);
+ TEST(j == m[i][j].m_j);
}
}
m.ResizeClear(1,1);
- BOOST_TEST(1 == tMemTrack<A>::Instances());
+ TEST(1 == tMemTrack<A>::Instances());
std::remove(filename.c_str());
# endif // ENABLE_SERIALIZATION
More information about the Avida-cvs
mailing list