Index: src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp
===================================================================
--- src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp	(revision 3501d220b42c41a509f1636a333c1770e161d572)
+++ src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp	(revision 06f41f3c956f559b0c681f2d22c237c2160d0f8d)
@@ -39,6 +39,9 @@
 #include <cppunit/ui/text/TestRunner.h>
 
+#include <boost/lambda/lambda.hpp>
 #include <iostream>
-#include <string>
+#include <iterator>
+#include <iostream>
+#include <vector>
 
 #include "CodePatterns/Assert.hpp"
@@ -76,6 +79,6 @@
 static std::string wrongadjacencyfile1 ="\
 1 2\n\
-2 1 3\n\
-4 3 5\n\
+2 1\n\
+4 5\n\
 5 4 6\n\
 6 5 7\n\
@@ -98,4 +101,17 @@
 11 10";
 
+static std::string wrongadjacencyfile3 ="\
+1 2\n\
+2 1 3\n\
+3 2 4\n\
+4 3 5\n\
+5 4 7\n\
+6\n\
+7 5 8\n\
+8 7 9\n\
+9 8 10\n\
+10 9 11\n\
+11 10";
+
 // set up and tear down
 void CheckAgainstAdjacencyFileTest::setUp()
@@ -110,14 +126,16 @@
   CPPUNIT_ASSERT(TestMolecule != NULL);
   for(int i=0;i<ATOM_COUNT;++i){
-    atoms[i]= World::getInstance().createAtom();
-    CPPUNIT_ASSERT(atoms[i] != NULL);
-    atoms[i]->setType(hydrogen);
-    TestMolecule->AddAtom(atoms[i]);
-    atomIds[i]= atoms[i]->getId();
-  }
+    atom *_atom = World::getInstance().createAtom();
+    CPPUNIT_ASSERT(_atom != NULL);
+    _atom->setType(hydrogen);
+    TestMolecule->AddAtom(_atom);
+    atoms.push_back(_atom);
+    atomIds.push_back(_atom->getId());
+  }
+  CPPUNIT_ASSERT_EQUAL( (size_t)ATOM_COUNT, atoms.size());
+  CPPUNIT_ASSERT_EQUAL( (size_t)ATOM_COUNT, atomIds.size());
   // create linear chain
-  for(int i=0;i<ATOM_COUNT-1;++i){
+  for(int i=0;i<ATOM_COUNT-1;++i)
     atoms[i]->addBond(WorldTime::getTime(), atoms[i+1]);
-  }
 
   // create map as it should be
@@ -143,23 +161,49 @@
 }
 
-/** Unit tests for CheckAgainstAdjacencyFile::CreateInternalMap().
- *
- */
-void CheckAgainstAdjacencyFileTest::CreateInternalMapTest()
+/** Unit tests for CheckAgainstAdjacencyFile::CreateExternalMap().
+ *
+ */
+void CheckAgainstAdjacencyFileTest::CreateExternalMapTest()
 {
   std::stringstream input;
   CheckAgainstAdjacencyFile fileChecker(input);
-  World::getInstance().selectAllAtoms(AllAtoms());
-  const World &world = World::getInstance();
-  fileChecker.CreateInternalMap(world.beginAtomSelection(), world.endAtomSelection());
+  fileChecker.CreateExternalMap(atomIds);
 
   // check size (it's 8*2 + 2*1 = 18 keys)
+  CPPUNIT_ASSERT_EQUAL( (size_t)18, fileChecker.ExternalAtomBondMap.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, fileChecker.InternalAtomBondMap.size() );
+
+  // check equality
+  CPPUNIT_ASSERT( comparisonMap.size() == fileChecker.ExternalAtomBondMap.size() );
+//  std::cout << "comparisonMap: " << comparisonMap << std::endl;
+//  std::cout << "fileChecker.InternalAtomBondMap: " << fileChecker.InternalAtomBondMap << std::endl;
+  CPPUNIT_ASSERT( comparisonMap == fileChecker.ExternalAtomBondMap );
+
+  // check non-equality: more
+  comparisonMap.insert( std::make_pair( (atomId_t)10, (atomId_t)8) );
+  CPPUNIT_ASSERT( comparisonMap != fileChecker.ExternalAtomBondMap );
+  comparisonMap.erase((atomId_t)10);
+
+  // check non-equality: less
+  comparisonMap.erase((atomId_t)9);
+  CPPUNIT_ASSERT( comparisonMap != fileChecker.ExternalAtomBondMap );
+}
+
+/** Unit tests for CheckAgainstAdjacencyFile::ParseInInternalMap().
+ *
+ */
+void CheckAgainstAdjacencyFileTest::ParseInInternalMapTest()
+{
+  std::stringstream input(adjacencyfile);
+  CheckAgainstAdjacencyFile fileChecker(input);
+  std::vector<atomId_t> noids;
+  fileChecker.CreateExternalMap(noids);
+
+  // check size (it's 8*2 + 2*1 = 18 keys)
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, fileChecker.ExternalAtomBondMap.size() );
   CPPUNIT_ASSERT_EQUAL( (size_t)18, fileChecker.InternalAtomBondMap.size() );
