diff --git a/tests.aarbology.sh b/tests.aarbology.sh
index a5b224faae6a8ef79213e2e7ad2d0365a0d577b4..c52f164b361e7a3221e455ce42f632a837da76fd 100755
--- a/tests.aarbology.sh
+++ b/tests.aarbology.sh
@@ -59,6 +59,10 @@ function log {
 	echo "$5" >> $LOGFILE
 }
 
+function generateNonlinearPatternSingle {
+	./arand2 -t RNP --nodes $RAND_SIZE_PATTERN --terminals $(( $RANDOM % $RAND_ALPHABET + 1 )) --height $RAND_HEIGHT_PATTERN --single_nonlinear_variable 2>/dev/null
+}
+
 function generateNonlinearPattern {
 	./arand2 -t RNP --nodes $RAND_SIZE_PATTERN --terminals $(( $RANDOM % $RAND_ALPHABET + 1 )) --height $RAND_HEIGHT_PATTERN 2>/dev/null
 }
@@ -353,10 +357,58 @@ function runTestPatternEnds {
 	clearResults
 }
 
+# $1 - aconversions2 sequence
+function runTestNonlinearPatternEnds {
+	echo $1
+	echo -ne "\t"
+
+	initResults
+
+	# predefined tests first
+	for SUBJECT_FILE in `ls $TESTS_DIR/aarbology.test*.subject.xml`; do
+		PATTERN_FILE=${SUBJECT_FILE%.subject.xml}.nonlinear.pattern.xml
+		if [ -f $PATTERN_FILE ]; then
+			SUBJECT_FILE_COPY=$(mktemp)
+			PATTERN_FILE_COPY=$(mktemp)
+
+			cat $SUBJECT_FILE > $SUBJECT_FILE_COPY
+			cat $PATTERN_FILE > $PATTERN_FILE_COPY
+
+			Occs=`./aarbology2 -e -a exactPatternMatch -s <(./acast2 -t PrefixRankedTree -i "$SUBJECT_FILE_COPY" ) -p <(./acast2 -t PrefixRankedNonlinearPattern -i "$PATTERN_FILE_COPY" ) | ./astat2 -p size`
+
+			runTest2 "$Occs" "$2" "$SUBJECT_FILE_COPY" "$PATTERN_FILE_COPY"
+		fi
+	done
+
+	echo -n " | "
+
+	# random tests
+	for i in $(seq 1 $TESTCASE_ITERATIONS );
+	do
+		SUBJECT_FILE=$(mktemp)
+		PATTERN_FILE=$(mktemp)
+
+		cat <(generateSubject) > $SUBJECT_FILE
+		cat <(generateNonlinearPatternSingle) > $PATTERN_FILE
+
+		Occs=`./aarbology2 -e -a exactPatternMatch -s <(./acast2 -t PrefixRankedTree -i "$SUBJECT_FILE" ) -p <(./acast2 -t PrefixRankedNonlinearPattern -i "$PATTERN_FILE" ) | ./astat2 -p size`
+
+		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE" & (( i%JOBS==0 )) && wait
+	done
+
+	wait
+
+	outputResults
+	clearResults
+}
+
 runTestPatternEnds "Exact Pattern Matching Automaton (PrefixRanked)" "./aarbology2 -a exactPatternMatchingAutomaton -p <(./acast2 -t PrefixRankedPattern -i <(./alphabetManip2 -o add -i \"\$PATTERN_FILE\" -a <( ./alphabetManip2 -o get -i \"\$SUBJECT_FILE\" ) ) ) | ./adeterminize2 | ./arun2 -t occurrences -a - -i <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" | ./acast2 -t LinearString ) | ./astat2 -p size"
 
-RAND_SIZE_SUBJECT=100
+RAND_SIZE_SUBJECT=120
 runTestPatternEnds "Exact Tree Pattern Automaton (PrefixRanked)" "./aarbology2 -a exactTreePatternAutomaton -s <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -i \"\$PATTERN_FILE\" ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) | ./astat2 -p size"
+RAND_SIZE_SUBJECT=80
+runTestNonlinearPatternEnds "Exact Nonlinear Tree Pattern Automaton (PrefixRanked)" "./aarbology2 -a exactNonlinearTreePatternAutomaton -s <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -i \"\$PATTERN_FILE\" ) -n <( ./aaccess2 --tree nonlinear_variables -i \"\$PATTERN_FILE\" ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedNonlinearPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) -f <(echo '<LabelSetLabel />') | ./aaccess2 --pairSet first | ./astat2 -p size"
+
 
 RAND_SIZE_SUBJECT=1000
 runTestSubtree "Exact Boyer Moore Horspool (Subtree PrefixRankedBar)" "./aarbology2 -a boyerMooreHorspool -s <( ./acast2 -t PrefixRankedBarTree -i \"\$SUBJECT_FILE\" ) -p <( ./acast2 -t PrefixRankedBarTree -i <(./alphabetManip2 -o add -i \"\$PATTERN_FILE\" -a <(./alphabetManip2 -o get -i \"\$SUBJECT_FILE\"))) | ./astat2 -p size"