Index: tests/regression/Selection/Molecules/AllMolecules/testsuite-selection-all-molecules.at
===================================================================
--- tests/regression/Selection/Molecules/AllMolecules/testsuite-selection-all-molecules.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/AllMolecules/testsuite-selection-all-molecules.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -4,29 +4,82 @@
 AT_SETUP([Selection - All Molecules])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/AllMolecules"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/AllMolecules"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "box.xyz" "-I --select-all-molecules -s box.xyz"
-mv box.xyz box_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-all-molecules --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "box.xyz" "-I --select-all-molecules --undo --redo -s box.xyz"
-mv box.xyz box_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' box_a.xyz box_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=box.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Selection - All Molecules with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/AllMolecules"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - All Molecules with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/AllMolecules"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=box.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 
 AT_SETUP([Unselection - All Molecules])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/AllMolecules"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/AllMolecules"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-all-molecules --unselect-all-molecules -s empty.xyz"
-mv empty.xyz empty_a.xyz
-check_command_output $srcpath $srcfile "box.xyz" "-I --select-all-molecules --unselect-all-molecules --undo -s box.xyz"
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-all-molecules --unselect-all-molecules --undo --redo -s empty.xyz"
-mv empty.xyz empty_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' empty_a.xyz empty_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-all-molecules -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Unselection - All Molecules with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/AllMolecules"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=box.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-all-molecules --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - All Molecules with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/AllMolecules"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-all-molecules --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Selection/Molecules/ClearMolecules/testsuite-selection-clear-molecules.at
===================================================================
--- tests/regression/Selection/Molecules/ClearMolecules/testsuite-selection-clear-molecules.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/ClearMolecules/testsuite-selection-clear-molecules.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -1,16 +1,43 @@
 ### 2. clear molecule selection
 
-AT_SETUP([Selection - clear])
+
+AT_SETUP([Selection - Clear molecule selection])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/ClearMolecules"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/ClearMolecules"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-all-molecules --clear-molecule-selection -s empty.xyz"
-mv empty.xyz empty_a.xyz
-check_command_output $srcpath $srcfile "box.xyz" "-I --select-all-molecules --clear-molecule-selection --undo -s box.xyz"
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-all-molecules --clear-molecule-selection --undo --redo -s empty.xyz"
-mv empty.xyz empty_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' empty_a.xyz empty_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --clear-molecule-selection -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Selection - Clear molecule selection with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/ClearMolecules"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=box.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --clear-molecule-selection --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Clear molecule selection with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/ClearMolecules"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --clear-molecule-selection --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Selection/Molecules/MoleculeByFormula/testsuite-selection-molecules-by-formula.at
===================================================================
--- tests/regression/Selection/Molecules/MoleculeByFormula/testsuite-selection-molecules-by-formula.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/MoleculeByFormula/testsuite-selection-molecules-by-formula.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -2,59 +2,180 @@
 
 
-AT_SETUP([Selection - Molecules by formula])
+AT_SETUP([Selection - Molecule by formula])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByFormula"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
 srcfile=mix.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-molecules-by-formula H2O -s water.xyz"
-mv water.xyz water_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecules-by-formula H2O --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-molecules-by-formula H2O --undo --redo -s water.xyz"
-mv water.xyz water_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_a.xyz water_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula H2O -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
 
-check_command_output $srcpath $srcfile "ethanol.xyz" "-I --select-molecules-by-formula C2H5(OH) -s ethanol.xyz"
-mv ethanol.xyz ethanol_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecules-by-formula C2H5(OH) --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "ethanol.xyz" "-I --select-molecules-by-formula C2H5(OH) --undo --redo -s ethanol.xyz"
-mv ethanol.xyz ethanol_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' ethanol_a.xyz ethanol_b.xyz], 0, [ignore], [ignore])
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=ethanol.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula "C2H5(OH)" -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
 
