#!/bin/sh
# ---------------------------------------------------------------------------
# TEST-REM
#
# This file runs an acceptance test for Remind.  To use it, type:
#      sh test-rem  OR make test
# in the build directory.
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 David F. Skoll        
# Copyright (C) 1999-2000 Roaring Penguin Software Inc.
# ---------------------------------------------------------------------------

TEST_GETENV="foo bar baz" ; export TEST_GETENV
echo "Test 1" > ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -e -dxte ../tests/test.rem 16 feb 1991 >> ../tests/test.out
echo "" >> ../tests/test.out
echo "Test 2" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
echo "" >> ../tests/test.out
echo "Test 3" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -s ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
echo "" >> ../tests/test.out
echo "Test 4" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -sa ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
echo "Test 5" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -b0 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
echo "Test 6" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -b1 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
echo "Test 7" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -b2 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out

cmp -s ../tests/test.out ../tests/test.cmp
if [ "$?" = "0" ]; then
   echo "Remind:  Acceptance test PASSED"
   exit 0
else
   echo "Remind:  Acceptance test FAILED"
   echo ""
   echo "Examine the file test.out to see where it differs from the"
   echo "reference file test.cmp."
   exit 1
fi
