diff --git a/examples2/grammar/contextFree1-2.txt b/examples2/grammar/contextFree1-2.txt
index 765d49052d189644cef8cc6668cd71c28684d4d3..1efcafa9a43105aeeb6102b50b5115a4219f4db2 100644
--- a/examples2/grammar/contextFree1-2.txt
+++ b/examples2/grammar/contextFree1-2.txt
@@ -1,10 +1,10 @@
 CFG (
-{'S', 'A', 'B', 'C', 'X'},
-{'a', 'b', 'c', 'd', 'e'},
-{'S' -> 'C' 'd' 'e' 'S' 'e' | 'd' 'd' 'B' | 'c' 'A',
-'A' -> 'a' 'd' 'X' | 'b' 'b' 'X',
-'X' -> 'c' 'a' 'd' 'X' |,
-'B' -> 'b' 'a' 'C' 'd' |,
-'C' -> 'A' 'c' 'a' | 'a'
+{S, A, B, C, X},
+{a, b, c, d, e},
+{S -> C d e S e | d d B | c A,
+A -> a d X | b b X,
+X -> c a d X |,
+B -> b a C d |,
+C -> A c a | a
 },
-'S')
+S)
diff --git a/examples2/grammar/contextFree1-3.txt b/examples2/grammar/contextFree1-3.txt
index a70e69adb8f2c5be1b61f7e2b42d41d2cc4c67fe..eff4678ae22499e4ee2e327e6871afd92775d5e9 100644
--- a/examples2/grammar/contextFree1-3.txt
+++ b/examples2/grammar/contextFree1-3.txt
@@ -1,10 +1,10 @@
 CFG (
-{'S', 'A', 'B', 'C', 'X'},
-{'a', 'b', 'c', 'd', 'e'},
-{'S' -> 'C' 'd' 'e' 'S' 'e' | 'd' 'd' 'B' | 'c' 'A',
-'A' -> 'C' 'd' | 'b' 'b',
-'B' -> 'b' 'a' 'C' 'd' |,
-'C' -> 'b' 'b' 'c' 'a' 'X' | 'a' 'X',
-'X' -> 'd' 'c' 'a' 'X' |
+{S, A, B, C, X},
+{a, b, c, d, e},
+{S -> C d e S e | d d B | c A,
+A -> C d | b b,
+B -> b a C d |,
+C -> b b c a X | a X,
+X -> d c a X |
 },
-'S')
+S)
diff --git a/examples2/grammar/contextFree1-4.txt b/examples2/grammar/contextFree1-4.txt
index 937ed0bfee9d59568ca51dc1278a86aa55581706..92e3f72de9616b0a3b3ddc76c3f06a8e04e49276 100644
--- a/examples2/grammar/contextFree1-4.txt
+++ b/examples2/grammar/contextFree1-4.txt
@@ -1,10 +1,10 @@
 CFG (
-{'A', 'B', 'C', 'D', 'E'},
-{'a', 'b'},
-{'A' -> 'b' | 'A' 'B' | 'a',
-'B' -> 'A' 'C',
-'C' -> 'a' 'E' 'D',
-'D' -> 'a' | 'B' 'E',
-'E' -> 'B' 'A' | 'b' |
+{A, B, C, D, E},
+{a, b},
+{A -> b | A B | a,
+B -> A C,
+C -> a E D,
+D -> a | B E,
+E -> B A | b |
 },
-'E')
+E)
diff --git a/examples2/grammar/contextFree1.txt b/examples2/grammar/contextFree1.txt
index c064eb650a0d99d5d01e71ba0e4c56271ec94509..9d2951551f4d63d6f9154bb071dc0e59a44d5a4e 100644
--- a/examples2/grammar/contextFree1.txt
+++ b/examples2/grammar/contextFree1.txt
@@ -1,9 +1,9 @@
 CFG (
-{'S', 'A', 'B', 'C'},
-{'a', 'b', 'c', 'd', 'e'},
-{'S' -> 'C' 'd' 'e' 'S' 'e' | 'd' 'd' 'B' | 'c' 'A',
-'A' -> 'C' 'd' | 'b' 'b',
-'B' -> 'b' 'a' 'C' 'd' |,
-'C' -> 'A' 'c' 'a' | 'a'
+{S, A, B, C},
+{a, b, c, d, e},
+{S -> C d e S e | d d B | c A,
+A -> C d | b b,
+B -> b a C d |,
+C -> A c a | a
 },
-'S')
+S)
diff --git a/examples2/grammar/contextFree2.txt b/examples2/grammar/contextFree2.txt
index 40a7787b86503233dadb961155cd97c2707b769c..f139c99dba49e3f6bded5439d5ca0c838d427f71 100644
--- a/examples2/grammar/contextFree2.txt
+++ b/examples2/grammar/contextFree2.txt
@@ -1,10 +1,10 @@
 CFG (
-{'S', 'B', 'C', 'D', 'E'},
-{'a', 'b'},
-{'S' -> 'D' 'S' | 'a' | 'C' 'D',
-'C' -> 'D' 'a' 'B' | 'b',
-'B' -> 'S' 'D' |,
-'D' -> 'B' 'E',
-'E' -> 'a' | 'C' 'D'
+{S, B, C, D, E},
+{a, b},
+{S -> D S | a | C D,
+C -> D a B | b,
+B -> S D |,
+D -> B E,
+E -> a | C D
 },
-'D')
+D)
diff --git a/tests.aconvert.sh b/tests.aconvert.sh
new file mode 100755
index 0000000000000000000000000000000000000000..073d824dcd5b39d49b1aafbabafa4e8b464ab3ce
--- /dev/null
+++ b/tests.aconvert.sh
@@ -0,0 +1,145 @@
+#!/usr/bin/env bash
+
+# $1 test dir suffix (debug / release)
+
+# SETTINGS
+TESTCASE_TIMEOUT=10
+LOGFILE="log_tests.txt"
+
+EXECUTABLES="aconvert2"
+TESTS_DIR="`pwd`/examples2"
+
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
+
+
+# ----------------------------
+
+for FILE in $EXECUTABLES; do
+	if [ ! -f bin-$1/$FILE ]; then
+		echo "Executable $FILE is required for testing. Make sure it is in bin-$1 folder."
+		exit 1
+	fi
+done
+
+cd bin-$1/
+rm -f $LOGFILE
+
+# ----------------------------
+
+# $1 = conv command
+# $2 = return code
+# $3 = input automaton
+# $4 = output of conversion
+function log {
+	echo "----------------------------------------------------------" >> $LOGFILE
+	echo "conv: " $1 >> $LOGFILE
+	echo "ret: " $2 >> $LOGFILE
+	echo "input automaton:" >> $LOGFILE
+	cat  "$3" >> $LOGFILE
+	echo "command out:" >> $LOGFILE
+	echo "$4" >> $LOGFILE
+}
+
+# $1 = command for conversion. Output of such command must be (eps-)NFA !!
+# $2 = automaton
+function runTest2 {
+	OUT=`timeout $TESTCASE_TIMEOUT bash -c "cat $2 | ./aconvert2 --$1_from_string "`
+	RET=$?
+
+	if [ $RET == 0 ]; then # ok
+		return 0
+	fi
+
+	log "$1" $RET "$2" "$OUT"
+
+	if [ $RET == 124 ]; then # timeout
+		return 2
+	elif [ $RET -ge 124 ]; then #segv
+		return 3
+	else
+		return 1
+	fi
+}
+
+function registerResult {
+	case $1 in
+		0)
+			echo -n "."
+			echo -n "+1" >> $RES_GOOD
+			;;
+		1)
+			echo -n "x"
+			echo -n "+1" >> $RES_FAIL
+			;;
+		2)
+			echo -n "T"
+			echo -n "+1" >> $RES_TIME
+			;;
+		3)
+			echo -n "E"
+			echo -n "+1" >> $RES_SEGV
+			;;
+		*)
+			echo -n "?"
+			echo -n "+1" >> $RES_UNKN
+			;;
+	esac
+}
+
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+}
+
+function clearResults {
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
+}
+
+function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+
+	# summary
+	echo -ne "\n\t"
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN)
+	echo ""
+}
+
+# $1 - aconversions2 sequence
+function runTest {
+	echo $1 \(./aconvert2 --$1_from_string\)
+	echo -ne "\t"
+
+	initResults
+
+	# predefined tests first
+	for FILE in `ls $TESTS_DIR/$1/*.txt`; do
+		runTest2 "$1" "$FILE"
+		registerResult $?
+	done
+
+	outputResults
+	clearResults
+}
+
+runTest "automaton"
+runTest "grammar"