#! /bin/sh

torrenttool=../../torrenttool
torrents=../torrents
compare=../tools/compare
verbose=${VERBOSE=0}

curtestdir="$1"
curtestdetail="$2"
torrent="$3"
shift 3

verbosearg=""
[ "$verbose" -ge "2" ] && verbosearg="-v"

cd "$curtestdir"
[ "$verbose" -ge "1" ] && echo "$curtestdir $curtestdetail"
if ! ($torrenttool -v -c "$torrents/$torrent.torrent" | head -n-1 | cut -d' ' -f2- | $compare $verbosearg "$@"); then
  echo "$curtestdir $curtestdetail failed"
fi
