Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
+++ tests/regression/Makefile.am	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
@@ -0,0 +1,30 @@
+AUTOM4TE = autom4te
+EXTRA_DIST = testsuite.at $(TESTSUITE) atlocal.in regression
+TESTSUITE = $(srcdir)/testsuite
+
+check-local: atconfig atlocal package.m4 $(TESTSUITE)
+		$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig atlocal $(TESTSUITE)
+		$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
+		$(TESTSUITEFLAGS)
+     
+clean-local:
+		test ! -f '$(TESTSUITE)' || \
+		$(SHELL) '$(TESTSUITE)' --clean
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at
+		$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+		mv $@.tmp $@
+
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+			:;{ \
+					echo '# Signature of the current package.' && \
+					echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
+					echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
+					echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
+					echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
+					echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+				} >'$(srcdir)/package.m4'
Index: tests/regression/atlocal.in
===================================================================
--- tests/regression/atlocal.in	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
+++ tests/regression/atlocal.in	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
@@ -0,0 +1,4 @@
+prefix='@prefix@'
+exec_prefix='@prefix@'
+topdir='@topdir@'
+bindir='@bindir@'
Index: tests/regression/molecuilder.in
===================================================================
--- tests/regression/molecuilder.in	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
+++ tests/regression/molecuilder.in	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# wrapper for testing molecuilder
+
+. ../../atconfig
+
+"${abs_top_builddir}/src/molecuilder" \
+	${1+"$@"}
+status=$?
+
+exit $status
Index: tests/regression/testsuite.at
===================================================================
--- tests/regression/testsuite.at	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
+++ tests/regression/testsuite.at	(revision 318cea7c681aa1b7cad2c3f8eb67b410c41fe1ea)
@@ -0,0 +1,188 @@
+# Process with autom4te to create an -*- Autotest -*- test suite.
+#
+# see regression/... subdirs wherein for each of the cases and each check (enumerated) is a pre and post dir. 
+# In pre initial files are placed, in post results can be found to be checked by diff in this testsuite.
+
+AT_INIT([Molecular Builder])
+
+# Checking if command line options are parsed correctly
+AT_BANNER([MoleCuilder - standard options])
+AT_SETUP([Standard Options])
+AT_KEYWORDS([options])
+AT_CHECK([pwd],[ignore],[ignore])
+AT_CHECK([../../molecuilder -v 1], 0, [stdout], [ignore])
+AT_CHECK([fgrep olecuilder stdout], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -h], 0, [stdout], [ignore])
+AT_CHECK([fgrep "Give this help screen" stdout], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -e], 255, [ignore], [stderr])
+AT_CHECK([fgrep "Not enough or invalid arguments" stderr], 0, [ignore], [ignore])
+AT_CLEANUP
+
+
+AT_BANNER([MoleCuilder - molecular config creation from xyz file and atom adding])
+# 1. create some simplest molecular geometry
+AT_SETUP([Simple configuration - xyz file generation])
+AT_KEYWORDS([Atom handling])
+AT_DATA([test.xyz], [[1
+ # test configuration, created by molecuilder test suite
+H	10.	10.	10.
+]])
+AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/1/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 2. parsing an xyz
+AT_SETUP([Simple configuration - parsing xyz file])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -p test.xyz], 0, [ignore], [ignore])
+AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1	10.000000000	10.000000000	10.000000000	0 # molecule nr 0
+], [ignore])
+AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
+
+# 3. add atom
+AT_CLEANUP
+AT_SETUP([Simple configuration - adding atom])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a 1 10. 10. 10.], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 4. change the element
+AT_SETUP([Simple configuration - Changing element])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.conf test.conf], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E 0 6], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 5. remove atom
+AT_SETUP([Simple configuration - Atom removal])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -r 0], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 6. test some more configuration that all desire parameters and count how many complain
+AT_SETUP([Simple configuration - invalid commands on empty configs])
+AT_CHECK([../../molecuilder empty.conf -e ${abs_top_srcdir}/src/ -t -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [1
+], [ignore])
+AT_CLEANUP
+
+# 7. test some more configuration that all need parameters and count how many complain
+AT_SETUP([Simple configuration - invalid commands on present configs])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/7/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E -c -b -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -c -b -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -U -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -u], 255, [ignore], [stderr])
+AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
+AT_CLEANUP
+
+
+AT_BANNER([MoleCuilder - simulation domain])
+# 1. define box setting
+AT_SETUP([Domain - defining simulation domain])
+AT_KEYWORDS([defining domain])
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -B 10 0 10 0 0 10], 0, [stdout], [stderr])
+AT_CHECK([fgrep "BoxLength" test.conf], 0, [stdout], [stderr])
+AT_CHECK([diff test.conf ${abs_top_srcdir}/${AUTOTEST_PATH}/Domain/1/post/test.conf], 0, [stdout], [stderr])
+AT_CLEANUP
+
+# 2. center atoms in defined domain
+AT_SETUP([Domain - setting and centering in domain])
+AT_KEYWORDS([setting domain])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Domain/2/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b 15 0 15 0 0 15], 0, [stdout], [stderr])
+AT_CHECK([diff test.conf ${abs_top_srcdir}/${AUTOTEST_PATH}/Domain/2/post/test.conf], 0, [stdout], [stderr])
+AT_CLEANUP
+
+AT_BANNER([MoleCuilder - Graph routines test])
+AT_SETUP([Graph - DFS analysis])
+AT_KEYWORDS([graph])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Graph/1/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -D 2.], 0, [stdout], [stderr])
+AT_CHECK([fgrep -c "No rings were detected in the molecular structure." stdout], 0, [1
+], [ignore])
+AT_CLEANUP
+
+AT_BANNER([MoleCuilder - Fragmentation and Re-fragmentation test])
+# 1. check config
+AT_SETUP([Fragmentation - Checking present config])
+AT_KEYWORDS([fragmentation])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/1/pre/test.conf .], 0)
+AT_CHECK([fgrep "Ion_Type1_4" test.conf], 0, [Ion_Type1_4	8.532785963	4.787886018	2.645886050	0 # molecule nr 6
+], [ignore])
+AT_CHECK([fgrep "Ion_Type2_4" test.conf], 1, [ignore], [ignore])
+AT_CLEANUP
+# 2. fragment the molecule and check the number of configs
+AT_SETUP([Fragmentation - Fragmentation])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/2/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -f 1.55 2], 0, [ignore], [ignore], [mkdir std; mv BondFragment*.conf* std/])
+AT_CHECK([mkdir std; mv BondFragment*.conf* std/], 0)
+AT_CHECK([ls -l std/BondFragment*.conf | wc -l], 0, [5
+], [ignore])
+AT_CLEANUP
+# 3. check whether parsing of BondFragment files and re-rwriting config files is working (exit code is 2 as we don't need to continue wrt to ...OrderAtSite)
+AT_SETUP([Fragmentation - Fragmentation is at MaxOrder])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/3/pre/* .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -f 1.55 2], 2, [ignore], [ignore], [mkdir new; mv BondFragment*.conf* new/])
+AT_CHECK([mkdir new; mv BondFragment*.conf* new/], 0)
+AT_CLEANUP
+
+
+AT_BANNER([MoleCuilder - Tesselation test])
+# 1. Non convex tesselation
+AT_SETUP([Tesselation - Non-Convex Envelope])
+AT_KEYWORDS([Tesselation])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/pre/* .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 4. NonConvexEnvelope], 0, [stdout], [stderr])
+AT_CHECK([file=NonConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 2. convex tesselation (where the non-convex is already convex)
+AT_SETUP([Tesselation - Convex Envelope])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/pre/* .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -o ConvexEnvelope NonConvexEnvelope], 0, [stdout], [stderr])
+AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore])
+AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore])
+AT_CHECK([diff ConvexEnvelope.dat NonConvexEnvelope.dat], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 3. Big Non convex tesselation
+AT_SETUP([Tesselation - Big non-Convex Envelope])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/pre/* .], 0)
+AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 4. NonConvexEnvelope], 0, [stdout], [stderr])
+AT_CHECK([file=NonConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 4. Big convex tesselation - is not working yet 
+#AT_SETUP([Tesselation - big convex Envelope])
+#AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/4/pre/* .], 0)
+#AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -o ConvexEnvelope NonConvexEnvelope], 0, [stdout], [stderr])
+#AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/4/post/$file], 0, [ignore], [ignore])
+#AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/4/post/$file], 0, [ignore], [ignore])
+#AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore])
+#AT_CLEANUP
+
