tests: convert "dc" test to new framework
The 'dc.sed' program (implementing dc calculator in sed) is kept as-is. The input (dc.inp) and expected output (dc.good) are merged into the new shell script. The old-style test executed two calculations at once (Easter 2002 and square root of 2). They are now separated into two invocations of 'dc.sed'. * testsuite/dc.sh: New test. * testsuite/dc.inp, testuite/dc.good: Removed. * testsuite/local.mk (EXTRA_DIST): Remove inp/good files. (SEDTEST): Remove dc.sed. (T): Add dc.sh.
This commit is contained in:
1 parent
a968ba77e7
commit
c24b91e768
4 files changed
+68
-23
No files matched your search
@@ -1,3 +0,0 @@
|
||||
31
|
||||
March 2002
|
||||
1.6A09E667A
|
||||
@@ -1,14 +0,0 @@
|
||||
# Compute Easter of 2002...
|
||||
# usage: (echo YEAR; cat easter.dc) | dc
|
||||
|
||||
2002
|
||||
|
||||
[ddsf[lfp[too early
|
||||
]Pq]s@1583>@
|
||||
ddd19%1+sg100/1+d3*4/12-sx8*5+25/5-sz5*4/lx-10-sdlg11*20+lz+lx-30%
|
||||
d[30+]s@0>@d[[1+]s@lg11<@]s@25=@d[1+]s@24=@se44le-d[30+]s@21>@dld+7%-7+
|
||||
[March ]smd[31-[April ]sm]s@31<@psnlmPpsn1z>p]splpx
|
||||
|
||||
# Compute square root of 2
|
||||
|
||||
16oAk2vpq
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Test runner for dc.sed
|
||||
|
||||
# Copyright (C) 2017 Free Software Foundation, Inc.
|
||||
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
|
||||
print_ver_ sed
|
||||
|
||||
fail=0
|
||||
|
||||
|
||||
# Compute Easter of 2002...
|
||||
# usage: (echo YEAR; cat easter.dc) | dc.sed
|
||||
cat << \EOF > easter.dc || framework_failure_
|
||||
[ddsf[lfp[too early
|
||||
]Pq]s@1583>@
|
||||
ddd19%1+sg100/1+d3*4/12-sx8*5+25/5-sz5*4/lx-10-sdlg11*20+lz+lx-30%
|
||||
d[30+]s@0>@d[[1+]s@lg11<@]s@25=@d[1+]s@24=@se44le-d[30+]s@21>@dld+7%-7+
|
||||
[March ]smd[31-[April ]sm]s@31<@psnlmPpsn1z>p]splpx
|
||||
EOF
|
||||
|
||||
cat <<\EOF > easter-exp || framework_failure_
|
||||
31
|
||||
March 2002
|
||||
EOF
|
||||
|
||||
|
||||
# Compute square root of 2
|
||||
cat << \EOF > sqrt2-inp || framework_failure_
|
||||
16oAk2vpq
|
||||
EOF
|
||||
|
||||
|
||||
cat << \EOF > sqrt2-exp || framework_failure_
|
||||
1.6A09E667A
|
||||
EOF
|
||||
|
||||
|
||||
# location of external test files
|
||||
dir="$abs_top_srcdir/testsuite"
|
||||
|
||||
# Easter 2002
|
||||
( echo 2002 ; cat easter.dc ) | sed -n -f "$dir/dc.sed" > easter-out|| fail=1
|
||||
compare easter-exp easter-out || fail=1
|
||||
|
||||
# Square root of 2
|
||||
sed -n -f "$dir/dc.sed" sqrt2-inp > sqrt2-out || fail=1
|
||||
compare sqrt2-exp sqrt2-out || fail=1
|
||||
|
||||
|
||||
|
||||
Exit $fail
|
||||
+3
-6
@@ -86,8 +86,8 @@ endif
|
||||
|
||||
# Old tests converted to newer init.sh style
|
||||
T += testsuite/8bit.sh \
|
||||
testsuite/binary.sh
|
||||
|
||||
testsuite/binary.sh \
|
||||
testsuite/dc.sh
|
||||
|
||||
TESTS = $(check_PROGRAMS) $(SEDTESTS) $(T)
|
||||
|
||||
@@ -120,8 +120,7 @@ SEDTESTS += testsuite/newjis \
|
||||
testsuite/utf8-1 \
|
||||
testsuite/utf8-2 testsuite/utf8-3 testsuite/utf8-4 \
|
||||
testsuite/badenc testsuite/inplace-hold \
|
||||
testsuite/help \
|
||||
testsuite/dc
|
||||
testsuite/help
|
||||
|
||||
# Note that the first lines are statements. They ensure that environment
|
||||
# variables that can perturb tests are unset or set to expected values.
|
||||
@@ -195,8 +194,6 @@ EXTRA_DIST += \
|
||||
testsuite/binary3.sed \
|
||||
testsuite/bsd.good \
|
||||
testsuite/bsd.sh \
|
||||
testsuite/dc.good \
|
||||
testsuite/dc.inp \
|
||||
testsuite/dc.sed \
|
||||
testsuite/distrib.good \
|
||||
testsuite/distrib.inp \
|
||||
|
||||
Reference in new issue
Block a user