-check_command_output $srcpath $srcfile "benzene.xyz" "-I --select-molecules-by-formula C6H6 -s benzene.xyz"
-mv benzene.xyz benzene_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecules-by-formula C6H6 --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "benzene.xyz" "-I --select-molecules-by-formula C6H6 --undo --redo -s benzene.xyz"
-mv benzene.xyz benzene_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' benzene_a.xyz benzene_b.xyz], 0, [ignore], [ignore])
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=benzene.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula C6H6 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
 
-AT_SETUP([Unselection - Molecules by formula])
+
+AT_SETUP([Selection - Molecule by formula with Undo])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByFormula"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
 srcfile=mix.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_missing.xyz" "-I --select-all-molecules --unselect-molecules-by-formula H2O -s water_missing.xyz"
-mv water_missing.xyz water_missing_a.xyz
-check_command_output $srcpath $srcfile "mix.xyz" "-I --select-all-molecules --unselect-molecules-by-formula H2O --undo -s mix.xyz"
-check_command_output $srcpath $srcfile "water_missing.xyz" "-I --select-all-molecules --unselect-molecules-by-formula H2O --undo --redo -s water_missing.xyz"
-mv water_missing.xyz water_missing_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_missing_a.xyz water_missing_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula H2O --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
 
-check_command_output $srcpath $srcfile "ethanol_missing.xyz" "-I --select-all-molecules --unselect-molecules-by-formula C2H5(OH) -s ethanol_missing.xyz"
-mv ethanol_missing.xyz ethanol_missing_a.xyz
-check_command_output $srcpath $srcfile "mix.xyz" "-I --select-all-molecules --unselect-molecules-by-formula C2H5(OH) --undo -s mix.xyz"
-check_command_output $srcpath $srcfile "ethanol_missing.xyz" "-I --select-all-molecules --unselect-molecules-by-formula C2H5(OH) --undo --redo -s ethanol_missing.xyz"
-mv ethanol_missing.xyz ethanol_missing_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' ethanol_missing_a.xyz ethanol_missing_b.xyz], 0, [ignore], [ignore])
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula "C2H5(OH)" --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
 
-check_command_output $srcpath $srcfile "benzene_missing.xyz" "-I --select-all-molecules --unselect-molecules-by-formula C6H6 -s benzene_missing.xyz"
-mv benzene_missing.xyz benzene_missing_a.xyz
-check_command_output $srcpath $srcfile "mix.xyz" "-I --select-all-molecules --unselect-molecules-by-formula C6H6 --undo -s mix.xyz"
-check_command_output $srcpath $srcfile "benzene_missing.xyz" "-I --select-all-molecules --unselect-molecules-by-formula C6H6 --undo --redo -s benzene_missing.xyz"
-mv benzene_missing.xyz benzene_missing_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' benzene_missing_a.xyz benzene_missing_b.xyz], 0, [ignore], [ignore])
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula C6H6 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by formula with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula H2O --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=ethanol.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula "C2H5(OH)" --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=benzene.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecules-by-formula C6H6 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by formula])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=water_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula H2O -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=ethanol_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula "C2H5(OH)" -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=benzene_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula C6H6 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by formula with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=mix.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula H2O --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=mix.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula "C2H5(OH)" --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=mix.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula C6H6 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by formula with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=water_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula H2O --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=ethanol_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula "C2H5(OH)" --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByFormula"
+srcfile=mix.xyz
+testfile=test.xyz
+targetfile=benzene_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecules-by-formula C6H6 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Selection/Molecules/MoleculeById/testsuite-selection-molecule-by-id.at
===================================================================
--- tests/regression/Selection/Molecules/MoleculeById/testsuite-selection-molecule-by-id.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/MoleculeById/testsuite-selection-molecule-by-id.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -4,29 +4,82 @@
 AT_SETUP([Selection - Molecule by id])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeById"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeById"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_id4.xyz" "-I --select-molecule-by-id 4 -s water_id4.xyz"
