Index: src/FunctionApproximation/unittests/ExtractorsUnitTest.cpp
===================================================================
--- src/FunctionApproximation/unittests/ExtractorsUnitTest.cpp	(revision ac868eea35190399f5c65a0cd26d49f950047285)
+++ src/FunctionApproximation/unittests/ExtractorsUnitTest.cpp	(revision ac868eea35190399f5c65a0cd26d49f950047285)
@@ -0,0 +1,168 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * ExtractorsUnitTest.cpp
+ *
+ *  Created on: Oct 16, 2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "ExtractorsUnitTest.hpp"
+
+#include <boost/assign.hpp>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "FunctionApproximation/Extractors.hpp"
+#include "Potentials/helpers.hpp"
+
+using namespace boost::assign;
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( ExtractorsTest );
+
+
+void ExtractorsTest::setUp()
+{
+  // failing asserts should be thrown
+  ASSERT_DO(Assert::Throw);
+
+}
+
+
+void ExtractorsTest::tearDown()
+{
+}
+
+/** UnitTest for gatherAllDistanceArguments()
+ */
+void ExtractorsTest::gatherAllDistanceArgumentsTest()
+{
+  // create positions
+  Fragment::positions_t positions;
+  Fragment::position_t pos(3, 0.);
+  for (double i = 0; i < 5; i+=1.) {
+    pos[0] = i;
+    positions.push_back(pos);
+  }
+
+  // create distances
+  FunctionModel::arguments_t args =
+      Extractors::gatherAllDistanceArguments(positions, 0);
+  CPPUNIT_ASSERT_EQUAL( (size_t)(5*4), args.size() );
+
+  // check created args
+  for (size_t i=0; i< 5*4; ++i)
+    CPPUNIT_ASSERT( (args[i].distance >= 0) && (args[i].distance <= 4));
+}
+
+/** UnitTest for gatherDistanceOfTuples()
+ */
+void ExtractorsTest::gatherDistanceOfTuplesTest()
+{
+  // create positions
+  Fragment::positions_t positions;
+  Fragment::position_t pos(3, 0.);
+  for (double i = 0; i < 5; i+=1.) {
+    pos[0] = i;
+    positions.push_back(pos);
+  }
+
+  // create charges
+  Fragment::charges_t charges;
+  charges += 6., 6., 1., 1., 1.;
+
+  // create Fragment
+  Fragment fragment(positions, charges);
+
+  {
+    // extract carbon pairs
+    Fragment::charges_t carbonpair;
+    carbonpair += 6.,6.;
+    FunctionModel::arguments_t args =
+        Extractors::gatherAllSymmetricDistanceArguments(
+            Extractors::gatherDistanceOfTuples(fragment, carbonpair),
+            0
+        );
+    CPPUNIT_ASSERT_EQUAL( (size_t)1, args.size() );
+    CPPUNIT_ASSERT_EQUAL( 1., args[0].distance );
+  }
+
+  {
+    // extract hydrogen triple
+    Fragment::charges_t hydrogentriple;
+    hydrogentriple += 1.,1.,1.;
+    FunctionModel::arguments_t args =
+        Extractors::reorderArgumentsByIncreasingDistance(
+            Extractors::gatherAllSymmetricDistanceArguments(
+                Extractors::gatherDistanceOfTuples(fragment, hydrogentriple),
+                0
+            )
+        );
+    CPPUNIT_ASSERT_EQUAL( (size_t)3, args.size() );
+    CPPUNIT_ASSERT_EQUAL( 1., args[0].distance );
+    CPPUNIT_ASSERT_EQUAL( 1., args[1].distance );
+    CPPUNIT_ASSERT_EQUAL( 2., args[2].distance );
+  }
+}
+
+/** UnitTest for reorderArgumentsByIncreasingDistance()
+ */
+void ExtractorsTest::reorderArgumentsByIncreasingDistanceTest()
+{
+  // prepare some arguments
+  FunctionModel::arguments_t args;
+  argument_t arg;
+  arg.distance = 0.1;
+  args.push_back(arg);
+  arg.distance = 0.9;
+  args.push_back(arg);
+  arg.distance = 0.3;
+  args.push_back(arg);
+  CPPUNIT_ASSERT_EQUAL( (size_t)3, args.size() );
+
+  // reorder
+  FunctionModel::arguments_t args_sorted =
+      Extractors::reorderArgumentsByIncreasingDistance(args);
+  CPPUNIT_ASSERT_EQUAL( (size_t)3, args_sorted.size() );
+  CPPUNIT_ASSERT_EQUAL( args[0].distance, args_sorted[0].distance );
+  CPPUNIT_ASSERT_EQUAL( args[1].distance, args_sorted[2].distance );
+  CPPUNIT_ASSERT_EQUAL( args[2].distance, args_sorted[1].distance );
+}
Index: src/FunctionApproximation/unittests/ExtractorsUnitTest.hpp
===================================================================
--- src/FunctionApproximation/unittests/ExtractorsUnitTest.hpp	(revision ac868eea35190399f5c65a0cd26d49f950047285)
+++ src/FunctionApproximation/unittests/ExtractorsUnitTest.hpp	(revision ac868eea35190399f5c65a0cd26d49f950047285)
@@ -0,0 +1,39 @@
+/*
+ * ExtractorsUnitTest.hpp
+ *
+ *  Created on: Oct 16, 2012
+ *      Author: heber
+ */
+
+#ifndef FUNCTIONARGUMENTUNITTEST_HPP_
+#define FUNCTIONARGUMENTUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/********************************************** Test classes **************************************/
+
+class ExtractorsTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( ExtractorsTest) ;
+    CPPUNIT_TEST ( gatherAllDistanceArgumentsTest );
+    CPPUNIT_TEST ( reorderArgumentsByIncreasingDistanceTest );
+    CPPUNIT_TEST ( gatherDistanceOfTuplesTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void gatherAllDistanceArgumentsTest();
+      void reorderArgumentsByIncreasingDistanceTest();
+      void gatherDistanceOfTuplesTest();
+
+private:
+};
+
+#endif /* FUNCTIONARGUMENTUNITTEST_HPP_ */
Index: src/FunctionApproximation/unittests/Makefile.am
===================================================================
--- src/FunctionApproximation/unittests/Makefile.am	(revision 355af848a519d00e953ce3fa5d65e6236684dc1b)
+++ src/FunctionApproximation/unittests/Makefile.am	(revision ac868eea35190399f5c65a0cd26d49f950047285)
@@ -3,10 +3,13 @@
 
 FUNCTIONAPPROXIMATIONTESTSSOURCES = \
+	../FunctionApproximation/unittests/ExtractorsUnitTest.cpp \
 	../FunctionApproximation/unittests/FunctionArgumentUnitTest.cpp
 
 FUNCTIONAPPROXIMATIONTESTSHEADERS = \
+	../FunctionApproximation/unittests/ExtractorsUnitTest.hpp \
 	../FunctionApproximation/unittests/FunctionArgumentUnitTest.hpp
 
 FUNCTIONAPPROXIMATIONTESTS = \
+	ExtractorsUnitTest \
 	FunctionArgumentUnitTest
 
@@ -22,4 +25,11 @@
 	$(BOOST_LIB)
 
+ExtractorsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../FunctionApproximation/unittests/ExtractorsUnitTest.cpp \
+	../FunctionApproximation/unittests/ExtractorsUnitTest.hpp
+ExtractorsUnitTest_LDADD = \
+	../libMolecuilderFragmentationSetValues.la \
+	${FUNCTIONAPPROXIMATIONLIBS}
+
 FunctionArgumentUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	../FunctionApproximation/unittests/FunctionArgumentUnitTest.cpp \
