#!/usr/bin/env sh

frobby=$FROBBY
testhelper=../testScripts/testhelper
test="$1"
shift

if [ "$1" = "_full" ];
then
  shift;

  # Check -canon agrees with transform on output
  $testhelper transform $test.primdecom $test.primdecom -canon
  if [ $? != 0 ]; then exit 1; fi

  # Check that intersection is inverse of primdecom.
  $frobby transform < `ls $test.*test` > $FROBBY_TEST_TMPDIR/$test.test \
    -canon -minimize 2>/dev/null
  $testhelper intersect $test.primdecom $FROBBY_TEST_TMPDIR/$test.test -canon
  if [ $? != 0 ]; then exit 1; fi
  rm $FROBBY_TEST_TMPDIR/$test.test
fi

$testhelper primdecom $test.*test $test.primdecom $* -canon
if [ $? != 0 ]; then exit 1; fi