-mv water_id4.xyz water_id4_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-id 4 --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "water_id4.xyz" "-I --select-molecule-by-id 4 --undo --redo -s water_id4.xyz"
-mv water_id4.xyz water_id4_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id4_a.xyz water_id4_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=water_id4.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 4 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by id with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeById"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 4 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by id with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeById"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=water_id4.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 4 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 
 AT_SETUP([Unselection - Molecule by id])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeById"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeById"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "id4_missing.xyz" "-I --select-all-molecules --unselect-molecule-by-id 4 -s id4_missing.xyz"
-mv id4_missing.xyz id4_missing_a.xyz
-check_command_output $srcpath $srcfile "box.xyz" "-I --select-all-molecules --unselect-molecule-by-id 4 --undo -s box.xyz"
-check_command_output $srcpath $srcfile "id4_missing.xyz" "-I --select-all-molecules --unselect-molecule-by-id 4 --undo --redo -s id4_missing.xyz"
-mv id4_missing.xyz id4_missing_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' id4_missing_a.xyz id4_missing_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=id4_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-id 4 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by id with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeById"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=box.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-id 4 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by id with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeById"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=id4_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-id 4 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Selection/Molecules/MoleculeByName/testsuite-selection-molecules-by-name.at
===================================================================
--- tests/regression/Selection/Molecules/MoleculeByName/testsuite-selection-molecules-by-name.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/MoleculeByName/testsuite-selection-molecules-by-name.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -3,29 +3,82 @@
 AT_SETUP([Selection - Molecules by name])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByName"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByName"
 srcfile=test.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecule-by-id 0 --select-molecules-by-name water -s water.xyz"
-mv water.xyz water_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecule-by-id 0 --select-molecules-by-name water --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecule-by-id 0 --select-molecules-by-name water --undo --redo -s water.xyz"
-mv water.xyz water_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_a.xyz water_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecule-by-id 0 --select-molecules-by-name \"water\" -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecules by name with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByName"
+srcfile=test.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecule-by-id 0 --select-molecules-by-name \"water\" --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecules by name with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByName"
+srcfile=test.xyz
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecule-by-id 0 --select-molecules-by-name \"water\" --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 
 AT_SETUP([Unselection - Molecules by name])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByName"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByName"
 srcfile=test.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecules-by-name water -s empty.xyz"
-mv empty.xyz empty_a.xyz
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecules-by-name water --undo -s water.xyz"
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecules-by-name water --undo --redo -s empty.xyz"
-mv empty.xyz empty_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' empty_a.xyz empty_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecules-by-name \"water\" -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecules by name with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByName"
+srcfile=test.xyz
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecules-by-name \"water\" --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecules by name with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByName"
+srcfile=test.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-id 0 --change-molname \"water\" --unselect-molecules-by-name \"water\" --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Selection/Molecules/MoleculeByOrder/testsuite-selection-molecule-by-order.at
===================================================================
--- tests/regression/Selection/Molecules/MoleculeByOrder/testsuite-selection-molecule-by-order.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/MoleculeByOrder/testsuite-selection-molecule-by-order.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -4,83 +4,262 @@
 AT_SETUP([Selection - Molecule by order, forward])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByOrder"
-srcfile=twowater.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-molecule-by-order 1 -s water_id0.xyz"
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-molecule-by-order 2 -s water_id1.xyz"
-mv water_id0.xyz water_id0_a.xyz
-mv water_id1.xyz water_id1_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-order 1 --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-order 2 --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-molecule-by-order 1 --undo --redo -s water_id0.xyz"
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-molecule-by-order 2 --undo --redo -s water_id1.xyz"
-mv water_id0.xyz water_id0_b.xyz
-mv water_id1.xyz water_id1_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id0_a.xyz water_id0_b.xyz], 0, [ignore], [ignore])
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id1_a.xyz water_id1_b.xyz], 0, [ignore], [ignore])
-AT_CLEANUP
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order 1 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order 2 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, forward with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order 1 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order 2 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, forward with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order 1 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order 2 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 
 AT_SETUP([Selection - Molecule by order, backward])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByOrder"
