aboutsummaryrefslogtreecommitdiffstats
path: root/run-tests.sh
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-05-08 14:52:11 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2012-05-08 14:52:11 +0100
commit8fdab96d486ba52601544c67c38625480ddf7640 (patch)
tree83bd9cd5d0c0f57b54b7dfe4268f76993134cbc4 /run-tests.sh
parent3a941f4ae2213f26118f5cfde03ca793b31ca838 (diff)
downloadfiglet-8fdab96d486ba52601544c67c38625480ddf7640.tar.gz
Imported Upstream version 2.2.4upstream/2.2.4
Diffstat (limited to 'run-tests.sh')
-rwxr-xr-xrun-tests.sh86
1 files changed, 86 insertions, 0 deletions
diff --git a/run-tests.sh b/run-tests.sh
new file mode 100755
index 0000000..7e33405
--- /dev/null
+++ b/run-tests.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+LC_ALL=POSIX
+export LC_ALL
+
+TESTDIR=tests
+OUTPUT=`mktemp`
+LOGFILE=tests.log
+CMD=./figlet
+FONTDIR="$1"
+
+run_test() {
+ test_num=$1
+ test_dsc=$2
+ test_cmd=$3
+
+ echo >> $LOGFILE
+ echo -n "Run test $test_num: ${test_dsc}... " | tee -a $LOGFILE
+ echo >> $LOGFILE
+ echo "Command: $test_cmd" >> $LOGFILE
+ eval "$test_cmd" > "$OUTPUT" 2>> $LOGFILE
+ cmp "$OUTPUT" "tests/res${test_num}.txt" >> $LOGFILE 2>&1
+ if [ $? -eq 0 ]; then
+ echo "pass" | tee -a $LOGFILE
+ else
+ echo "**fail**" | tee -a $LOGFILE
+ result=1
+ fail=`expr $fail + 1`
+ fi
+}
+
+result=0
+fail=0
+$CMD -v > $LOGFILE
+$CMD -f small "Test results" | tee -a $LOGFILE
+
+file="$TESTDIR/input.txt"
+cmd="cat $file|$CMD"
+
+echo -n "Default font dir: "; $CMD -I2
+if [ -n "$FONTDIR" ]; then
+ FIGLET_FONTDIR="$FONTDIR"
+ export FIGLET_FONTDIR
+fi
+echo -n "Current font dir: "; $CMD -I2
+echo -n "Default font: "; $CMD -I3
+echo
+
+run_test 001 "showfigfonts output" "./showfigfonts"
+run_test 002 "text rendering in all fonts" \
+ "for i in fonts/*.flf; do $cmd -f \$i; done"
+run_test 003 "long text rendering" "cat tests/longtext.txt|./figlet"
+run_test 004 "left-to-right text" "$cmd -L"
+run_test 005 "right-to-left text" "$cmd -R"
+run_test 006 "flush-left justification" "$cmd -l"
+run_test 007 "flush-right justification" "$cmd -r"
+run_test 008 "center justification" "$cmd -c"
+run_test 009 "kerning mode" "$cmd -k"
+run_test 010 "full width mode" "$cmd -W"
+run_test 011 "overlap mode" "$cmd -o"
+run_test 012 "tlf2 font rendering" "$cmd -f tests/emboss"
+run_test 013 "kerning flush-left right-to-left mode" "$cmd -klR"
+run_test 014 "kerning centered right-to-left mode (slant)" "$cmd -kcR -f slant"
+run_test 015 "full-width flush-right right-to-left mode" "$cmd -WrR"
+run_test 016 "overlap flush-right mode (big)" "$cmd -or -f big"
+run_test 017 "tlf2 kerning flush-right mode" "$cmd -kr -f tests/emboss"
+run_test 018 "tlf2 overlap centered mode" "$cmd -oc -f tests/emboss"
+run_test 019 "tlf2 full-width flush-left right-to-left mode" \
+ "$cmd -WRl -f tests/emboss"
+run_test 020 "specify font directory" \
+ "X=`mktemp -d`;cp fonts/script.flf \$X/foo.flf;$cmd -d\$X -ffoo;rm -Rf \$X"
+run_test 021 "paragraph mode long line output" "$cmd -p -w250"
+run_test 022 "short line output" "$cmd -w5"
+run_test 023 "kerning paragraph centered mode (small)" "$cmd -kpc -fsmall"
+run_test 024 "list of control files" "ls fonts/*flc"
+
+rm -f "$OUTPUT"
+
+echo
+if [ $result -ne 0 ]; then
+ echo " $fail tests failed. See $LOGFILE for result details"
+else
+ echo " All tests passed."
+fi
+
+exit $result
coration'>debian/0+git20141009.d26b627-1Jonathan McCrohan1-2/+2 2014-10-20Fix up packaging to account for move to DVBv5Jonathan McCrohan2-2/+6 2014-10-20delete d/dtv-scan-files.install; Upstream now supplies a MakefileJonathan McCrohan2-4/+1 2014-10-15d/control: update Standards Version to 3.9.6Jonathan McCrohan2-1/+3 2014-10-15d/control: add Build-Depends on dvb-toolsJonathan McCrohan2-1/+2 2014-10-15New Upstream Snapshot (commit d26b627)Jonathan McCrohan1-0/+10 2014-10-15Imported Upstream version 0+git20141009.d26b627upstream/0+git20141009.d26b627Jonathan McCrohan2010-11120/+159271 2014-07-23Release 0+git20140611.14bd6c7-1debian/0+git20140611.14bd6c7-1Jonathan McCrohan1-2/+2 2014-07-23New Upstream Snapshot (commit 14bd6c7)Jonathan McCrohan1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9