Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision 7774f7e70f2ae517967d41e9125f5dba0adf1dbe)
+++ tests/regression/Makefile.am	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -8,4 +8,5 @@
 	package.m4 \
 	runpython.in \
+	trianglematcher.in \
 	Analysis \
 	Atoms \
@@ -234,5 +235,6 @@
 	$(srcdir)/Tesselation/BigNonConvex/testsuite-tesselation-big-non-convex-envelope.at \
 	$(srcdir)/Tesselation/Convex/testsuite-tesselation-convex-envelope.at \
-	$(srcdir)/Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at
+	$(srcdir)/Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at \
+	$(srcdir)/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at
 
 max_jobs = 4
@@ -263,5 +265,5 @@
 
 AUTOTEST = $(AUTOM4TE) --language=autotest
-$(TESTSUITE): $(srcdir)/testsuite.at package.m4 $(TESTSCRIPTS)
+$(TESTSUITE): $(srcdir)/testsuite.at molecuilder package.m4 runpython trianglematcher $(TESTSCRIPTS)
 	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
 	mv $@.tmp $@
Index: tests/regression/Tesselation/BigConvex/testsuite-tesselation-big-convex-envelope.at
===================================================================
--- tests/regression/Tesselation/BigConvex/testsuite-tesselation-big-convex-envelope.at	(revision 7774f7e70f2ae517967d41e9125f5dba0adf1dbe)
+++ tests/regression/Tesselation/BigConvex/testsuite-tesselation-big-convex-envelope.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -19,5 +19,5 @@
 
 AT_SETUP([Tesselation - big convex Envelope])
-AT_KEYWORDS([Tesselation convex convex-envelope])
+AT_KEYWORDS([Tesselation convex convex-envelope trianglematcher])
 
 file=test.conf
@@ -25,5 +25,5 @@
 convexfile=ConvexEnvelope
 AT_CHECK([../../molecuilder -i $file  --select-molecule-by-id 0 --convex-envelope 5. --convex-file $convexfile --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])
