--- /dev/null
+method m(x)
+ return x-this;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(2,5)==3 && m(7,2)==-5);
--- /dev/null
+method m()
+ return this;
+end;
--- /dev/null
+extern long m(long);
+RET(m(5)==5 && m(9)==9);
--- /dev/null
+method m(x y z)
+ return z;
+end;
--- /dev/null
+extern long m(long,long,long,long);
+RET(m(1,2,3,5)==5 && m(3,2,1,9)==9);
--- /dev/null
+method m(x)
+ return not this;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(0,12)==1 && m(9,13)==0);
--- /dev/null
+method m(x)
+ return -5;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(0,12)==-5 && m(9,13)==-5);
--- /dev/null
+method m(x)
+ return x--3;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(0,12)==15 && m(9,13)==16);
--- /dev/null
+method m(x)
+ return x*this*x*this;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(2,3)==36 && m(5,-7)==35*35);
--- /dev/null
+method m(x)
+ return this or x;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(3,9)==11 && m(6,13)==15);
--- /dev/null
+method m(x)
+ return x<this;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(3,3)==0 && m(3,2)==1 && m(2,3)==0);
--- /dev/null
+method m(x)
+ return -4<x;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(0,-4)==0 && m(9,-3)==1);
--- /dev/null
+method m(x)
+ return this<-9;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(-9,12)==0 && m(-10,13)==1);
--- /dev/null
+method m(x)
+ return 3=x;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(0,3)==1 && m(9,13)==0);
--- /dev/null
+struct a b c end;
+struct d e f end;
+
+method m(x)
+ return e;
+end;
--- /dev/null
+long s[]={12,23,34,45,53,61};
+extern long m(long *,long);
+RET(m(s,12)==23 && m(s+3,13)==53);
--- /dev/null
+struct a b c end;
+struct d e f end;
+
+method m(x)
+ return x.c.d;
+end;
--- /dev/null
+long s[]={12,23,34,45,53,61};
+long *t[]={s,s+2,s+1,s+3};
+extern long m(long,long **);
+RET(m(1,t)==23 && m(9,t+1)==45);
--- /dev/null
+method m(x)
+ return not((not this) or (not x));
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(10,6)==1 && m(0,13)==0 && m(-3,0)==0);
--- /dev/null
+method m(x)
+ return x-(0-this);
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(3,4)==7 && m(-3,5)==2);
--- /dev/null
+method m(x)
+ return 5 or x or 9;
+end;
--- /dev/null
+extern long m(long,long);
+RET(m(3,6)==15 && m(-3,5)==13);
--- /dev/null
+struct a b c end;
+
+method m(x)
+ return (this-4).c;
+end;
--- /dev/null
+long s[]={12,23,34,45,53,61};
+extern long m(long *,long);
+RET(m(s,12)==23 && m(s+2,13)==45);
--- /dev/null
+method m(x y)
+ return y;
+end;
+
+method n(y x)
+ return y;
+end;
--- /dev/null
+extern long m(long,long,long);
+extern long n(long,long,long);
+RET(m(1,2,3)==3 && n(4,5,6)==5);
--- /dev/null
+struct x end;
+
+method m(x)
+ return x;
+end;
--- /dev/null
+long s[]={12,23,34,45,53,61};
+extern long m(long *,long);
+RET(m(s,78)==78 && m(s+2,13)==13);
--- /dev/null
+#! /bin/bash
+
+beispiel=gesamt_arm
+PROGRAM=./$beispiel
+
+errnum=0
+prgnum=0
+
+LOC=~/test/scripts/
+#LOC=/usr/ftp/pub/ubvl/test/$beispiel
+LOC2=~/test/$beispiel
+
+#/usr/ftp/pub/ublu/test/accounttest || exit 1
+allow_null_glob_expansion=1
+
+if [ ! -d ~/abgabe/$beispiel ]; then
+ echo "Fehler: Verzeichnis ~/abgabe/$beispiel existiert nicht."
+ exit 1
+else
+ cd ~/abgabe/$beispiel
+ echo 'Teste "make clean"'
+ make clean
+ #/usr/ftp/pub/ubvl/test/cleantest
+ echo 'Teste "make"'
+ make
+fi
+
+if test ! -x $PROGRAM
+then
+ echo "Fehler: Kein Programm $PROGRAM"
+ exit 1
+fi
+let prgnum=0
+for i in $LOC/*.0 $LOC2/*.0
+do
+ if [ -f $i ]; then
+ let prgnum=prgnum+1
+ let errorfound=0
+ echo "==========> Eingabe von $i:"
+ cat $i
+ echo
+ RESFILE=test${beispiel}out$$
+ $PROGRAM <$i >$RESFILE
+ retval=$?
+ echo -n "Übersetzung: "
+ if test $retval -eq 0
+ then
+ echo "Status korrekt"
+ else
+ echo "[Errot] Status=$retval. Erwartet: 0"
+ let errorfound=1
+ fi
+ echo
+ echo "Ausgabe:"
+ #if [ -f ~/test/scripts/clr.py ]; then
+ # cat $RESFILE | ~/test/scripts/clr.py
+ #else
+ cat $RESFILE
+ #fi
+ mv -f $RESFILE $RESFILE.s
+ CALLFILE=${i%.*}.call
+ echo
+ if [ ! -f $CALLFILE ]; then
+ echo "Fehler: Datei $CALLFILE existiert nicht, kann Code nicht ausführen..."
+ exit 1
+ else
+ echo "Übersetze und linke das Testprogramm:"
+ if cc -g -I. -DCALL=\"$CALLFILE\" $LOC/testmain.c $LOC/callingconvention.o $RESFILE.s; then
+ echo
+ echo "Rufe folgendes Codefragment auf:"
+ cat $CALLFILE
+ echo
+ ./a.out
+ retval=$?
+ # test callee saved registers
+ if [ "$retval" -ge 12 ] && [ "$retval" -le 15 ]; then
+ echo "[Error] Callee-saved register %r$retval modified."
+ let errorfound=1
+ elif [ "$retval" -eq 11 ]; then
+ echo "[Error] Callee-saved register %rbx modified."
+ let errorfound=1
+ elif [ "$retval" -eq 16 ]; then
+ echo "[Error] Callee-saved register %rbp modified."
+ let errorfound=1
+ elif [ "$retval" -eq 30 ]; then
+ echo "[Error] Stack pointer %rsp modified."
+ let errorfound=1
+ else
+ # test signals
+ test $retval -gt 127
+ retsig=$?
+ test ${i##*.} = xin
+ expsig=$?
+ if test $retsig -eq $expsig; then
+ if test $retval -eq 1; then
+ echo "[Error] Das Ergebnis des Aufrufs ist falsch."
+ let errorfound=1
+ elif test $retval -eq 0; then
+ echo "Das Ergebnis des Ausdrucks ist korrekt."
+ else
+ echo "[Error] Erzeugter Code verhaelt sich bzgl. Signalerzeugung anders als erwartet."
+ let errorfound=1
+ fi
+ else
+ echo "[Error] Erzeugter Code verhaelt sich bezueglich Signalerzeugung anders als erwartet."
+ let errorfound=1
+ echo "Rueckgabewert = $retval";
+ fi
+ fi
+ echo
+ else
+ echo "[Error] Erzeugter Code konnte nicht assembliert und gelinkt werden."
+ let errorfound=1
+ fi
+ fi
+ let errnum=errnum+errorfound
+ if [ 1 -eq $errorfound ]; then
+ rm *.s
+ rm *.out
+ exit 3;
+ fi
+ rm -f a.out $RESFILE $RESFILE.s
+ fi
+done
+
+for i in $LOC/*.[123] $LOC2/*.[123]
+do
+ if [ -f $i ]; then
+ let prgnum=prgnum+1
+ echo "==========> Eingabe von $i:"
+ cat $i
+ echo
+ echo "Ausgabe:"
+ $PROGRAM <$i
+ retval=$?
+ if test $retval -eq ${i#*.}
+ then
+ echo "Status: korrekt"
+ else
+ echo "[Error] Status: $retval. Erwartet: ${i#*.}"
+ let errnum=errnum+1
+ exit 3;
+ fi
+ echo
+fi
+done
+let corrnum=prgnum-errnum
+echo "Statistics: "
+echo "==========="
+echo " $prgnum Tests total"
+echo " $corrnum Tests passed"
+echo " $errnum Tests failed"