#!/bin/sh

# Test the walk_rtree.c code.
#

#error: wanted
#got tgt list:
check='echo Running walk_rtree test $1 $2 ... ; ans=`./t_walk_rtree $1 $2 | sed -e s,krbtgt/,,g`; ans=`echo $ans`; echo Got TGT list: "$ans" ; if test "$3" != "$ans" ; then err=1; echo ERROR: wanted "$3"; fi; echo ""'

err=0

set ATHENA.MIT.EDU HACK.EXAMPLE.COM "ATHENA.MIT.EDU@ATHENA.MIT.EDU MIT.EDU@ATHENA.MIT.EDU EDU@MIT.EDU COM@EDU EXAMPLE.COM@COM HACK.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set ATHENA.MIT.EDU CSAIL.MIT.EDU "ATHENA.MIT.EDU@ATHENA.MIT.EDU MIT.EDU@ATHENA.MIT.EDU CSAIL.MIT.EDU@MIT.EDU"
eval $check

set FOO.EXAMPLE.COM BAR.EXAMPLE.COM "FOO.EXAMPLE.COM@FOO.EXAMPLE.COM EXAMPLE.COM@FOO.EXAMPLE.COM BAR.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set FOZ.EXAMPLE.COM BAZ.EXAMPLE.COM "FOZ.EXAMPLE.COM@FOZ.EXAMPLE.COM EXAMPLE.COM@FOZ.EXAMPLE.COM BAZ.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set FOZ.EXAMPLE.COM BOZ.EXAMPLE.COM "FOZ.EXAMPLE.COM@FOZ.EXAMPLE.COM EXAMPLE.COM@FOZ.EXAMPLE.COM BOZ.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set FOZ.EXAMPLE.COM OZ.EXAMPLE.COM "FOZ.EXAMPLE.COM@FOZ.EXAMPLE.COM EXAMPLE.COM@FOZ.EXAMPLE.COM OZ.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set OZ.EXAMPLE.COM FOZ.EXAMPLE.COM "OZ.EXAMPLE.COM@OZ.EXAMPLE.COM EXAMPLE.COM@OZ.EXAMPLE.COM FOZ.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set A.FOZ.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.COM@EXAMPLE.COM A.FOZ.EXAMPLE.COM@FOZ.EXAMPLE.COM"
eval $check

#set EXAMPLE.COM EXAMPLE.COM "EXAMPLE.COM@EXAMPLE.COM"
set EXAMPLE.COM EXAMPLE.COM ""
echo Next test should return a cannot-find-ticket error...
eval $check

set A.B B.B "A.B@A.B B@A.B B.B@B"
eval $check

set AB.B B.B "AB.B@AB.B B@AB.B B.B@B"
eval $check

set A.B BA.B "A.B@A.B B@A.B BA.B@B"
eval $check

set EXAMPLE.COM A.EXAMPLE.COM "EXAMPLE.COM@EXAMPLE.COM A.EXAMPLE.COM@EXAMPLE.COM"
eval $check

set A.EXAMPLE.COM EXAMPLE.COM "A.EXAMPLE.COM@A.EXAMPLE.COM EXAMPLE.COM@A.EXAMPLE.COM"
eval $check

echo CAPATH test
set ATHENA.MIT.EDU KERBEROS.COM "ATHENA.MIT.EDU@ATHENA.MIT.EDU KERBEROS.COM@ATHENA.MIT.EDU"
eval $check

echo CAPATH test
set LCS.MIT.EDU KABLOOEY.KERBEROS.COM "LCS.MIT.EDU@LCS.MIT.EDU ATHENA.MIT.EDU@LCS.MIT.EDU KERBEROS.COM@ATHENA.MIT.EDU KABLOOEY.KERBEROS.COM@KERBEROS.COM"
eval $check

exit $err
