You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
4.1 KiB

From ab98e5ea0b2f3949b1c90d93cd6969171cd37562 Mon Sep 17 00:00:00 2001
From: Claudio Matsuoka <cmatsuoka@gmail.com>
Date: Sun, 10 May 2015 16:45:58 -0300
Subject: [PATCH 5/8] Test script cleanup
Auto-increment the test number instead of passing it as a parameter.
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
---
run-tests.sh | 64 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/run-tests.sh b/run-tests.sh
index e6e1e3b..77e613b 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -6,13 +6,15 @@ export LC_ALL
TESTDIR=tests
OUTPUT=.test-output.txt
LOGFILE=tests.log
-CMD=./figlet
+CMD="./figlet"
FONTDIR="$1"
run_test() {
- test_num=$1
- test_dsc=$2
- test_cmd=$3
+ test_dsc=$1
+ test_cmd=$2
+
+ total=`expr $total + 1`
+ test_num=`printf %03d $total`
echo >> $LOGFILE
printf "Run test $test_num: ${test_dsc}... " | tee -a $LOGFILE
@@ -45,35 +47,37 @@ printf "Current font dir: "; $CMD -I2
printf "Default font: "; $CMD -I3
$CMD -f small "Test results" | tee -a $LOGFILE
-run_test 001 "showfigfonts output" "./showfigfonts"
-run_test 002 "text rendering in all fonts" \
+total=0
+
+run_test "showfigfonts output" "./showfigfonts"
+run_test "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" \
+run_test "long text rendering" "cat tests/longtext.txt|$CMD"
+run_test "left-to-right text" "$cmd -L"
+run_test "right-to-left text" "$cmd -R"
+run_test "flush-left justification" "$cmd -l"
+run_test "flush-right justification" "$cmd -r"
+run_test "center justification" "$cmd -c"
+run_test "kerning mode" "$cmd -k"
+run_test "full width mode" "$cmd -W"
+run_test "overlap mode" "$cmd -o"
+run_test "tlf2 font rendering" "$cmd -f tests/emboss"
+run_test "kerning flush-left right-to-left mode" "$cmd -klR"
+run_test "kerning centered right-to-left mode (slant)" "$cmd -kcR -f slant"
+run_test "full-width flush-right right-to-left mode" "$cmd -WrR"
+run_test "overlap flush-right mode (big)" "$cmd -or -f big"
+run_test "tlf2 kerning flush-right mode" "$cmd -kr -f tests/emboss"
+run_test "tlf2 overlap centered mode" "$cmd -oc -f tests/emboss"
+run_test "tlf2 full-width flush-left right-to-left mode" \
"$cmd -WRl -f tests/emboss"
-run_test 020 "specify font directory" \
+run_test "specify font directory" \
"X=.t;mkdir \$X;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"
-run_test 025 "uskata control file" "printf 'ABCDE'|$CMD -fbanner -Cuskata"
-run_test 026 "jis0201 control file" "printf '\261\262\263\264\265'|$CMD -fbanner -Cjis0201"
+run_test "paragraph mode long line output" "$cmd -p -w250"
+run_test "short line output" "$cmd -w5"
+run_test "kerning paragraph centered mode (small)" "$cmd -kpc -fsmall"
+run_test "list of control files" "ls fonts/*flc"
+run_test "uskata control file" "printf 'ABCDE'|$CMD -fbanner -Cuskata"
+run_test "jis0201 control file" "printf '\261\262\263\264\265'|$CMD -fbanner -Cjis0201"
rm -f "$OUTPUT"
--
2.5.0