#!/bin/bash
# testvcalone - run vcalone on each .t input sample and compare to .t.out output sample
# (c) 2005 Tero Karvinen # GNU General Public License GPL

# Requires: vcalone, bash, perl

# ChangeLog:
# 2005-09-30t1208	Copied testvcal 0.3alpha to vcalone-testkit/program/. Testvcalone
#			version number allways equals version number of current vcalone. 
# 2005-09-30		Inital version of testvcalone shell script
# 2005-09-29		Planned testkit, created sample files from Nokia 6820 and korganizer. 
#

testdir()	# show diffs for all test files in dir
{
	DIR="$1";
	PRIO=`echo "$DIR" |perl -pe 's/.*\/(\d+)\/*$/$1/'`
	OPWD="`pwd`";
	cd "$DIR";
	
	for F in *.t
	do
		echo "=== correct output left		== $PRIO/$F ==		vcalone prints right ===";
		vcalone $F|diff $DIFFOPT "$F.out" - ;
	done
	cd "$OPWD";
}

### main

#echo "testvcalone - show diff between produced and correct output of vcalone" 
# Should have only one one-line explanation, this or the one on line 2
#echo "(c) 2005 Tero Karvinen. http://iki.fi/karvinen/vcalone"
DIFFOPT="--side-by-side --ignore-blank-lines";
DIFFOPT="$DIFFOPT --suppress-common-lines";
#echo "Using diff $DIFFOPT";

TPREF=$HOME/Code/vcalone/vcalone-testkit/;
echo $0;
for D in $TPREF/1 $TPREF/2 $TPREF/3	# dir 1 contains high priority test cases
do
	testdir "$D";
done

#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
#    See also:
#    http://www.gnu.org/licenses/gpl.html

### end of testvcalone # (c) Tero Karvinen http://iki.fi/karvinen/vcalone