-srcfile=twowater.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-molecule-by-order -2 -s water_id0.xyz"
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-molecule-by-order -1 -s water_id1.xyz"
-mv water_id0.xyz water_id0_a.xyz
-mv water_id1.xyz water_id1_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-order -2 --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-molecule-by-order -1 --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-molecule-by-order -2 --undo --redo -s water_id0.xyz"
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-molecule-by-order -1 --undo --redo -s water_id1.xyz"
-mv water_id0.xyz water_id0_b.xyz
-mv water_id1.xyz water_id1_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id0_a.xyz water_id0_b.xyz], 0, [ignore], [ignore])
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id1_a.xyz water_id1_b.xyz], 0, [ignore], [ignore])
-AT_CLEANUP
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order -2 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order -1 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, backward with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order -2 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order -1 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, backward with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order -2 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-molecule-by-order -1 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 
 AT_SETUP([Unselection - Molecule by order, forward])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByOrder"
-srcfile=twowater.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-all-molecules --unselect-molecule-by-order 1 -s water_id1.xyz"
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-all-molecules --unselect-molecule-by-order 2 -s water_id0.xyz"
-mv water_id1.xyz water_id1_a.xyz
-mv water_id0.xyz water_id0_a.xyz
-check_command_output $srcpath $srcfile "twowater.xyz" "-I --select-all-molecules --unselect-molecule-by-order 1 --undo -s twowater.xyz"
-check_command_output $srcpath $srcfile "twowater.xyz" "-I --select-all-molecules --unselect-molecule-by-order 2 --undo -s twowater.xyz"
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-all-molecules --unselect-molecule-by-order 1 --undo --redo -s water_id1.xyz"
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-all-molecules --unselect-molecule-by-order 2 --undo --redo -s water_id0.xyz"
-mv water_id0.xyz water_id0_b.xyz
-mv water_id1.xyz water_id1_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id0_a.xyz water_id0_b.xyz], 0, [ignore], [ignore])
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id1_a.xyz water_id1_b.xyz], 0, [ignore], [ignore])
-AT_CLEANUP
-
-AT_SETUP([Unselection - Molecule by order, backward])
-AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeByOrder"
-srcfile=twowater.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-all-molecules --unselect-molecule-by-order -2 -s water_id1.xyz"
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-all-molecules --unselect-molecule-by-order -1 -s water_id0.xyz"
-mv water_id1.xyz water_id1_a.xyz
-mv water_id0.xyz water_id0_a.xyz
-check_command_output $srcpath $srcfile "twowater.xyz" "-I --select-all-molecules --unselect-molecule-by-order -2 --undo -s twowater.xyz"
-check_command_output $srcpath $srcfile "twowater.xyz" "-I --select-all-molecules --unselect-molecule-by-order -1 --undo -s twowater.xyz"
-check_command_output $srcpath $srcfile "water_id1.xyz" "-I --select-all-molecules --unselect-molecule-by-order -2 --undo --redo -s water_id1.xyz"
-check_command_output $srcpath $srcfile "water_id0.xyz" "-I --select-all-molecules --unselect-molecule-by-order -1 --undo --redo -s water_id0.xyz"
-mv water_id0.xyz water_id0_b.xyz
-mv water_id1.xyz water_id1_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id0_a.xyz water_id0_b.xyz], 0, [ignore], [ignore])
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_id1_a.xyz water_id1_b.xyz], 0, [ignore], [ignore])
-AT_CLEANUP
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order 1 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order 2 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by order, forward with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=twowater.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order 1 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=twowater.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order 2 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecule by order, forward with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order 1 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order 2 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, backward])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order -2 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order -1 -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, backward with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=twowater.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order -2 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=twowater.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order -1 --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecule by order, backward with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id1.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order -2 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeByOrder"
+srcfile=twowater.xyz
+testfile=test.xyz
+targetfile=water_id0.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --unselect-molecule-by-order -1 --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Selection/Molecules/MoleculeOfAtom/testsuite-selection-atoms-molecules.at
===================================================================
--- tests/regression/Selection/Molecules/MoleculeOfAtom/testsuite-selection-atoms-molecules.at	(revision 93eb00f571cb1fc2dbc48382ec249ff9bc734782)
+++ tests/regression/Selection/Molecules/MoleculeOfAtom/testsuite-selection-atoms-molecules.at	(revision 7c958e3f7ce548c4bf2fc8abe3caa46d9990fd56)
@@ -3,29 +3,82 @@
 AT_SETUP([Selection - Molecules by atom selection])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeOfAtom"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeOfAtom"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-atom-by-id 0 --select-atoms-molecules -s water.xyz"
