Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ src/Makefile.am	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -1,6 +1,6 @@
+SUBDIRS = unittests
+
 SOURCE = atom.cpp bond.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp moleculelist.cpp molecules.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
 HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp molecules.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
-
-noinst_PROGRAMS =  VectorUnitTest MemoryAllocatorUnitTest MemoryUsageObserverUnitTest
 
 bin_PROGRAMS = molecuilder joiner analyzer
@@ -11,17 +11,3 @@
 analyzer_SOURCES = analyzer.cpp datacreator.cpp element.cpp helpers.cpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp periodentafel.cpp parser.cpp verbose.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 
 
-TESTS = VectorUnitTest MemoryAllocatorUnitTest
-check_PROGRAMS = $(TESTS)
-VectorUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp vectorunittest.cpp vectorunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp 
-VectorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
-VectorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
-
-MemoryAllocatorUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp verbose.cpp verbose.hpp 
-MemoryAllocatorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
-MemoryAllocatorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
-
-MemoryUsageObserverUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp memoryusageobserver.hpp memoryusageobserver.cpp verbose.cpp verbose.hpp 
-MemoryUsageObserverUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
-MemoryUsageObserverUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
-
 EXTRA_DIST = ${molecuilder_DATA}
Index: src/memoryallocatorunittest.cpp
===================================================================
--- src/memoryallocatorunittest.cpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * memoryallocatorunittest.cpp
- */
-
-
-using namespace std;
-
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include "memoryallocator.hpp"
-#include "memoryallocatorunittest.hpp"
-#include "helpers.hpp"
-#include "defs.hpp"
-
-/********************************************** Test classes **************************************/
-
-// Registers the fixture into the 'registry'
-CPPUNIT_TEST_SUITE_REGISTRATION( MemoryAllocatorTest );
-
-
-void MemoryAllocatorTest::setUp()
-{
-};
-
-
-void MemoryAllocatorTest::tearDown()
-{
-};
-
-/**
- * UnitTest for Malloc()
- */
-void MemoryAllocatorTest::MallocTest()
-{
-  int* buffer1 = NULL;
-  buffer1 = Malloc<int>(1, "");
-  Free(&buffer1);
-
-  long* buffer2 = NULL;
-  buffer2 = Malloc<long>(1, "");
-  Free(&buffer2);
-
-  char* buffer3 = NULL;
-  buffer3 = Malloc<char>(4, "");
-  cout << buffer3 << endl;
-  Free(&buffer3);
-
-  char** buffer4 = NULL;
-  buffer4 = Malloc<char*>(1, "");
-  Free(&buffer4);
-};
-
-/**
- * UnitTest for Calloc()
- */
-void MemoryAllocatorTest::CallocTest()
-{
-  int* buffer1 = NULL;
-  buffer1 = Calloc<int>(1, "");
-  Free(&buffer1);
-
-  long* buffer2 = NULL;
-  buffer2 = Calloc<long>(1, "");
-  Free(&buffer2);
-
-  char* buffer3 = NULL;
-  buffer3 = Calloc<char>(1, "");
-  Free(&buffer3);
-};
-
-/**
- * UnitTest for ReAlloc()
- */
-void MemoryAllocatorTest::ReAllocTest()
-{
-  int* buffer1 = NULL;
-  buffer1 = Malloc<int>(1, "");
-  buffer1 = ReAlloc<int>(buffer1, 2, "");
-  Free(&buffer1);
-
-  int* buffer2 = NULL;
-  buffer2 = ReAlloc<int>(buffer2, 2, "");
-  Free(&buffer2);
-};
-
-/**
- * UnitTest for Free()
- */
-void MemoryAllocatorTest::FreeTest()
-{
-  char** buffer1 = NULL;
-  Free(buffer1);
-
-  int** buffer2 = NULL;
-  Free(buffer2);
-};
-
-
-/********************************************** Main routine **************************************/
-
-int main(int argc, char **argv)
-{
-  // Get the top level suite from the registry
-  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-
-  // Adds the test to the list of test to run
-  CppUnit::TextUi::TestRunner runner;
-  runner.addTest( suite );
-
-  // Change the default outputter to a compiler error format outputter
-  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
-                                                       std::cerr ) );
-  // Run the tests.
-  bool wasSucessful = runner.run();
-
-  // Return error code 1 if the one of test failed.
-  return wasSucessful ? 0 : 1;
-};
Index: src/memoryallocatorunittest.hpp
===================================================================
--- src/memoryallocatorunittest.hpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,32 +1,0 @@
-/*
- * memoryallocatorunittest.hpp
- */
-
-#ifndef MEMORYALLOCATORTEST_HPP_
-#define MEMORYALLOCATORTEST_HPP_
-
-#include <cppunit/extensions/HelperMacros.h>
-
-
-/********************************************** Test classes **************************************/
-
-class MemoryAllocatorTest : public CppUnit::TestFixture
-{
-    CPPUNIT_TEST_SUITE( MemoryAllocatorTest) ;
-    CPPUNIT_TEST ( MallocTest );
-    CPPUNIT_TEST ( CallocTest );
-    CPPUNIT_TEST ( ReAllocTest );
-    CPPUNIT_TEST ( FreeTest );
-    CPPUNIT_TEST_SUITE_END();
-
-public:
-    void setUp();
-    void tearDown();
-
-    void MallocTest();
-    void CallocTest();
-    void ReAllocTest();
-    void FreeTest();
-};
-
-#endif /* MEMORYALLOCATORTEST_HPP_ */
Index: src/memoryusageobserverunittest.cpp
===================================================================
--- src/memoryusageobserverunittest.cpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,159 +1,0 @@
-/*
- * memoryusageobserverunittest.cpp
- */
-
-
-using namespace std;
-
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include "memoryallocator.hpp"
-#include "memoryusageobserver.hpp"
-#include "memoryusageobserverunittest.hpp"
-
-/********************************************** Test classes **************************************/
-// Registers the fixture into the 'registry'
-CPPUNIT_TEST_SUITE_REGISTRATION( MemoryUsageObserverTest );
-
-
-void MemoryUsageObserverTest::setUp()
-{
-};
-
-
-void MemoryUsageObserverTest::tearDown()
-{
-  MemoryUsageObserver::purgeInstance();
-};
-
-/**
- * UnitTest for getInstance()
- */
-void MemoryUsageObserverTest::getInstanceReturnsMemoryUsageObserverTest()
-{
-  CPPUNIT_ASSERT_EQUAL(true, MemoryUsageObserver::getInstance() != NULL);
-};
-
-/**
- * UnitTest for getInstance()
- */
-void MemoryUsageObserverTest::getInstanceTwiceReturnsSameInstanceTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::getInstanceTwiceReturnsSameInstanceTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
-  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
-};
-
-/**
- * UnitTest for getInstance()
- */
-void MemoryUsageObserverTest::getInstanceAfterPurgeInstanceReturnsNewInstanceTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::getInstanceAfterPurgeInstanceReturnsNewInstanceTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
-  MemoryUsageObserver::purgeInstance();
-  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
-};
-
-/**
- * UnitTest for addMemory() and removeMemory()
- */
-void MemoryUsageObserverTest::addAndRemoveMemoryTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addAndRemoveMemoryTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
-  MemoryUsageObserver::getInstance()->removeMemory(i);
-  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
-};
-
-/**
- * UnitTest for addMemory() and removeMemory()
- */
-void MemoryUsageObserverTest::removeNonTrackedMemoryDoesNotCauseACrashTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::removeNonTrackedMemoryDoesNotCauseACrashTest - i");
-  MemoryUsageObserver::getInstance()->removeMemory(i);
-  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
-};
-
-/**
- * UnitTest for addMemory() and removeMemory()
- */
-void MemoryUsageObserverTest::addMemoryTwiceTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryTwiceTest - i");
-  int* j = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryTwiceTest - j");
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  MemoryUsageObserver::getInstance()->addMemory(j, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
-};
-
-/**
- * UnitTest for addMemory() and removeMemory()
- */
-void MemoryUsageObserverTest::addMemoryAndChangeSizeOfAddedMemoryTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryAndChangeSizeOfAddedMemoryTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, 2 * sizeof(int));
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
-};
-
-/**
- * UnitTest for getMaximumUsedMemory()
- */
-void MemoryUsageObserverTest::addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, 2 * sizeof(int));
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory());
-};
-
-/**
- * UnitTest for getMaximumUsedMemory()
- */
-void MemoryUsageObserverTest::addMemoryRemoveMemoryAndGetMaximumSizeTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryRemoveMemoryAndGetMaximumSizeTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  MemoryUsageObserver::getInstance()->removeMemory(i);
-  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory());
-};
-
-/**
- * UnitTest for getPointersToAllocatedMemory()
- */
-void MemoryUsageObserverTest::getPointersToAllocatedMemoryTest()
-{
-  int* i = Malloc<int>(1, "MemoryUsageObserverTest::getPointersToAllocatedMemoryTest - i");
-  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
-  CPPUNIT_ASSERT_EQUAL(i, (int*) MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory().begin()->first);
-};
-
-
-/********************************************** Main routine **************************************/
-
-int main(int argc, char **argv)
-{
-  // Get the top level suite from the registry
-  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-
-  // Adds the test to the list of test to run
-  CppUnit::TextUi::TestRunner runner;
-  runner.addTest( suite );
-
-  // Change the default outputter to a compiler error format outputter
-  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
-                                                       std::cerr ) );
-  // Run the tests.
-  bool wasSucessful = runner.run();
-
-  // Return error code 1 if the one of test failed.
-  return wasSucessful ? 0 : 1;
-};
Index: src/memoryusageobserverunittest.hpp
===================================================================
--- src/memoryusageobserverunittest.hpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * memoryusageobserverunittest.hpp
- */
-
-#ifndef MEMORYUSAGEOBSERVERTEST_HPP_
-#define MEMORYUSAGEOBSERVERTEST_HPP_
-
-#include "memoryusageobserver.hpp"
-#include <cppunit/extensions/HelperMacros.h>
-
-
-/********************************************** Test classes **************************************/
-
-class MemoryUsageObserverTest : public CppUnit::TestFixture
-{
-    CPPUNIT_TEST_SUITE( MemoryUsageObserverTest) ;
-    CPPUNIT_TEST ( getInstanceReturnsMemoryUsageObserverTest );
-    CPPUNIT_TEST ( getInstanceTwiceReturnsSameInstanceTest );
-    CPPUNIT_TEST ( getInstanceAfterPurgeInstanceReturnsNewInstanceTest );
-    CPPUNIT_TEST ( addAndRemoveMemoryTest );
-    CPPUNIT_TEST ( removeNonTrackedMemoryDoesNotCauseACrashTest );
-    CPPUNIT_TEST ( addMemoryTwiceTest );
-    CPPUNIT_TEST ( addMemoryAndChangeSizeOfAddedMemoryTest );
-    CPPUNIT_TEST ( addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest );
-    CPPUNIT_TEST ( addMemoryRemoveMemoryAndGetMaximumSizeTest );
-    CPPUNIT_TEST ( getPointersToAllocatedMemoryTest );
-    CPPUNIT_TEST_SUITE_END();
-
-public:
-    void setUp();
-    void tearDown();
-
-    void getInstanceReturnsMemoryUsageObserverTest();
-    void getInstanceTwiceReturnsSameInstanceTest();
-    void getInstanceAfterPurgeInstanceReturnsNewInstanceTest();
-    void addAndRemoveMemoryTest();
-    void removeNonTrackedMemoryDoesNotCauseACrashTest();
-    void addMemoryTwiceTest();
-    void addMemoryAndChangeSizeOfAddedMemoryTest();
-    void addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest();
-    void addMemoryRemoveMemoryAndGetMaximumSizeTest();
-    void getPointersToAllocatedMemoryTest();
-};
-
-#endif /* MEMORYUSAGEOBSERVERTEST_HPP_ */
-
Index: src/tesselationunittest.cpp
===================================================================
--- src/tesselationunittest.cpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * tesselationunittest.cpp
- *
- *  Created on: Aug 26, 2009
- *      Author: heber
- */
-
-
-using namespace std;
-
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include "defs.hpp"
-#include "tesselation.hpp"
-#include "tesselationunittest.hpp"
-
-#define SPHERERADIUS 2.
-
-/********************************************** Test classes **************************************/
-
-// Registers the fixture into the 'registry'
-CPPUNIT_TEST_SUITE_REGISTRATION( TesselationTest );
-
-
-void TesselationTest::setUp()
-{
-  // create corners
-  class TesselPoint *Walker;
-  Walker = new TesselPoint;
-  Walker->node = new Vector(1., 0., 0.);
-  Walker->Name = new char[3];
-  strcpy(Walker->Name, "1");
-  Walker->nr = 1;
-  Corners.push_back(Walker);
-  Walker = new TesselPoint;
-  Walker->node = new Vector(-1., 1., 0.);
-  Walker->Name = new char[3];
-  strcpy(Walker->Name, "2");
-  Walker->nr = 2;
-  Corners.push_back(Walker);
-  Walker = new TesselPoint;
-  Walker->node = new Vector(-1., -1., 0.);
-  Walker->Name = new char[3];
-  strcpy(Walker->Name, "3");
-  Walker->nr = 3;
-  Corners.push_back(Walker);
-  Walker = new TesselPoint;
-  Walker->node = new Vector(-1., 0., 1.);
-  Walker->Name = new char[3];
-  strcpy(Walker->Name, "4");
-  Walker->nr = 4;
-  Corners.push_back(Walker);
-
-  // create linkedcell
-  LinkedList = new LinkedCell(&Corners, 2.*SPHERERADIUS);
-
-  // create tesselation
-  TesselStruct = new Tesselation;
-  TesselStruct->PointsOnBoundary.clear();
-  TesselStruct->LinesOnBoundary.clear();
-  TesselStruct->TrianglesOnBoundary.clear();
-  TesselStruct->FindStartingTriangle((ofstream *)&cout, SPHERERADIUS, LinkedList);
-  bool flag = false;
-
-  LineMap::iterator baseline = TesselStruct->LinesOnBoundary.begin();
-  while (baseline != TesselStruct->LinesOnBoundary.end()) {
-    if (baseline->second->triangles.size() == 1) {
-      flag = TesselStruct->FindNextSuitableTriangle((ofstream *)&cout, *(baseline->second), *(((baseline->second->triangles.begin()))->second), SPHERERADIUS, LinkedList); //the line is there, so there is a triangle, but only one.
-    }
-    baseline++;
-    if ((baseline == TesselStruct->LinesOnBoundary.end()) && (flag)) {
-      baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
-      flag = false;
-    }
-  }
-};
-
-
-void TesselationTest::tearDown()
-{
-  delete(LinkedList);
-  delete(TesselStruct);
-  for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
-    delete((*Runner)->Name);
-    delete((*Runner)->node);
-    delete(*Runner);
-  }
-  Corners.clear();
-};
-
-/** UnitTest for Tesselation::IsInnerPoint()
- */
-void TesselationTest::IsInnerPointTest()
-{
-  // true inside points
-  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.,0.), LinkedList) );
-  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.5,0.,0.), LinkedList) );
-  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.5,0.), LinkedList) );
-  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.,0.5), LinkedList) );
-
-  // corners
-  for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
-    CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, (*Runner), LinkedList) );
-
-  // true outside points
-  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,5.,0.), LinkedList) );
-  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.,5.), LinkedList) );
-  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(1.,1.,1.), LinkedList) );
-
-  // tricky point, there are three equally close triangles
-  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(5.,0.,0.), LinkedList) );
-
-};
-
-/** UnitTest for Contains...()
- *
- */
-void TesselationTest::ContainmentTest()
-{
-  class BoundaryPointSet *point = NULL;
-  class BoundaryLineSet *line = NULL;
-
-  // check ContainsBoundaryPoint
-  for(LineMap::iterator Runner = TesselStruct->LinesOnBoundary.begin(); Runner != TesselStruct->LinesOnBoundary.end(); Runner++) {
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[0]));
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[1]));
-  }
-  for(TriangleMap::iterator Runner = TesselStruct->TrianglesOnBoundary.begin(); Runner != TesselStruct->TrianglesOnBoundary.end(); Runner++) {
-    for(PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
-      point = PointRunner->second;
-      for (int i=0;i<3;i++)
-        if (point == (Runner->second)->endpoints[i])
-          point = NULL;
-      if (point != NULL)
-        break;
-    }
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[0]));
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[1]));
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[2]));
-    CPPUNIT_ASSERT_EQUAL( false, (Runner->second)->ContainsBoundaryPoint(point));
-  }
-
-  // check ContainsBoundaryLine
-  for(TriangleMap::iterator Runner = TesselStruct->TrianglesOnBoundary.begin(); Runner != TesselStruct->TrianglesOnBoundary.end(); Runner++) {
-    for(LineMap::iterator LineRunner = TesselStruct->LinesOnBoundary.begin(); LineRunner != TesselStruct->LinesOnBoundary.end(); LineRunner++) {
-      line = LineRunner->second;
-      for (int i=0;i<3;i++)
-        if (line == (Runner->second)->lines[i])
-          line = NULL;
-      if (line != NULL)
-        break;
-    }
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryLine((Runner->second)->lines[0]));
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryLine((Runner->second)->lines[1]));
-    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryLine((Runner->second)->lines[2]));
-    CPPUNIT_ASSERT_EQUAL( false, (Runner->second)->ContainsBoundaryLine(line));
-  }
-
-  // check IsPresentTupel
-  CPPUNIT_ASSERT_EQUAL( true, true );
-}
-
-/** UnitTest for Tesselation::GetAllTriangles()
- *
- */
-void TesselationTest::GetAllTrianglesTest()
-{
-  class BoundaryPointSet *Walker = NULL;
-
-  // check that there are three adjacent triangles for every boundary point
-  for (PointMap::iterator Runner = TesselStruct->PointsOnBoundary.begin(); Runner != TesselStruct->PointsOnBoundary.end(); Runner++) {
-    Walker = Runner->second;
-    set<BoundaryTriangleSet*> *triangles = TesselStruct->GetAllTriangles((ofstream *)&cout, Walker);
-    CPPUNIT_ASSERT_EQUAL( (size_t)3, triangles->size() );
-    // check that the returned triangle all contain the Walker
-    for (set<BoundaryTriangleSet*>::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); TriangleRunner++)
-      CPPUNIT_ASSERT_EQUAL( true, (*TriangleRunner)->ContainsBoundaryPoint(Walker) );
-  }
-}
-
-/********************************************** Main routine **************************************/
-
-int main(int argc, char **argv)
-{
-  // Get the top level suite from the registry
-  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-
-  // Adds the test to the list of test to run
-  CppUnit::TextUi::TestRunner runner;
-  runner.addTest( suite );
-
-  // Change the default outputter to a compiler error format outputter
-  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
-                                                       std::cerr ) );
-  // Run the tests.
-  bool wasSucessful = runner.run();
-
-  // Return error code 1 if the one of test failed.
-  return wasSucessful ? 0 : 1;
-};
Index: src/tesselationunittest.hpp
===================================================================
--- src/tesselationunittest.hpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * tesselationunittest.hpp
- *
- *  Created on: Aug 26, 2009
- *      Author: heber
- */
-
-#ifndef TESSELATIONUNITTEST_HPP_
-#define TESSELATIONUNITTEST_HPP_
-
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "tesselation.hpp"
-
-/********************************************** Test classes **************************************/
-
-class TesselationTest : public CppUnit::TestFixture
-{
-    CPPUNIT_TEST_SUITE( TesselationTest) ;
-    CPPUNIT_TEST ( IsInnerPointTest );
-    CPPUNIT_TEST ( GetAllTrianglesTest );
-    CPPUNIT_TEST ( ContainmentTest );
-    CPPUNIT_TEST_SUITE_END();
-
-public:
-      void setUp();
-      void tearDown();
-      void IsInnerPointTest();
-      void GetAllTrianglesTest();
-      void ContainmentTest();
-
-
-private:
-      class Tesselation *TesselStruct;
-      LinkedNodes Corners;
-      class LinkedCell *LinkedList;
-};
-
-
-
-#endif /* TESSELATIONUNITTEST_HPP_ */
Index: src/unittests/Makefile.am
===================================================================
--- src/unittests/Makefile.am	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/Makefile.am	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,15 @@
+noinst_PROGRAMS =  MemoryAllocatorUnitTest MemoryUsageObserverUnitTest VectorUnitTest
+
+TESTS = VectorUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest 
+check_PROGRAMS = $(TESTS)
+VectorUnitTest_SOURCES = defs.hpp helpers.hpp leastsquaremin.hpp memoryallocator.hpp memoryusageobserver.hpp vectorunittest.cpp vectorunittest.hpp vector.hpp verbose.hpp 
+VectorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
+VectorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+
+MemoryAllocatorUnitTest_SOURCES = defs.hpp helpers.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp memoryallocator.hpp memoryusageobserver.hpp verbose.hpp 
+MemoryAllocatorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS) -I..
+MemoryAllocatorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+
+MemoryUsageObserverUnitTest_SOURCES = defs.hpp helpers.hpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp memoryusageobserver.hpp verbose.hpp 
+MemoryUsageObserverUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
+MemoryUsageObserverUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
Index: src/unittests/memoryallocatorunittest.cpp
===================================================================
--- src/unittests/memoryallocatorunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/memoryallocatorunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,120 @@
+/*
+ * memoryallocatorunittest.cpp
+ */
+
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "memoryallocator.hpp"
+#include "memoryallocatorunittest.hpp"
+#include "helpers.hpp"
+#include "defs.hpp"
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( MemoryAllocatorTest );
+
+
+void MemoryAllocatorTest::setUp()
+{
+};
+
+
+void MemoryAllocatorTest::tearDown()
+{
+};
+
+/**
+ * UnitTest for Malloc()
+ */
+void MemoryAllocatorTest::MallocTest()
+{
+  int* buffer1 = NULL;
+  buffer1 = Malloc<int>(1, "");
+  Free(&buffer1);
+
+  long* buffer2 = NULL;
+  buffer2 = Malloc<long>(1, "");
+  Free(&buffer2);
+
+  char* buffer3 = NULL;
+  buffer3 = Malloc<char>(4, "");
+  cout << buffer3 << endl;
+  Free(&buffer3);
+
+  char** buffer4 = NULL;
+  buffer4 = Malloc<char*>(1, "");
+  Free(&buffer4);
+};
+
+/**
+ * UnitTest for Calloc()
+ */
+void MemoryAllocatorTest::CallocTest()
+{
+  int* buffer1 = NULL;
+  buffer1 = Calloc<int>(1, "");
+  Free(&buffer1);
+
+  long* buffer2 = NULL;
+  buffer2 = Calloc<long>(1, "");
+  Free(&buffer2);
+
+  char* buffer3 = NULL;
+  buffer3 = Calloc<char>(1, "");
+  Free(&buffer3);
+};
+
+/**
+ * UnitTest for ReAlloc()
+ */
+void MemoryAllocatorTest::ReAllocTest()
+{
+  int* buffer1 = NULL;
+  buffer1 = Malloc<int>(1, "");
+  buffer1 = ReAlloc<int>(buffer1, 2, "");
+  Free(&buffer1);
+
+  int* buffer2 = NULL;
+  buffer2 = ReAlloc<int>(buffer2, 2, "");
+  Free(&buffer2);
+};
+
+/**
+ * UnitTest for Free()
+ */
+void MemoryAllocatorTest::FreeTest()
+{
+  char** buffer1 = NULL;
+  Free(buffer1);
+
+  int** buffer2 = NULL;
+  Free(buffer2);
+};
+
+
+/********************************************** Main routine **************************************/
+
+int main(int argc, char **argv)
+{
+  // Get the top level suite from the registry
+  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+
+  // Adds the test to the list of test to run
+  CppUnit::TextUi::TestRunner runner;
+  runner.addTest( suite );
+
+  // Change the default outputter to a compiler error format outputter
+  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
+                                                       std::cerr ) );
+  // Run the tests.
+  bool wasSucessful = runner.run();
+
+  // Return error code 1 if the one of test failed.
+  return wasSucessful ? 0 : 1;
+};
Index: src/unittests/memoryallocatorunittest.hpp
===================================================================
--- src/unittests/memoryallocatorunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/memoryallocatorunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,32 @@
+/*
+ * memoryallocatorunittest.hpp
+ */
+
+#ifndef MEMORYALLOCATORTEST_HPP_
+#define MEMORYALLOCATORTEST_HPP_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+
+/********************************************** Test classes **************************************/
+
+class MemoryAllocatorTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( MemoryAllocatorTest) ;
+    CPPUNIT_TEST ( MallocTest );
+    CPPUNIT_TEST ( CallocTest );
+    CPPUNIT_TEST ( ReAllocTest );
+    CPPUNIT_TEST ( FreeTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+    void setUp();
+    void tearDown();
+
+    void MallocTest();
+    void CallocTest();
+    void ReAllocTest();
+    void FreeTest();
+};
+
+#endif /* MEMORYALLOCATORTEST_HPP_ */
Index: src/unittests/memoryusageobserverunittest.cpp
===================================================================
--- src/unittests/memoryusageobserverunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/memoryusageobserverunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,159 @@
+/*
+ * memoryusageobserverunittest.cpp
+ */
+
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "memoryallocator.hpp"
+#include "memoryusageobserver.hpp"
+#include "memoryusageobserverunittest.hpp"
+
+/********************************************** Test classes **************************************/
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( MemoryUsageObserverTest );
+
+
+void MemoryUsageObserverTest::setUp()
+{
+};
+
+
+void MemoryUsageObserverTest::tearDown()
+{
+  MemoryUsageObserver::purgeInstance();
+};
+
+/**
+ * UnitTest for getInstance()
+ */
+void MemoryUsageObserverTest::getInstanceReturnsMemoryUsageObserverTest()
+{
+  CPPUNIT_ASSERT_EQUAL(true, MemoryUsageObserver::getInstance() != NULL);
+};
+
+/**
+ * UnitTest for getInstance()
+ */
+void MemoryUsageObserverTest::getInstanceTwiceReturnsSameInstanceTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::getInstanceTwiceReturnsSameInstanceTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
+  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
+};
+
+/**
+ * UnitTest for getInstance()
+ */
+void MemoryUsageObserverTest::getInstanceAfterPurgeInstanceReturnsNewInstanceTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::getInstanceAfterPurgeInstanceReturnsNewInstanceTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
+  MemoryUsageObserver::purgeInstance();
+  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
+};
+
+/**
+ * UnitTest for addMemory() and removeMemory()
+ */
+void MemoryUsageObserverTest::addAndRemoveMemoryTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addAndRemoveMemoryTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
+  MemoryUsageObserver::getInstance()->removeMemory(i);
+  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
+};
+
+/**
+ * UnitTest for addMemory() and removeMemory()
+ */
+void MemoryUsageObserverTest::removeNonTrackedMemoryDoesNotCauseACrashTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::removeNonTrackedMemoryDoesNotCauseACrashTest - i");
+  MemoryUsageObserver::getInstance()->removeMemory(i);
+  CPPUNIT_ASSERT_EQUAL((size_t) 0, MemoryUsageObserver::getInstance()->getUsedMemorySize());
+};
+
+/**
+ * UnitTest for addMemory() and removeMemory()
+ */
+void MemoryUsageObserverTest::addMemoryTwiceTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryTwiceTest - i");
+  int* j = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryTwiceTest - j");
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  MemoryUsageObserver::getInstance()->addMemory(j, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
+};
+
+/**
+ * UnitTest for addMemory() and removeMemory()
+ */
+void MemoryUsageObserverTest::addMemoryAndChangeSizeOfAddedMemoryTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryAndChangeSizeOfAddedMemoryTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, 2 * sizeof(int));
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getUsedMemorySize());
+};
+
+/**
+ * UnitTest for getMaximumUsedMemory()
+ */
+void MemoryUsageObserverTest::addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, 2 * sizeof(int));
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(2 * sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory());
+};
+
+/**
+ * UnitTest for getMaximumUsedMemory()
+ */
+void MemoryUsageObserverTest::addMemoryRemoveMemoryAndGetMaximumSizeTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::addMemoryRemoveMemoryAndGetMaximumSizeTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  MemoryUsageObserver::getInstance()->removeMemory(i);
+  CPPUNIT_ASSERT_EQUAL(sizeof(int), MemoryUsageObserver::getInstance()->getMaximumUsedMemory());
+};
+
+/**
+ * UnitTest for getPointersToAllocatedMemory()
+ */
+void MemoryUsageObserverTest::getPointersToAllocatedMemoryTest()
+{
+  int* i = Malloc<int>(1, "MemoryUsageObserverTest::getPointersToAllocatedMemoryTest - i");
+  MemoryUsageObserver::getInstance()->addMemory(i, sizeof(int));
+  CPPUNIT_ASSERT_EQUAL(i, (int*) MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory().begin()->first);
+};
+
+
+/********************************************** Main routine **************************************/
+
+int main(int argc, char **argv)
+{
+  // Get the top level suite from the registry
+  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+
+  // Adds the test to the list of test to run
+  CppUnit::TextUi::TestRunner runner;
+  runner.addTest( suite );
+
+  // Change the default outputter to a compiler error format outputter
+  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
+                                                       std::cerr ) );
+  // Run the tests.
+  bool wasSucessful = runner.run();
+
+  // Return error code 1 if the one of test failed.
+  return wasSucessful ? 0 : 1;
+};
Index: src/unittests/memoryusageobserverunittest.hpp
===================================================================
--- src/unittests/memoryusageobserverunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/memoryusageobserverunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,46 @@
+/*
+ * memoryusageobserverunittest.hpp
+ */
+
+#ifndef MEMORYUSAGEOBSERVERTEST_HPP_
+#define MEMORYUSAGEOBSERVERTEST_HPP_
+
+#include "memoryusageobserver.hpp"
+#include <cppunit/extensions/HelperMacros.h>
+
+
+/********************************************** Test classes **************************************/
+
+class MemoryUsageObserverTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( MemoryUsageObserverTest) ;
+    CPPUNIT_TEST ( getInstanceReturnsMemoryUsageObserverTest );
+    CPPUNIT_TEST ( getInstanceTwiceReturnsSameInstanceTest );
+    CPPUNIT_TEST ( getInstanceAfterPurgeInstanceReturnsNewInstanceTest );
+    CPPUNIT_TEST ( addAndRemoveMemoryTest );
+    CPPUNIT_TEST ( removeNonTrackedMemoryDoesNotCauseACrashTest );
+    CPPUNIT_TEST ( addMemoryTwiceTest );
+    CPPUNIT_TEST ( addMemoryAndChangeSizeOfAddedMemoryTest );
+    CPPUNIT_TEST ( addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest );
+    CPPUNIT_TEST ( addMemoryRemoveMemoryAndGetMaximumSizeTest );
+    CPPUNIT_TEST ( getPointersToAllocatedMemoryTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+    void setUp();
+    void tearDown();
+
+    void getInstanceReturnsMemoryUsageObserverTest();
+    void getInstanceTwiceReturnsSameInstanceTest();
+    void getInstanceAfterPurgeInstanceReturnsNewInstanceTest();
+    void addAndRemoveMemoryTest();
+    void removeNonTrackedMemoryDoesNotCauseACrashTest();
+    void addMemoryTwiceTest();
+    void addMemoryAndChangeSizeOfAddedMemoryTest();
+    void addMemoryChangeSizeOfAddedMemoryAndGetMaximumSizeTest();
+    void addMemoryRemoveMemoryAndGetMaximumSizeTest();
+    void getPointersToAllocatedMemoryTest();
+};
+
+#endif /* MEMORYUSAGEOBSERVERTEST_HPP_ */
+
Index: src/unittests/tesselationunittest.cpp
===================================================================
--- src/unittests/tesselationunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/tesselationunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,202 @@
+/*
+ * tesselationunittest.cpp
+ *
+ *  Created on: Aug 26, 2009
+ *      Author: heber
+ */
+
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "defs.hpp"
+#include "tesselation.hpp"
+#include "tesselationunittest.hpp"
+
+#define SPHERERADIUS 2.
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( TesselationTest );
+
+
+void TesselationTest::setUp()
+{
+  // create corners
+  class TesselPoint *Walker;
+  Walker = new TesselPoint;
+  Walker->node = new Vector(1., 0., 0.);
+  Walker->Name = new char[3];
+  strcpy(Walker->Name, "1");
+  Walker->nr = 1;
+  Corners.push_back(Walker);
+  Walker = new TesselPoint;
+  Walker->node = new Vector(-1., 1., 0.);
+  Walker->Name = new char[3];
+  strcpy(Walker->Name, "2");
+  Walker->nr = 2;
+  Corners.push_back(Walker);
+  Walker = new TesselPoint;
+  Walker->node = new Vector(-1., -1., 0.);
+  Walker->Name = new char[3];
+  strcpy(Walker->Name, "3");
+  Walker->nr = 3;
+  Corners.push_back(Walker);
+  Walker = new TesselPoint;
+  Walker->node = new Vector(-1., 0., 1.);
+  Walker->Name = new char[3];
+  strcpy(Walker->Name, "4");
+  Walker->nr = 4;
+  Corners.push_back(Walker);
+
+  // create linkedcell
+  LinkedList = new LinkedCell(&Corners, 2.*SPHERERADIUS);
+
+  // create tesselation
+  TesselStruct = new Tesselation;
+  TesselStruct->PointsOnBoundary.clear();
+  TesselStruct->LinesOnBoundary.clear();
+  TesselStruct->TrianglesOnBoundary.clear();
+  TesselStruct->FindStartingTriangle((ofstream *)&cout, SPHERERADIUS, LinkedList);
+  bool flag = false;
+
+  LineMap::iterator baseline = TesselStruct->LinesOnBoundary.begin();
+  while (baseline != TesselStruct->LinesOnBoundary.end()) {
+    if (baseline->second->triangles.size() == 1) {
+      flag = TesselStruct->FindNextSuitableTriangle((ofstream *)&cout, *(baseline->second), *(((baseline->second->triangles.begin()))->second), SPHERERADIUS, LinkedList); //the line is there, so there is a triangle, but only one.
+    }
+    baseline++;
+    if ((baseline == TesselStruct->LinesOnBoundary.end()) && (flag)) {
+      baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
+      flag = false;
+    }
+  }
+};
+
+
+void TesselationTest::tearDown()
+{
+  delete(LinkedList);
+  delete(TesselStruct);
+  for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
+    delete((*Runner)->Name);
+    delete((*Runner)->node);
+    delete(*Runner);
+  }
+  Corners.clear();
+};
+
+/** UnitTest for Tesselation::IsInnerPoint()
+ */
+void TesselationTest::IsInnerPointTest()
+{
+  // true inside points
+  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.,0.), LinkedList) );
+  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.5,0.,0.), LinkedList) );
+  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.5,0.), LinkedList) );
+  CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.,0.5), LinkedList) );
+
+  // corners
+  for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
+    CPPUNIT_ASSERT_EQUAL( true, TesselStruct->IsInnerPoint((ofstream *)&cout, (*Runner), LinkedList) );
+
+  // true outside points
+  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,5.,0.), LinkedList) );
+  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(0.,0.,5.), LinkedList) );
+  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(1.,1.,1.), LinkedList) );
+
+  // tricky point, there are three equally close triangles
+  CPPUNIT_ASSERT_EQUAL( false, TesselStruct->IsInnerPoint((ofstream *)&cout, Vector(5.,0.,0.), LinkedList) );
+
+};
+
+/** UnitTest for Contains...()
+ *
+ */
+void TesselationTest::ContainmentTest()
+{
+  class BoundaryPointSet *point = NULL;
+  class BoundaryLineSet *line = NULL;
+
+  // check ContainsBoundaryPoint
+  for(LineMap::iterator Runner = TesselStruct->LinesOnBoundary.begin(); Runner != TesselStruct->LinesOnBoundary.end(); Runner++) {
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[0]));
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[1]));
+  }
+  for(TriangleMap::iterator Runner = TesselStruct->TrianglesOnBoundary.begin(); Runner != TesselStruct->TrianglesOnBoundary.end(); Runner++) {
+    for(PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
+      point = PointRunner->second;
+      for (int i=0;i<3;i++)
+        if (point == (Runner->second)->endpoints[i])
+          point = NULL;
+      if (point != NULL)
+        break;
+    }
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[0]));
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[1]));
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryPoint((Runner->second)->endpoints[2]));
+    CPPUNIT_ASSERT_EQUAL( false, (Runner->second)->ContainsBoundaryPoint(point));
+  }
+
+  // check ContainsBoundaryLine
+  for(TriangleMap::iterator Runner = TesselStruct->TrianglesOnBoundary.begin(); Runner != TesselStruct->TrianglesOnBoundary.end(); Runner++) {
+    for(LineMap::iterator LineRunner = TesselStruct->LinesOnBoundary.begin(); LineRunner != TesselStruct->LinesOnBoundary.end(); LineRunner++) {
+      line = LineRunner->second;
+      for (int i=0;i<3;i++)
+        if (line == (Runner->second)->lines[i])
+          line = NULL;
+      if (line != NULL)
+        break;
+    }
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryLine((Runner->second)->lines[0]));
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryLine((Runner->second)->lines[1]));
+    CPPUNIT_ASSERT_EQUAL( true, (Runner->second)->ContainsBoundaryLine((Runner->second)->lines[2]));
+    CPPUNIT_ASSERT_EQUAL( false, (Runner->second)->ContainsBoundaryLine(line));
+  }
+
+  // check IsPresentTupel
+  CPPUNIT_ASSERT_EQUAL( true, true );
+}
+
+/** UnitTest for Tesselation::GetAllTriangles()
+ *
+ */
+void TesselationTest::GetAllTrianglesTest()
+{
+  class BoundaryPointSet *Walker = NULL;
+
+  // check that there are three adjacent triangles for every boundary point
+  for (PointMap::iterator Runner = TesselStruct->PointsOnBoundary.begin(); Runner != TesselStruct->PointsOnBoundary.end(); Runner++) {
+    Walker = Runner->second;
+    set<BoundaryTriangleSet*> *triangles = TesselStruct->GetAllTriangles((ofstream *)&cout, Walker);
+    CPPUNIT_ASSERT_EQUAL( (size_t)3, triangles->size() );
+    // check that the returned triangle all contain the Walker
+    for (set<BoundaryTriangleSet*>::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); TriangleRunner++)
+      CPPUNIT_ASSERT_EQUAL( true, (*TriangleRunner)->ContainsBoundaryPoint(Walker) );
+  }
+}
+
+/********************************************** Main routine **************************************/
+
+int main(int argc, char **argv)
+{
+  // Get the top level suite from the registry
+  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+
+  // Adds the test to the list of test to run
+  CppUnit::TextUi::TestRunner runner;
+  runner.addTest( suite );
+
+  // Change the default outputter to a compiler error format outputter
+  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
+                                                       std::cerr ) );
+  // Run the tests.
+  bool wasSucessful = runner.run();
+
+  // Return error code 1 if the one of test failed.
+  return wasSucessful ? 0 : 1;
+};
Index: src/unittests/tesselationunittest.hpp
===================================================================
--- src/unittests/tesselationunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/tesselationunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,42 @@
+/*
+ * tesselationunittest.hpp
+ *
+ *  Created on: Aug 26, 2009
+ *      Author: heber
+ */
+
+#ifndef TESSELATIONUNITTEST_HPP_
+#define TESSELATIONUNITTEST_HPP_
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "tesselation.hpp"
+
+/********************************************** Test classes **************************************/
+
+class TesselationTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( TesselationTest) ;
+    CPPUNIT_TEST ( IsInnerPointTest );
+    CPPUNIT_TEST ( GetAllTrianglesTest );
+    CPPUNIT_TEST ( ContainmentTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void IsInnerPointTest();
+      void GetAllTrianglesTest();
+      void ContainmentTest();
+
+
+private:
+      class Tesselation *TesselStruct;
+      LinkedNodes Corners;
+      class LinkedCell *LinkedList;
+};
+
+
+
+#endif /* TESSELATIONUNITTEST_HPP_ */
Index: src/unittests/vectorunittest.cpp
===================================================================
--- src/unittests/vectorunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/vectorunittest.cpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,312 @@
+/*
+ * unittest.cpp
+ *
+ *  Created on: Aug 17, 2009
+ *      Author: heber
+ */
+
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "vectorunittest.hpp"
+#include "vector.hpp"
+#include "defs.hpp"
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( VectorTest );
+
+
+void VectorTest::setUp()
+{
+  zero.Init(0.,0.,0.);
+  unit.Init(1.,0.,0.);
+  otherunit.Init(0.,1.,0.);
+  notunit.Init(0.,1.,1.);
+  two.Init(2.,1.,0.);
+};
+
+
+void VectorTest::tearDown()
+{
+};
+
+/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
+ */
+void VectorTest::UnityTest()
+{
+  // unity and zero tests
+  CPPUNIT_ASSERT_EQUAL( true, zero.IsZero() );
+  CPPUNIT_ASSERT_EQUAL( false, zero.IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, unit.IsZero() );
+  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, notunit.IsOne() );
+  CPPUNIT_ASSERT_EQUAL( true, otherunit.IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, otherunit.IsZero() );
+};
+
+/** UnitTest for Vector::CopyVector(), Vector::AddVector, Vector::SubtractVector() and Vector::Scale()/
+ */
+void VectorTest::SimpleAlgebraTest()
+{
+  double factor;
+  // copy vector
+  fixture.Init(2.,3.,4.);
+  CPPUNIT_ASSERT_EQUAL( Vector(2.,3.,4.), fixture );
+  // summation and scaling
+  fixture.CopyVector(&zero);
+  fixture.AddVector(&unit);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  fixture.CopyVector(&zero);
+  fixture.SubtractVector(&unit);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
+  fixture.CopyVector(&zero);
+  fixture.AddVector(&zero);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsZero() );
+  fixture.CopyVector(&notunit);
+  fixture.SubtractVector(&otherunit);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  fixture.CopyVector(&unit);
+  fixture.AddVector(&otherunit);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
+  fixture.CopyVector(&notunit);
+  fixture.SubtractVector(&unit);
+  fixture.SubtractVector(&otherunit);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
+  fixture.CopyVector(&unit);
+  fixture.Scale(0.98);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
+  fixture.CopyVector(&unit);
+  fixture.Scale(1.);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+  fixture.CopyVector(&unit);
+  factor = 0.98;
+  fixture.Scale(factor);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
+  fixture.CopyVector(&unit);
+  factor = 1.;
+  fixture.Scale(factor);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
+};
+
+
+/** UnitTest for operator versions of Vector::CopyVector(), Vector::AddVector, Vector::SubtractVector() and Vector::Scale().
+ */
+void VectorTest::OperatorAlgebraTest()
+{
+  // summation and scaling
+  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
+  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
+  CPPUNIT_ASSERT_EQUAL( true, (zero-unit).IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, (zero-unit).IsZero() );
+  CPPUNIT_ASSERT_EQUAL( true, (zero+zero).IsZero() );
+  CPPUNIT_ASSERT_EQUAL( true, (notunit-otherunit).IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, (unit+otherunit).IsOne() );
+  CPPUNIT_ASSERT_EQUAL( false, (notunit-unit-otherunit).IsZero() );
+  CPPUNIT_ASSERT_EQUAL( false, (unit*0.98).IsOne() );
+  CPPUNIT_ASSERT_EQUAL( true, (unit*1.).IsOne() );
+
+  CPPUNIT_ASSERT_EQUAL( unit, (zero+unit) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0.,0.,1.), (notunit-otherunit) );
+  CPPUNIT_ASSERT_EQUAL( Vector(-1, 0., 1.), (notunit-unit-otherunit) );
+};
+
+/** UnitTest for scalar products.
+ */
+void VectorTest::EuclidianScalarProductTest()
+{
+  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&zero) );
+  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&unit) );
+  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&otherunit) );
+  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&notunit) );
+  CPPUNIT_ASSERT_EQUAL( 1., unit.ScalarProduct(&unit) );
+  CPPUNIT_ASSERT_EQUAL( 0., otherunit.ScalarProduct(&unit) );
+  CPPUNIT_ASSERT_EQUAL( 0., otherunit.ScalarProduct(&unit) );
+  CPPUNIT_ASSERT_EQUAL( 1., otherunit.ScalarProduct(&notunit) );
+  CPPUNIT_ASSERT_EQUAL( 2., two.ScalarProduct(&unit) );
+  CPPUNIT_ASSERT_EQUAL( 1., two.ScalarProduct(&otherunit) );
+  CPPUNIT_ASSERT_EQUAL( 1., two.ScalarProduct(&notunit) );
+}
+
+/** UnitTest for norms.
+ */
+void VectorTest::EuclidianNormTest()
+{
+  CPPUNIT_ASSERT_EQUAL( 0., zero.Norm() );
+  CPPUNIT_ASSERT_EQUAL( 0., zero.NormSquared() );
+  CPPUNIT_ASSERT_EQUAL( 1., unit.Norm() );
+  CPPUNIT_ASSERT_EQUAL( 1., unit.NormSquared() );
+  CPPUNIT_ASSERT_EQUAL( 1., otherunit.Norm() );
+  CPPUNIT_ASSERT_EQUAL( 1., otherunit.NormSquared() );
+  CPPUNIT_ASSERT_EQUAL( 2., notunit.NormSquared() );
+  CPPUNIT_ASSERT_EQUAL( sqrt(2.), notunit.Norm() );
+}
+
+/** UnitTest for distances.
+ */
+void VectorTest::EuclidianDistancesTest()
+{
+  CPPUNIT_ASSERT_EQUAL( 1., zero.Distance(&unit) );
+  CPPUNIT_ASSERT_EQUAL( sqrt(2.), otherunit.Distance(&unit) );
+  CPPUNIT_ASSERT_EQUAL( sqrt(2.), zero.Distance(&notunit) );
+  CPPUNIT_ASSERT_EQUAL( 1., otherunit.Distance(&notunit) );
+  CPPUNIT_ASSERT_EQUAL( sqrt(5.), two.Distance(&notunit) );
+}
+
+/** UnitTest for angles.
+ */
+void VectorTest::EuclidianAnglesTest()
+{
+  CPPUNIT_ASSERT_EQUAL( M_PI, zero.Angle(&unit) );
+  CPPUNIT_ASSERT_EQUAL( 0., unit.Angle(&unit) );
+  CPPUNIT_ASSERT_EQUAL( true, fabs(M_PI/2. - otherunit.Angle(&unit)) < MYEPSILON );
+  CPPUNIT_ASSERT_EQUAL( true, fabs(M_PI/2. - unit.Angle(&notunit)) < MYEPSILON );
+  CPPUNIT_ASSERT_EQUAL( true, fabs(M_PI/4. - otherunit.Angle(&notunit)) < MYEPSILON );
+};
+
+/** UnitTest for projections.
+ */
+void VectorTest::ProjectionTest()
+{
+  CPPUNIT_ASSERT_EQUAL( zero, zero.Projection(&unit) );
+  CPPUNIT_ASSERT_EQUAL( zero, otherunit.Projection(&unit) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0.4,0.2,0.),  otherunit.Projection(&two) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0.,1.,0.),  two.Projection(&otherunit) );
+};
+
+/** UnitTest for line intersections.
+ */
+void VectorTest::LineIntersectionTest()
+{
+  // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &unit, &zero, &zero, &two) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
+
+  // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &otherunit, &two, &unit, &notunit) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
+
+  // four vectors equal to zero
+  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &zero, &zero, &zero, &zero, NULL) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
+
+  // four vectors equal to unit
+  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &unit, &unit, &unit, NULL) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
+
+  // two equal lines
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &two, NULL) );
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
+
+  // line from (1,0,0) to (2,1,0) cuts line from (1,0,0) to (0,1,0) at ???
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &otherunit, NULL) );
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
+
+  // line from (1,0,0) to (0,0,0) cuts line from (0,0,0) to (2,1,0) at ???
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &zero, &zero, &two, NULL) );
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
+
+  // line from (1,0,0) to (2,1,0) cuts line from (0,0,0) to (0,1,0) at ???
+  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &zero, &otherunit, NULL) );
+  CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), fixture );
+};
+
+/** UnitTest for vector rotations.
+ */
+void VectorTest::VectorRotationTest()
+{
+  fixture.Init(-1.,0.,0.);
+
+  // zero vector does not change
+  fixture.CopyVector(&zero);
+  fixture.RotateVector(&unit, 1.);
+  CPPUNIT_ASSERT_EQUAL( zero, fixture );
+
+  fixture.RotateVector(&two, 1.);
+  CPPUNIT_ASSERT_EQUAL( zero,  fixture);
+
+  // vector on axis does not change
+  fixture.CopyVector(&unit);
+  fixture.RotateVector(&unit, 1.);
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
+
+  fixture.RotateVector(&unit, 1.);
+  CPPUNIT_ASSERT_EQUAL( unit, fixture );
+
+  // rotations
+  fixture.CopyVector(&otherunit);
+  fixture.RotateVector(&unit, M_PI);
+  CPPUNIT_ASSERT_EQUAL( Vector(0.,-1.,0.), fixture );
+
+  fixture.CopyVector(&otherunit);
+  fixture.RotateVector(&unit, 2. * M_PI);
+  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
+
+  fixture.CopyVector(&otherunit);
+  fixture.RotateVector(&unit, 0);
+  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
+
+  fixture.Init(0.,0.,1.);
+  fixture.RotateVector(&notunit, M_PI);
+  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
+}
+
+/**
+ * UnitTest for Vector::IsInParallelepiped().
+ */
+void VectorTest::IsInParallelepipedTest()
+{
+  double parallelepiped[NDIM*NDIM];
+  parallelepiped[0] = 1;
+  parallelepiped[1] = 0;
+  parallelepiped[2] = 0;
+  parallelepiped[3] = 0;
+  parallelepiped[4] = 1;
+  parallelepiped[5] = 0;
+  parallelepiped[6] = 0;
+  parallelepiped[7] = 0;
+  parallelepiped[8] = 1;
+
+  fixture.CopyVector(zero);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(2.5,2.5,2.5);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(1.,1.,1.);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(3.5,3.5,3.5);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(2.,2.,2.);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(2.,3.,2.);
+  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+  fixture.Init(-2.,2.,-1.);
+  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
+}
+
+
+/********************************************** Main routine **************************************/
+
+int main(int argc, char **argv)
+{
+  // Get the top level suite from the registry
+  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+
+  // Adds the test to the list of test to run
+  CppUnit::TextUi::TestRunner runner;
+  runner.addTest( suite );
+
+  // Change the default outputter to a compiler error format outputter
+  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
+                                                       std::cerr ) );
+  // Run the tests.
+  bool wasSucessful = runner.run();
+
+  // Return error code 1 if the one of test failed.
+  return wasSucessful ? 0 : 1;
+};
Index: src/unittests/vectorunittest.hpp
===================================================================
--- src/unittests/vectorunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/vectorunittest.hpp	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
@@ -0,0 +1,61 @@
+/*
+ * cppunuit.hpp
+ *
+ *  Created on: Aug 17, 2009
+ *      Author: heber
+ */
+
+#ifndef VECTORUNITTEST_HPP_
+#define VECTORUNITTEST_HPP_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "vector.hpp"
+
+/********************************************** Test classes **************************************/
+
+class VectorTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( VectorTest) ;
+    CPPUNIT_TEST ( UnityTest );
+    CPPUNIT_TEST ( SimpleAlgebraTest );
+    CPPUNIT_TEST ( OperatorAlgebraTest );
+    CPPUNIT_TEST ( EuclidianScalarProductTest );
+    CPPUNIT_TEST ( EuclidianNormTest );
+    CPPUNIT_TEST ( EuclidianDistancesTest );
+    CPPUNIT_TEST ( EuclidianAnglesTest );
+    CPPUNIT_TEST ( ProjectionTest );
+    CPPUNIT_TEST ( LineIntersectionTest );
+    CPPUNIT_TEST ( VectorRotationTest );
+    CPPUNIT_TEST ( IsInParallelepipedTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+    void setUp();
+    void tearDown();
+
+    void UnityTest();
+    void OperatorAlgebraTest();
+    void SimpleAlgebraTest();
+    void EuclidianScalarProductTest();
+    void EuclidianNormTest();
+    void EuclidianDistancesTest();
+    void EuclidianAnglesTest();
+    void ProjectionTest();
+    void LineIntersectionTest();
+    void VectorRotationTest();
+    void IsInParallelepipedTest();
+
+private:
+    // vector to execute tests on, may be modified during run
+    Vector fixture;
+    // never modify these during run, other tests might rely on them
+    Vector zero;
+    Vector unit;
+    Vector otherunit;
+    Vector notunit;
+    Vector two;
+};
+
+
+#endif /* VECTORUNITTEST_HPP_ */
Index: src/vectorunittest.cpp
===================================================================
--- src/vectorunittest.cpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,312 +1,0 @@
-/*
- * unittest.cpp
- *
- *  Created on: Aug 17, 2009
- *      Author: heber
- */
-
-
-using namespace std;
-
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include "vectorunittest.hpp"
-#include "vector.hpp"
-#include "defs.hpp"
-
-/********************************************** Test classes **************************************/
-
-// Registers the fixture into the 'registry'
-CPPUNIT_TEST_SUITE_REGISTRATION( VectorTest );
-
-
-void VectorTest::setUp()
-{
-  zero.Init(0.,0.,0.);
-  unit.Init(1.,0.,0.);
-  otherunit.Init(0.,1.,0.);
-  notunit.Init(0.,1.,1.);
-  two.Init(2.,1.,0.);
-};
-
-
-void VectorTest::tearDown()
-{
-};
-
-/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
- */
-void VectorTest::UnityTest()
-{
-  // unity and zero tests
-  CPPUNIT_ASSERT_EQUAL( true, zero.IsZero() );
-  CPPUNIT_ASSERT_EQUAL( false, zero.IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, unit.IsZero() );
-  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, notunit.IsOne() );
-  CPPUNIT_ASSERT_EQUAL( true, otherunit.IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, otherunit.IsZero() );
-};
-
-/** UnitTest for Vector::CopyVector(), Vector::AddVector, Vector::SubtractVector() and Vector::Scale()/
- */
-void VectorTest::SimpleAlgebraTest()
-{
-  double factor;
-  // copy vector
-  fixture.Init(2.,3.,4.);
-  CPPUNIT_ASSERT_EQUAL( Vector(2.,3.,4.), fixture );
-  // summation and scaling
-  fixture.CopyVector(&zero);
-  fixture.AddVector(&unit);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
-  fixture.CopyVector(&zero);
-  fixture.SubtractVector(&unit);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
-  fixture.CopyVector(&zero);
-  fixture.AddVector(&zero);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsZero() );
-  fixture.CopyVector(&notunit);
-  fixture.SubtractVector(&otherunit);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
-  fixture.CopyVector(&unit);
-  fixture.AddVector(&otherunit);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
-  fixture.CopyVector(&notunit);
-  fixture.SubtractVector(&unit);
-  fixture.SubtractVector(&otherunit);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
-  fixture.CopyVector(&unit);
-  fixture.Scale(0.98);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
-  fixture.CopyVector(&unit);
-  fixture.Scale(1.);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
-  fixture.CopyVector(&unit);
-  factor = 0.98;
-  fixture.Scale(factor);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
-  fixture.CopyVector(&unit);
-  factor = 1.;
-  fixture.Scale(factor);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
-};
-
-
-/** UnitTest for operator versions of Vector::CopyVector(), Vector::AddVector, Vector::SubtractVector() and Vector::Scale().
- */
-void VectorTest::OperatorAlgebraTest()
-{
-  // summation and scaling
-  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
-  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
-  CPPUNIT_ASSERT_EQUAL( true, (zero-unit).IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, (zero-unit).IsZero() );
-  CPPUNIT_ASSERT_EQUAL( true, (zero+zero).IsZero() );
-  CPPUNIT_ASSERT_EQUAL( true, (notunit-otherunit).IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, (unit+otherunit).IsOne() );
-  CPPUNIT_ASSERT_EQUAL( false, (notunit-unit-otherunit).IsZero() );
-  CPPUNIT_ASSERT_EQUAL( false, (unit*0.98).IsOne() );
-  CPPUNIT_ASSERT_EQUAL( true, (unit*1.).IsOne() );
-
-  CPPUNIT_ASSERT_EQUAL( unit, (zero+unit) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0.,0.,1.), (notunit-otherunit) );
-  CPPUNIT_ASSERT_EQUAL( Vector(-1, 0., 1.), (notunit-unit-otherunit) );
-};
-
-/** UnitTest for scalar products.
- */
-void VectorTest::EuclidianScalarProductTest()
-{
-  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&zero) );
-  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&unit) );
-  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&otherunit) );
-  CPPUNIT_ASSERT_EQUAL( 0., zero.ScalarProduct(&notunit) );
-  CPPUNIT_ASSERT_EQUAL( 1., unit.ScalarProduct(&unit) );
-  CPPUNIT_ASSERT_EQUAL( 0., otherunit.ScalarProduct(&unit) );
-  CPPUNIT_ASSERT_EQUAL( 0., otherunit.ScalarProduct(&unit) );
-  CPPUNIT_ASSERT_EQUAL( 1., otherunit.ScalarProduct(&notunit) );
-  CPPUNIT_ASSERT_EQUAL( 2., two.ScalarProduct(&unit) );
-  CPPUNIT_ASSERT_EQUAL( 1., two.ScalarProduct(&otherunit) );
-  CPPUNIT_ASSERT_EQUAL( 1., two.ScalarProduct(&notunit) );
-}
-
-/** UnitTest for norms.
- */
-void VectorTest::EuclidianNormTest()
-{
-  CPPUNIT_ASSERT_EQUAL( 0., zero.Norm() );
-  CPPUNIT_ASSERT_EQUAL( 0., zero.NormSquared() );
-  CPPUNIT_ASSERT_EQUAL( 1., unit.Norm() );
-  CPPUNIT_ASSERT_EQUAL( 1., unit.NormSquared() );
-  CPPUNIT_ASSERT_EQUAL( 1., otherunit.Norm() );
-  CPPUNIT_ASSERT_EQUAL( 1., otherunit.NormSquared() );
-  CPPUNIT_ASSERT_EQUAL( 2., notunit.NormSquared() );
-  CPPUNIT_ASSERT_EQUAL( sqrt(2.), notunit.Norm() );
-}
-
-/** UnitTest for distances.
- */
-void VectorTest::EuclidianDistancesTest()
-{
-  CPPUNIT_ASSERT_EQUAL( 1., zero.Distance(&unit) );
-  CPPUNIT_ASSERT_EQUAL( sqrt(2.), otherunit.Distance(&unit) );
-  CPPUNIT_ASSERT_EQUAL( sqrt(2.), zero.Distance(&notunit) );
-  CPPUNIT_ASSERT_EQUAL( 1., otherunit.Distance(&notunit) );
-  CPPUNIT_ASSERT_EQUAL( sqrt(5.), two.Distance(&notunit) );
-}
-
-/** UnitTest for angles.
- */
-void VectorTest::EuclidianAnglesTest()
-{
-  CPPUNIT_ASSERT_EQUAL( M_PI, zero.Angle(&unit) );
-  CPPUNIT_ASSERT_EQUAL( 0., unit.Angle(&unit) );
-  CPPUNIT_ASSERT_EQUAL( true, fabs(M_PI/2. - otherunit.Angle(&unit)) < MYEPSILON );
-  CPPUNIT_ASSERT_EQUAL( true, fabs(M_PI/2. - unit.Angle(&notunit)) < MYEPSILON );
-  CPPUNIT_ASSERT_EQUAL( true, fabs(M_PI/4. - otherunit.Angle(&notunit)) < MYEPSILON );
-};
-
-/** UnitTest for projections.
- */
-void VectorTest::ProjectionTest()
-{
-  CPPUNIT_ASSERT_EQUAL( zero, zero.Projection(&unit) );
-  CPPUNIT_ASSERT_EQUAL( zero, otherunit.Projection(&unit) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0.4,0.2,0.),  otherunit.Projection(&two) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0.,1.,0.),  two.Projection(&otherunit) );
-};
-
-/** UnitTest for line intersections.
- */
-void VectorTest::LineIntersectionTest()
-{
-  // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &unit, &zero, &zero, &two) );
-  CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
-  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &otherunit, &two, &unit, &notunit) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
-
-  // four vectors equal to zero
-  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &zero, &zero, &zero, &zero, NULL) );
-  CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // four vectors equal to unit
-  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &unit, &unit, &unit, NULL) );
-  CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // two equal lines
-  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &two, NULL) );
-  CPPUNIT_ASSERT_EQUAL( unit, fixture );
-
-  // line from (1,0,0) to (2,1,0) cuts line from (1,0,0) to (0,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &otherunit, NULL) );
-  CPPUNIT_ASSERT_EQUAL( unit, fixture );
-
-  // line from (1,0,0) to (0,0,0) cuts line from (0,0,0) to (2,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &zero, &zero, &two, NULL) );
-  CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // line from (1,0,0) to (2,1,0) cuts line from (0,0,0) to (0,1,0) at ???
-  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &zero, &otherunit, NULL) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), fixture );
-};
-
-/** UnitTest for vector rotations.
- */
-void VectorTest::VectorRotationTest()
-{
-  fixture.Init(-1.,0.,0.);
-
-  // zero vector does not change
-  fixture.CopyVector(&zero);
-  fixture.RotateVector(&unit, 1.);
-  CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  fixture.RotateVector(&two, 1.);
-  CPPUNIT_ASSERT_EQUAL( zero,  fixture);
-
-  // vector on axis does not change
-  fixture.CopyVector(&unit);
-  fixture.RotateVector(&unit, 1.);
-  CPPUNIT_ASSERT_EQUAL( unit, fixture );
-
-  fixture.RotateVector(&unit, 1.);
-  CPPUNIT_ASSERT_EQUAL( unit, fixture );
-
-  // rotations
-  fixture.CopyVector(&otherunit);
-  fixture.RotateVector(&unit, M_PI);
-  CPPUNIT_ASSERT_EQUAL( Vector(0.,-1.,0.), fixture );
-
-  fixture.CopyVector(&otherunit);
-  fixture.RotateVector(&unit, 2. * M_PI);
-  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
-
-  fixture.CopyVector(&otherunit);
-  fixture.RotateVector(&unit, 0);
-  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
-
-  fixture.Init(0.,0.,1.);
-  fixture.RotateVector(&notunit, M_PI);
-  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
-}
-
-/**
- * UnitTest for Vector::IsInParallelepiped().
- */
-void VectorTest::IsInParallelepipedTest()
-{
-  double parallelepiped[NDIM*NDIM];
-  parallelepiped[0] = 1;
-  parallelepiped[1] = 0;
-  parallelepiped[2] = 0;
-  parallelepiped[3] = 0;
-  parallelepiped[4] = 1;
-  parallelepiped[5] = 0;
-  parallelepiped[6] = 0;
-  parallelepiped[7] = 0;
-  parallelepiped[8] = 1;
-
-  fixture.CopyVector(zero);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-  fixture.Init(2.5,2.5,2.5);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-  fixture.Init(1.,1.,1.);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-  fixture.Init(3.5,3.5,3.5);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-  fixture.Init(2.,2.,2.);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-  fixture.Init(2.,3.,2.);
-  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-  fixture.Init(-2.,2.,-1.);
-  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
-}
-
-
-/********************************************** Main routine **************************************/
-
-int main(int argc, char **argv)
-{
-  // Get the top level suite from the registry
-  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-
-  // Adds the test to the list of test to run
-  CppUnit::TextUi::TestRunner runner;
-  runner.addTest( suite );
-
-  // Change the default outputter to a compiler error format outputter
-  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
-                                                       std::cerr ) );
-  // Run the tests.
-  bool wasSucessful = runner.run();
-
-  // Return error code 1 if the one of test failed.
-  return wasSucessful ? 0 : 1;
-};
Index: src/vectorunittest.hpp
===================================================================
--- src/vectorunittest.hpp	(revision 21b9c3591722efc708e1482ec02108da1918128b)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * cppunuit.hpp
- *
- *  Created on: Aug 17, 2009
- *      Author: heber
- */
-
-#ifndef VECTORUNITTEST_HPP_
-#define VECTORUNITTEST_HPP_
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "vector.hpp"
-
-/********************************************** Test classes **************************************/
-
-class VectorTest : public CppUnit::TestFixture
-{
-    CPPUNIT_TEST_SUITE( VectorTest) ;
-    CPPUNIT_TEST ( UnityTest );
-    CPPUNIT_TEST ( SimpleAlgebraTest );
-    CPPUNIT_TEST ( OperatorAlgebraTest );
-    CPPUNIT_TEST ( EuclidianScalarProductTest );
-    CPPUNIT_TEST ( EuclidianNormTest );
-    CPPUNIT_TEST ( EuclidianDistancesTest );
-    CPPUNIT_TEST ( EuclidianAnglesTest );
-    CPPUNIT_TEST ( ProjectionTest );
-    CPPUNIT_TEST ( LineIntersectionTest );
-    CPPUNIT_TEST ( VectorRotationTest );
-    CPPUNIT_TEST ( IsInParallelepipedTest );
-    CPPUNIT_TEST_SUITE_END();
-
-public:
-    void setUp();
-    void tearDown();
-
-    void UnityTest();
-    void OperatorAlgebraTest();
-    void SimpleAlgebraTest();
-    void EuclidianScalarProductTest();
-    void EuclidianNormTest();
-    void EuclidianDistancesTest();
-    void EuclidianAnglesTest();
-    void ProjectionTest();
-    void LineIntersectionTest();
-    void VectorRotationTest();
-    void IsInParallelepipedTest();
-
-private:
-    // vector to execute tests on, may be modified during run
-    Vector fixture;
-    // never modify these during run, other tests might rely on them
-    Vector zero;
-    Vector unit;
-    Vector otherunit;
-    Vector notunit;
-    Vector two;
-};
-
-
-#endif /* VECTORUNITTEST_HPP_ */