-  CPPUNIT_ASSERT_EQUAL( (size_t)0, fileChecker.ExternalAtomBondMap.size() );
 
   // check equality
   CPPUNIT_ASSERT( comparisonMap.size() == fileChecker.InternalAtomBondMap.size() );
-//  std::cout << "comparisonMap: " << comparisonMap << std::endl;
-//  std::cout << "fileChecker.InternalAtomBondMap: " << fileChecker.InternalAtomBondMap << std::endl;
   CPPUNIT_ASSERT( comparisonMap == fileChecker.InternalAtomBondMap );
 
@@ -174,32 +218,4 @@
 }
 
-/** Unit tests for CheckAgainstAdjacencyFile::ParseInExternalMap().
- *
- */
-void CheckAgainstAdjacencyFileTest::ParseInExternalMapTest()
-{
-  std::stringstream input(adjacencyfile);
-  World::getInstance().selectAllAtoms(NoAtoms());
-  CheckAgainstAdjacencyFile fileChecker(input);
-  fileChecker.CreateInternalMap(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection());
-
-  // check size (it's 8*2 + 2*1 = 18 keys)
-  CPPUNIT_ASSERT_EQUAL( (size_t)0, fileChecker.InternalAtomBondMap.size() );
-  CPPUNIT_ASSERT_EQUAL( (size_t)18, fileChecker.ExternalAtomBondMap.size() );
-
-  // check equality
-  CPPUNIT_ASSERT( comparisonMap.size() == fileChecker.ExternalAtomBondMap.size() );
-  CPPUNIT_ASSERT( comparisonMap == fileChecker.ExternalAtomBondMap );
-
-  // check non-equality: more
-  comparisonMap.insert( std::make_pair( (atomId_t)10, (atomId_t)8) );
-  CPPUNIT_ASSERT( comparisonMap != fileChecker.ExternalAtomBondMap );
-  comparisonMap.erase((atomId_t)10);
-
-  // check non-equality: less
-  comparisonMap.erase((atomId_t)9);
-  CPPUNIT_ASSERT( comparisonMap != fileChecker.ExternalAtomBondMap );
-}
-
 /** Unit tests for CheckAgainstAdjacencyFile::CompareInternalExternalMap().
  *
@@ -210,16 +226,15 @@
   CheckAgainstAdjacencyFile fileChecker(input);
 
-  // assert non-equality before parsing
-  CPPUNIT_ASSERT( fileChecker.InternalAtomBondMap.size() != fileChecker.ExternalAtomBondMap.size() );
-  CPPUNIT_ASSERT( fileChecker.InternalAtomBondMap != fileChecker.ExternalAtomBondMap );
-  CPPUNIT_ASSERT( !fileChecker.CompareInternalExternalMap() );
-
-  // parse
-  World::getInstance().selectAllAtoms(AllAtoms());
-  fileChecker.CreateInternalMap(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection());
+  // assert equality before parsing (empty sets should always return true)
+  CPPUNIT_ASSERT( fileChecker.ExternalAtomBondMap.size() != fileChecker.InternalAtomBondMap.size() );
+  CPPUNIT_ASSERT( fileChecker.ExternalAtomBondMap != fileChecker.InternalAtomBondMap );
+  CPPUNIT_ASSERT( fileChecker.CompareInternalExternalMap() );
+
+  // parse in external map
+  fileChecker.CreateExternalMap(atomIds);
 
   // assert equality after parsing
-  CPPUNIT_ASSERT_EQUAL( fileChecker.InternalAtomBondMap.size(), fileChecker.ExternalAtomBondMap.size() );
-  CPPUNIT_ASSERT_EQUAL( fileChecker.InternalAtomBondMap, fileChecker.ExternalAtomBondMap );
+  CPPUNIT_ASSERT_EQUAL( fileChecker.ExternalAtomBondMap.size(), fileChecker.InternalAtomBondMap.size() );
+  CPPUNIT_ASSERT_EQUAL( fileChecker.ExternalAtomBondMap, fileChecker.InternalAtomBondMap );
   CPPUNIT_ASSERT( fileChecker.CompareInternalExternalMap() );
 }
@@ -230,27 +245,37 @@
 void CheckAgainstAdjacencyFileTest::operatorTest()
 {
-  World::getInstance().selectAllAtoms(AllAtoms());
   {
     // parse right
     std::stringstream input(adjacencyfile);
     CheckAgainstAdjacencyFile fileChecker(input);
-    CPPUNIT_ASSERT( fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()) );
-  }
-  {
-    // parse wrong1
+    CPPUNIT_ASSERT( fileChecker(atomIds) );
+  }
+  {
+    // parse wrong1 (more atoms in the world than in file, hence wrong)
     std::stringstream input(wrongadjacencyfile1);
     CheckAgainstAdjacencyFile fileChecker(input);
-    CPPUNIT_ASSERT( !fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()) );
-  }
-  {
-    // parse wrong2 (there is no atom 10)
+    CPPUNIT_ASSERT( !fileChecker(atomIds) );
+  }
+  {
+    // remove third atom (index starts at 0) and test for equality then
+    std::vector<atomId_t> validids;
+    std::remove_copy_if(atomIds.begin(), atomIds.end(), std::back_inserter(validids), boost::lambda::_1 == (atomId_t)2);
+    CPPUNIT_ASSERT_EQUAL( (size_t)ATOM_COUNT-1, validids.size() );
+    // parse wrong1 (more atoms in the world than in file, hence wrong)
+    std::stringstream input(wrongadjacencyfile1);
+    CheckAgainstAdjacencyFile fileChecker(input);
+    CPPUNIT_ASSERT( fileChecker(validids) );
+  }
+  {
+    // parse wrong2 (there is no atom 10, but present in file. hence true)
     std::stringstream input(wrongadjacencyfile2);
-#ifndef NDEBUG
-    std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;
-    CPPUNIT_ASSERT_THROW( CheckAgainstAdjacencyFile fileChecker(input), Assert::AssertionFailure );
-#else
-    CheckAgainstAdjacencyFile fileChecker(input);
-    CPPUNIT_ASSERT( !fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()) );
-#endif
-  }
-}
+    CheckAgainstAdjacencyFile fileChecker(input);
+    CPPUNIT_ASSERT( !fileChecker(atomIds) );
+  }
+  {
+    // parse wrong3 (6 is not connected)
+    std::stringstream input(wrongadjacencyfile3);
+    CheckAgainstAdjacencyFile fileChecker(input);
+    CPPUNIT_ASSERT( !fileChecker(atomIds) );
+  }
+}
Index: src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp
===================================================================
--- src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp	(revision 3501d220b42c41a509f1636a333c1770e161d572)
+++ src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp	(revision 06f41f3c956f559b0c681f2d22c237c2160d0f8d)
@@ -30,6 +30,6 @@
 {
   CPPUNIT_TEST_SUITE( CheckAgainstAdjacencyFileTest );
-  CPPUNIT_TEST ( CreateInternalMapTest );
-  CPPUNIT_TEST ( ParseInExternalMapTest );
+  CPPUNIT_TEST ( CreateExternalMapTest );
+  CPPUNIT_TEST ( ParseInInternalMapTest );
   CPPUNIT_TEST ( CompareInternalExternalMapTest );
   CPPUNIT_TEST ( operatorTest );
@@ -40,6 +40,6 @@
   void tearDown();
 
-  void CreateInternalMapTest();
-  void ParseInExternalMapTest();
+  void CreateExternalMapTest();
+  void ParseInInternalMapTest();
   void CompareInternalExternalMapTest();
   void operatorTest();
@@ -47,6 +47,6 @@
 private:
   CheckAgainstAdjacencyFile::AtomBondMap comparisonMap;
-  atom *atoms [ATOM_COUNT];
-  atomId_t atomIds [ATOM_COUNT];
+  std::vector<atom *> atoms;
+  std::vector<atomId_t> atomIds;
   molecule * TestMolecule;
 };
