Index: src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
===================================================================
--- src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp	(revision b11d3bed152ea5cc6a6964715aa2cf2520fb7e28)
+++ src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp	(revision 8db5984e6a27b79db3e7303fda908ac9035d47f6)
@@ -60,55 +60,55 @@
 
   // construct molecule (tetraeder of hydrogens) base
+  TestSurfaceMolecule = new molecule(tafel);
+  Walker = new atom();
+  Walker->type = hydrogen;
+  Walker->node->Init(1., 0., 1. );
+  TestSurfaceMolecule->AddAtom(Walker);
+  Walker = new atom();
+  Walker->type = hydrogen;
+  Walker->node->Init(0., 1., 1. );
+  TestSurfaceMolecule->AddAtom(Walker);
+  Walker = new atom();
+  Walker->type = hydrogen;
+  Walker->node->Init(1., 1., 0. );
+  TestSurfaceMolecule->AddAtom(Walker);
+  Walker = new atom();
+  Walker->type = hydrogen;
+  Walker->node->Init(0., 0., 0. );
+  TestSurfaceMolecule->AddAtom(Walker);
+
+  // check that TestMolecule was correctly constructed
+  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
+
+  TestList = new MoleculeListClass;
+  TestSurfaceMolecule->ActiveFlag = true;
+  TestList->insert(TestSurfaceMolecule);
+
+  // init tesselation and linked cell
+  Surface = new Tesselation;
+  LC = new LinkedCell(TestSurfaceMolecule, 5.);
+  FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
+
+  // add outer atoms
   TestMolecule = new molecule(tafel);
   Walker = new atom();
-  Walker->type = hydrogen;
-  Walker->node->Init(1., 0., 1. );
-  TestMolecule->AddAtom(Walker);
-  Walker = new atom();
-  Walker->type = hydrogen;
-  Walker->node->Init(0., 1., 1. );
-  TestMolecule->AddAtom(Walker);
-  Walker = new atom();
-  Walker->type = hydrogen;
-  Walker->node->Init(1., 1., 0. );
-  TestMolecule->AddAtom(Walker);
-  Walker = new atom();
-  Walker->type = hydrogen;
-  Walker->node->Init(0., 0., 0. );
-  TestMolecule->AddAtom(Walker);
-
-  // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
-
-  TestList = new MoleculeListClass;
+  Walker->type = carbon;
+  Walker->node->Init(4., 0., 4. );
+  TestMolecule->AddAtom(Walker);
+  Walker = new atom();
+  Walker->type = carbon;
+  Walker->node->Init(0., 4., 4. );
+  TestMolecule->AddAtom(Walker);
+  Walker = new atom();
+  Walker->type = carbon;
+  Walker->node->Init(4., 4., 0. );
+  TestMolecule->AddAtom(Walker);
+  // add inner atoms
+  Walker = new atom();
+  Walker->type = carbon;
+  Walker->node->Init(0.5, 0.5, 0.5 );
+  TestMolecule->AddAtom(Walker);
   TestMolecule->ActiveFlag = true;
   TestList->insert(TestMolecule);