-mv water.xyz water_a.xyz
-check_command_output $srcpath $srcfile "empty.xyz" "-I --select-atom-by-id 0 --select-atoms-molecules --undo -s empty.xyz"
-check_command_output $srcpath $srcfile "water.xyz" "-I --select-atom-by-id 0 --select-atoms-molecules --undo --redo -s water.xyz"
-mv water.xyz water_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_a.xyz water_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-atom-by-id 0 --select-atoms-molecules -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecules by atom selection with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeOfAtom"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=empty.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-atom-by-id 0 --select-atoms-molecules --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Selection - Molecules by atom selection with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeOfAtom"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=water.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-atom-by-id 0 --select-atoms-molecules --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 
 AT_SETUP([Unselection - Molecules by atom selection])
 AT_KEYWORDS([selection,molecule])
-# some variables before
-srcpath="Selection/Molecules/MoleculeOfAtom"
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeOfAtom"
 srcfile=box.xyz
-m4_include(CheckCommand.sh)
-# the tests
-check_command_output $srcpath $srcfile "water_missing.xyz" "-I --select-all-molecules --select-atom-by-id 0 --unselect-atoms-molecules -s water_missing.xyz"
-mv water_missing.xyz water_missing_a.xyz
-check_command_output $srcpath $srcfile "box.xyz" "-I --select-all-molecules --select-atom-by-id 0 --unselect-atoms-molecules --undo -s box.xyz"
-check_command_output $srcpath $srcfile "water_missing.xyz" "-I --select-all-molecules --select-atom-by-id 0 --unselect-atoms-molecules --undo --redo -s water_missing.xyz"
-mv water_missing.xyz water_missing_b.xyz
-AT_CHECK([diff -I '.*Created by molecuilder.*' water_missing_a.xyz water_missing_b.xyz], 0, [ignore], [ignore])
+testfile=test.xyz
+targetfile=water_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --select-atom-by-id 0 --unselect-atoms-molecules -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
 AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecules by atom selection with Undo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeOfAtom"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=box.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --select-atom-by-id 0 --unselect-atoms-molecules --undo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([Unselection - Molecules by atom selection with Redo])
+AT_KEYWORDS([selection,molecule])
+
+regressionpath="${abs_top_srcdir}/${AUTOTEST_PATH}/Selection/Molecules/MoleculeOfAtom"
+srcfile=box.xyz
+testfile=test.xyz
+targetfile=water_missing.xyz
+AT_CHECK([cp -n ${regressionpath}/pre/$srcfile $testfile], 0)
+AT_CHECK([../../molecuilder -i $testfile -I --select-all-molecules --select-atom-by-id 0 --unselect-atoms-molecules --undo --redo -s $targetfile], 0, [stdout], [stderr])
+AT_CHECK([diff -I '.*Created by molecuilder.*' $targetfile ${regressionpath}/post/$targetfile], 0, [ignore], [ignore])
+
+AT_CLEANUP
