#!/bin/sh
###############################################################################
#
# File:         testall
# RCS:          $Header: /home/matthew/cvs/bible-kjv-4.10/testall,v 2.0 2003/01/08 15:29:52 matthew Exp $
# Description:  Test file for Bible software
# Author:       Chip Chapin, Hewlett Packard Company
# Created:      Wed Aug 30 15:42:35 1989
# Modified:     Mon Oct  2 22:32:14 1989 (Chip Chapin) chip@hpcllz2
# Language:     Bourne Shell
# Package:      Bible Retrieval System
# Status:       Experimental (Do Not Distribute)
#
# $Log: testall,v $
# Revision 2.0  2003/01/08 15:29:52  matthew
# versions collected from the net
#
# Revision 1.8  89/10/02  22:41:36  22:41:36  chip (Chip Chapin)
# *** empty log message ***
# 
# Revision 1.7  89/10/02  22:24:45  22:24:45  chip (Chip Chapin)
# Revised to print command string prior to each test.
# New tests for -l bugs, and for blank-line-after-verse-range.
# 
# Revision 1.6  89/09/14  20:34:26  20:34:26  chip (Chip Chapin)
# Release 1-2.  Supports -f and -l options for formatting the output.
# Updates primarily brl.c, bible.c, and bible.1.
# 
# Revision 1.5  89/09/13  21:50:22  21:50:22  chip (Chip Chapin)
# Implement -f and -l options.
# 
# Revision 1.4  89/09/11  17:37:03  17:37:03  chip (Chip Chapin)
# Fix bug in auto-checking.
# 
# Revision 1.3  89/09/08  13:23:44  13:23:44  chip (Chip Chapin)
# Better error checking on verse syntax; automatic test suite.
# 
# Revision 1.2  89/09/08  09:01:44  09:01:44  chip (Chip Chapin)
# Bug fix and simplification: send whole input lines or arguments to BRL,
# and let BRL worry about multiple references.  We don't care.
# 
# Revision 1.1  89/09/05  17:50:00  17:50:00  chip (Chip Chapin)
# Initial revision
# 
#
###############################################################################

P=./bible
T=/tmp/list$$
T2=/tmp/bible.dump$$
trap "/bin/rm -f $T1 $T2; exit" 0 1 3

PROG()
{
	echo "\n$P $*"
	$P $@
}

cat <<-EOF >$T
	ge1:1 ex1:1 lev1:1 num1:1 deut1:1 jos1:1 jdg1:1 ruth1:1 1sa1:1 2sa1:1
	1ki1:1 2ki1:1 1ch1:1 2ch1:1 ezr1:1 neh1:1 est1:1 job1:1 ps1:1 pr1:1
	ecc1:1 so1:1 is1:1 jer1:1 lam1:1 eze1:1 dan1:1 hos1:1 joe1:1 amo1:1 
	ob1:1 jon1:1 mic1:1 nah1:1 hab1:1 zep1:1 hag1:1 zec1:1 mal1:1
	mt1:1 mk1:1 lu1:1 jn1:1 acts1:1 ro1:1 1co1:1 2co1:1 gal1:1 eph1:1
	php1:1 col1:1 1th1:1 2th1:1 1ti1:1 2ti1:1 ti1:1 phm1:1 he1:1
	jas1:1 1pe1:1 2pe1:1 1jn1:1 2jn1:1 3jn1:1 jude1:1 rev1:1
EOF


echo "Basic command tests"
PROG jn3:16
PROG <<-EOF
	jn3:16
	
	
EOF
PROG < $T
PROG -m0 jn3:16
PROG -m 1 jn3:16
PROG -d bible.data -p". /usr/local/lib" jn3:16
PROG -f jn4
PROG -f jn4 jn5
PROG -f -l 66 jn4
PROG -fl66 jn4
PROG -l jn4
PROG -l66 -f jn4
PROG -l66 jn4
PROG -fl jn4
PROG -lf jn4
PROG -l 2peter
PROG -l 2 2peter
PROG -l 1 2peter
PROG -l 10 2peter
PROG -l1 2peter
PROG -l0 2peter
PROG -fl0 2peter

echo "\n\nVerse Reference Syntax tests"
PROG <<-EOF 
	jn3:16,17
	jn 3:16 17
	jn 3:16 17
	jn3-4
	jn-4
	jn-1:4
EOF
echo "\nBad Syntax tests"
PROG <<-EOF	
	jn:
	jn :
EOF

echo "\n\nPretty Printing tests"
PROG -fl66 <<-EOF
	gen
	jn
	gen2
	jn2
	job1-5
	
	
EOF
PROG -f <<-EOF
	jn3
	
	
	2peter1:1-5
	
	
EOF
PROG <<-EOF
	jn3
	
	
	2peter1:1-5
	
	
EOF

echo "\n\nBad command option tests"
echo PROG -m
PROG -m
echo PROG -m foobar
PROG -m foobar
echo PROG -mfoobar
PROG -mfoobar
echo PROG -d
PROG -d
echo PROG -d foobar
PROG -d foobar
echo PROG -dfoobar
PROG -dfoobar
echo PROG -p
PROG -p
echo PROG -p foobar
PROG -p foobar
echo PROG -pfoobar
PROG -pfoobar


# BUFFER tests
# Assumes that the window size on the bible data is 64k
#
echo "\n\nTests with one buffer"
PROG -m1 ge1:1 ps1:1 mt1:1 mt1:1 ge1:1 ps1:1
PROG -m1 <$T

echo "\n\nTests with two buffers"
PROG -m130  ge1:1 ps1:1 mt1:1 mt1:1 ge1:1 ps1:1
PROG -m 130 <$T

echo "\n\nTests with three buffers"
PROG -m 200 ge1:1 ps1:1 mt1:1 mt1:1 ge1:1 ps1:1
PROG -m200 <$T

# dump whole file
echo "\n\nDumping whole bible.  Watch the line count, head and tail"
PROG gen1:1-rev99:99 > $T2
wc    < $T2
head -4 $T2
tail -4 $T2

echo "\n\nTests completed"
exit
#