-
-  // init tesselation and linked cell
-  Surface = new Tesselation;
-  FindNonConvexBorder(TestMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
-  LC = new LinkedCell(TestMolecule, 5.);
-  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
-  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
-  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
-
-  // add outer atoms
-  Walker = new atom();
-  Walker->type = carbon;
-  Walker->node->Init(4., 0., 4. );
-  TestMolecule->AddAtom(Walker);
-  Walker = new atom();
-  Walker->type = carbon;
-  Walker->node->Init(0., 4., 4. );
-  TestMolecule->AddAtom(Walker);
-  Walker = new atom();
-  Walker->type = carbon;
-  Walker->node->Init(4., 4., 0. );
-  TestMolecule->AddAtom(Walker);
-  // add inner atoms
-  Walker = new atom();
-  Walker->type = carbon;
-  Walker->node->Init(0.5, 0.5, 0.5 );
-  TestMolecule->AddAtom(Walker);
 
   // init maps
@@ -136,8 +136,21 @@
 
 
+/** Checks whether setup() does the right thing.
+ */
+void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
+{
+  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
+  CPPUNIT_ASSERT_EQUAL( 4, TestMolecule->AtomCount );
+  CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
+};
+
 void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceTest()
 {
   // do the pair correlation
   surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
+//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
   CPPUNIT_ASSERT( surfacemap != NULL );
   CPPUNIT_ASSERT_EQUAL( (size_t)4, surfacemap->size() );
@@ -149,7 +162,8 @@
   surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
   // put pair correlation into bins and check with no range
+//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
   binmap = BinData( surfacemap, 0.5, 0., 0. );
   CPPUNIT_ASSERT_EQUAL( (size_t)1, binmap->size() );
-  //OutputCorrelation ( binmap );
+  OutputCorrelation ( (ofstream *)&cout, binmap );
   tester = binmap->begin();
   CPPUNIT_ASSERT_EQUAL( 0., tester->first );
@@ -162,8 +176,9 @@
   BinPairMap::iterator tester;
   surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
+//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
   // ... and check with [0., 2.] range
   binmap = BinData( surfacemap, 0.5, 0., 2. );
   CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() );
-  //OutputCorrelation ( binmap );
+//  OutputCorrelation ( (ofstream *)&cout, binmap );
   tester = binmap->begin();
   CPPUNIT_ASSERT_EQUAL( 0., tester->first );
@@ -179,4 +194,5 @@
   BinPairMap::iterator tester;
   surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
+//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
   // put pair correlation into bins and check with no range
   binmap = BinData( surfacemap, 0.5, 0., 0. );
@@ -184,9 +200,9 @@
   OutputCorrelation ( (ofstream *)&cout, binmap );
   // inside point is first and must have negative value
-  tester = binmap->lower_bound(2.95); // start depends on the min value and
+  tester = binmap->lower_bound(4.25-0.5); // start depends on the min value and
   CPPUNIT_ASSERT( tester != binmap->end() );
   CPPUNIT_ASSERT_EQUAL( 3, tester->second );
   // inner point
-  tester = binmap->lower_bound(-0.5);
+  tester = binmap->lower_bound(0.);
   CPPUNIT_ASSERT( tester != binmap->end() );
   CPPUNIT_ASSERT_EQUAL( 1, tester->second );
@@ -197,17 +213,17 @@
   BinPairMap::iterator tester;
   surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
+//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
   // ... and check with [0., 2.] range
   binmap = BinData( surfacemap, 0.5, -2., 4. );
   CPPUNIT_ASSERT_EQUAL( (size_t)13, binmap->size() );
-  OutputCorrelation ( (ofstream *)&cout, binmap );
+//  OutputCorrelation ( (ofstream *)&cout, binmap );
   // three outside points
-  tester = binmap->lower_bound(3.);
+  tester = binmap->lower_bound(4.25-0.5);
   CPPUNIT_ASSERT( tester != binmap->end() );
   CPPUNIT_ASSERT_EQUAL( 3, tester->second );
   // inner point
-  tester = binmap->lower_bound(-0.5);
+  tester = binmap->lower_bound(0.);
   CPPUNIT_ASSERT( tester != binmap->end() );
   CPPUNIT_ASSERT_EQUAL( 1, tester->second );
-
 };
 
Index: src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp
===================================================================
--- src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp	(revision b11d3bed152ea5cc6a6964715aa2cf2520fb7e28)
+++ src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp	(revision 8db5984e6a27b79db3e7303fda908ac9035d47f6)
@@ -23,4 +23,5 @@
 {
     CPPUNIT_TEST_SUITE( AnalysisCorrelationToSurfaceUnitTest ) ;
+    CPPUNIT_TEST ( SurfaceTest );
     CPPUNIT_TEST ( CorrelationToSurfaceTest );
     CPPUNIT_TEST ( CorrelationToSurfaceHydrogenBinNoRangeTest );
@@ -33,4 +34,5 @@
       void setUp();
       void tearDown();
+      void SurfaceTest();
       void CorrelationToSurfaceTest();
       void CorrelationToSurfaceHydrogenBinNoRangeTest();
@@ -43,4 +45,5 @@
       MoleculeListClass *TestList;
       molecule *TestMolecule;
+      molecule *TestSurfaceMolecule;
       element *hydrogen;
       element *carbon;