-AT_CHECK([diff ${convexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/BigConvex/post/ConvexEnvelope.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${convexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/BigConvex/post/ConvexEnvelope.dat], 0, [ignore], [ignore])
 #AT_CHECK([diff ${convexfile}.r3d ${abs_top_srcdir}/tests/regression/Tesselation/BigConvex/post/ConvexEnvelope.r3d], 0, [ignore], [ignore])
 AT_CHECK([fgrep "tesselated volume area is 223.577 angstrom^3" stdout], 0, [ignore], [ignore])
Index: tests/regression/Tesselation/BigNonConvex/testsuite-tesselation-big-non-convex-envelope.at
===================================================================
--- tests/regression/Tesselation/BigNonConvex/testsuite-tesselation-big-non-convex-envelope.at	(revision 7774f7e70f2ae517967d41e9125f5dba0adf1dbe)
+++ tests/regression/Tesselation/BigNonConvex/testsuite-tesselation-big-non-convex-envelope.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -19,5 +19,5 @@
 
 AT_SETUP([Tesselation - Big non-Convex Envelope])
-AT_KEYWORDS([Tesselation nonconvex nonconvex-envelope])
+AT_KEYWORDS([Tesselation nonconvex nonconvex-envelope trianglematcher])
 
 file=test.conf
@@ -25,5 +25,5 @@
 nonconvexfile=NonConvexEnvelope
 AT_CHECK([../../molecuilder -i $file  --select-molecule-by-id 0 -N 4. --nonconvex-file $nonconvexfile], 0, [stdout], [stderr])
-AT_CHECK([diff ${nonconvexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/BigNonConvex/post/NonConvexEnvelope.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${nonconvexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/BigNonConvex/post/NonConvexEnvelope.dat], 0, [ignore], [ignore])
 #AT_CHECK([diff ${nonconvexfile}.r3d ${abs_top_srcdir}/tests/regression/Tesselation/BigNonConvex/post/NonConvexEnvelope.r3d], 0, [ignore], [ignore])
 
Index: tests/regression/Tesselation/Convex/testsuite-tesselation-convex-envelope.at
===================================================================
--- tests/regression/Tesselation/Convex/testsuite-tesselation-convex-envelope.at	(revision 7774f7e70f2ae517967d41e9125f5dba0adf1dbe)
+++ tests/regression/Tesselation/Convex/testsuite-tesselation-convex-envelope.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -19,5 +19,5 @@
 
 AT_SETUP([Tesselation - Convex Envelope])
-AT_KEYWORDS([Tesselation convex convex-envelope])
+AT_KEYWORDS([Tesselation convex convex-envelope trianglematcher])
 
 file=test.conf
@@ -25,5 +25,5 @@
 convexfile=ConvexEnvelope
 AT_CHECK([../../molecuilder -i $file  --select-molecule-by-id 0 --convex-envelope 50. --convex-file $convexfile --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])
-AT_CHECK([diff ${convexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/Convex/post/ConvexEnvelope.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${convexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/Convex/post/ConvexEnvelope.dat], 0, [ignore], [ignore])
 #AT_CHECK([diff ${convexfile}.r3d ${abs_top_srcdir}/tests/regression/Tesselation/Convex/post/ConvexEnvelope.r3d], 0, [ignore], [ignore])
 AT_CHECK([fgrep "tesselated volume area is 8.89109 angstrom^3" stdout], 0, [ignore], [ignore])
Index: tests/regression/Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at
===================================================================
--- tests/regression/Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at	(revision 7774f7e70f2ae517967d41e9125f5dba0adf1dbe)
+++ tests/regression/Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -19,10 +19,10 @@
 
 AT_SETUP([Tesselation - Non-Convex Envelope])
-AT_KEYWORDS([Tesselation nonconvex nonconvex-envelope])
+AT_KEYWORDS([Tesselation nonconvex nonconvex-envelope trianglematcher])
 
 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Tesselation/NonConvex/pre/test.conf .], 0)
 nonconvexfile=NonConvexEnvelope
 AT_CHECK([../../molecuilder -i test.conf  --select-molecule-by-id 0 -N 4. --nonconvex-file $nonconvexfile], 0, [stdout], [stderr])
-AT_CHECK([diff ${nonconvexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/NonConvex/post/NonConvexEnvelope.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${nonconvexfile}.dat ${abs_top_srcdir}/tests/regression/Tesselation/NonConvex/post/NonConvexEnvelope.dat], 0, [ignore], [ignore])
 #AT_CHECK([diff ${nonconvexfile}.r3d ${abs_top_srcdir}/tests/regression/Tesselation/NonConvex/post/NonConvexEnvelope.r3d], 0, [ignore], [ignore])
 
Index: tests/regression/Tesselation/TriangleMatcher/pre/convex.dat
===================================================================
--- tests/regression/Tesselation/TriangleMatcher/pre/convex.dat	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
+++ tests/regression/Tesselation/TriangleMatcher/pre/convex.dat	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -0,0 +1,5 @@
+# stuff before the actual tesselation
+1. 1. 1.
+
+1 2 3
+4 5 6
Index: tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat
===================================================================
--- tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
+++ tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -0,0 +1,5 @@
+# stuff before the actual tesselation
+1. 1. 1.
+
+1 2 10
+4 9 2
Index: tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat
===================================================================
--- tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
+++ tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -0,0 +1,5 @@
+# stuff before the actual tesselation
+1. 1. 1.
+
+1 3 2
+6 5 4
Index: tests/regression/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at
===================================================================
--- tests/regression/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
+++ tests/regression/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -0,0 +1,35 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2015 Frederik Heber
+#
+#    This program 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 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+### trianglematcher helper
+
+AT_SETUP([Tesselation - TriangleMather])
+AT_KEYWORDS([Tesselation trianglematcher])
+
+# matches
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat], 0, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex.dat], 0, [ignore], [ignore])
+
+# no matches
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat], 1, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat], 1, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex.dat], 1, [ignore], [ignore])
+AT_CHECK([../../trianglematcher ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_none.dat ${abs_top_srcdir}/tests/regression/Tesselation/TriangleMatcher/pre/convex_other.dat], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Tesselation/testsuite-tesselation.at
===================================================================
--- tests/regression/Tesselation/testsuite-tesselation.at	(revision 7774f7e70f2ae517967d41e9125f5dba0adf1dbe)
+++ tests/regression/Tesselation/testsuite-tesselation.at	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -18,4 +18,7 @@
 AT_BANNER([MoleCuilder - Tesselation test])
 
+# trianglematcher
+m4_include([Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at])
+
 # Non convex tesselation
 m4_include([Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at])
Index: tests/regression/trianglematcher.in
===================================================================
--- tests/regression/trianglematcher.in	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
+++ tests/regression/trianglematcher.in	(revision 7d146a387231de6a2198a250dbdbab1f1e9076bd)
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# wrapper for testing with trianglematcher
+
+. ../../atlocal
+
+if test ! -z ${valgrind}
+then
+G_SLICE=always-malloc G_DEBUG=gc-friendly \
+libtool --mode=execute \
+${valgrind} -v \
+--log-file=valgrind.log \
+--xml=yes \
+--xml-file=valgrind.err \
+--time-stamp=yes \
+--error-exitcode=255 \
+--leak-check=full \
+--leak-resolution=high \
+--num-callers=20 \
+--track-origins=yes \
+--show-reachable=yes \
+"${AUTOTEST_PATH}/Tesselation/TriangleMatcher/trianglematcher" \
+${1+"$@"}
+else
+"${AUTOTEST_PATH}/Tesselation/TriangleMatcher/trianglematcher" \
+${1+"$@"}
+fi
+
+status=$?
+
+exit $status
