Initial revision

git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5099 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
1999-09-26 21:23:21 +00:00
parent b0928da4f8
commit 5d36ad0e9e
59 changed files with 8401 additions and 0 deletions

15
tests/bcd.foo Normal file
View File

@@ -0,0 +1,15 @@
________________________________________________
/FOO |
|] |
| ]] |
| |
|111111111111111111111111111111111111111111111111|
|222222222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|]]]666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|999999999999999999999999999999999999999999999999|
|________________________________________________|

15
tests/bcd.foobar Normal file
View File

@@ -0,0 +1,15 @@
________________________________________________
/FOO BAR |
|] ]] |
| ]] ] |
| |
|11111]111111111111111111111111111111111111111111|
|2222]2222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|]]]666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|999999]99999999999999999999999999999999999999999|
|________________________________________________|

30
tests/bcd.fooxbar Normal file
View File

@@ -0,0 +1,30 @@
________________________________________________
/FOO |
|] |
| ]] |
| |
|111111111111111111111111111111111111111111111111|
|222222222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|]]]666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|999999999999999999999999999999999999999999999999|
|________________________________________________|
________________________________________________
/BAR |
|]] |
| ] |
| |
|1]1111111111111111111111111111111111111111111111|
|]22222222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|666666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|99]999999999999999999999999999999999999999999999|
|________________________________________________|

64
tests/bcd.test Executable file
View File

@@ -0,0 +1,64 @@
#!/bin/sh
# tests/bcd.test - test functionality of bcd.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec bcd bcd/bcd
testno 1
bcd/bcd foo >test.out 2>&1 || failtest
compare test.out tests/bcd.foo
rm -f test.out
testno 2
bcd/bcd "foo bar" >test.out 2>&1 || failtest
compare test.out tests/bcd.foobar
rm -f test.out
testno 3
bcd/bcd >test.out 2>&1 <<EOF || failtest
foo
EOF
compare test.out tests/bcd.foo
rm -f test.out
testno 4
bcd/bcd foo bar >test.out 2>&1 || failtest
compare test.out tests/bcd.fooxbar
rm -f test.out
testno 5
bcd/bcd >test.out 2>&1 <<EOF || failtest
foo
bar
EOF
compare test.out tests/bcd.fooxbar
rm -f test.out

100
tests/caesar.constin Normal file
View File

@@ -0,0 +1,100 @@
Ymj Htsxynyzynts tk ymj Zsnyji Xyfyjx tk Frjwnhf
Uwjfrgqj
Bj, ymj ujtuqj tk ymj Zsnyji Xyfyjx, ns twijw yt ktwr f rtwj ujwkjhy
zsnts, jxyfgqnxm ozxynhj, nsxzwj itrjxynh ywfsvznqnyd, uwtanij ktw ymj
htrrts ijkjsxj, uwtrtyj ymj ljsjwfq bjqkfwj, fsi xjhzwj ymj gqjxxnslx
tk qngjwyd yt tzwxjqajx fsi tzw utxyjwnyd, it twifns fsi jxyfgqnxm
ymnx Htsxynyzynts ktw ymj Zsnyji Xyfyjx tk Frjwnhf.
Fwynhqj N
Xjhynts 1
Fqq qjlnxqfynaj utbjwx mjwjns lwfsyji xmfqq gj ajxyji ns f Htslwjxx tk
ymj Zsnyji Xyfyjx, bmnhm xmfqq htsxnxy tk f Xjsfyj fsi Mtzxj tk
Wjuwjxjsyfynajx.
Xjhynts 2
Ymj Mtzxj tk Wjuwjxjsyfynajx xmfqq gj htrutxji tk rjrgjwx hmtxjs jajwd
xjhtsi djfw gd ymj ujtuqj tk ymj xjajwfq Xyfyjx, fsi ymj jqjhytw ns
jfhm Xyfyj xmfqq mfaj ymj vzfqnknhfyntsx wjvznxnyj ktw jqjhytwx tk ymj
rtxy szrjwtzx gwfshm tk ymj Xyfyj Qjlnxqfyzwj.
St ujwxts xmfqq gj f Wjuwjxjsyfynaj bmt xmfqq sty mfaj fyyfnsji ymj
flj tk ybjsyd-knaj djfwx, fsi gjjs xjajs djfwx f hnynejs tk ymj Zsnyji
Xyfyjx, fsi bmt xmfqq sty, bmjs jqjhyji, gj fs nsmfgnyfsy tk ymfy
Xyfyj ns bmnhm mj xmfqq gj hmtxjs.
Wjuwjxjsyfynajx fsi inwjhy yfcjx xmfqq gj fuutwyntsji frtsl ymj
xjajwfq Xyfyjx bmnhm rfd gj nshqziji bnymns ymnx Zsnts, fhhtwinsl yt
ymjnw wjxujhynaj szrgjwx, bmnhm xmfqq gj ijyjwrnsji gd fiinsl ymj
bmtqj szrgjw tk kwjj ujwxtsx, nshqzinsl ymtxj gtzsi yt xjwanhj ktw f
yjwr tk djfwx, fsi jchqzinsl Nsinfsx sty yfcji, ymwjj-knkymx tk fqq
tymjw ujwxtsx. Ymj fhyzfq jszrjwfynts xmfqq gj rfij bnymns ymwjj
djfwx fkyjw ymj knwxy rjjynsl tk ymj Htslwjxx tk ymj Zsnyji Xyfyjx,
fsi bnymns jajwd xzgxjvzjsy yjwr tk yjs djfwx, ns xzhm rfssjw fx ymjd
xmfqq gd qfb inwjhy. Ymj szrgjw tk Wjuwjxjsyfynajx xmfqq sty jchjji
tsj ktw jajwd ymnwyd ymtzxfsi, gzy jfhm Xyfyj xmfqq mfaj fy qjfxy tsj
Wjuwjxjsyfynaj; fsi zsynq xzhm jszrjwfynts xmfqq gj rfij, ymj Xyfyj tk
Sjb Mfruxmnwj xmfqq gj jsynyqji yt hmttxj ymwjj, Rfxxfhmzxjyyx jnlmy,
Wmtij Nxqfsi fsi Uwtanijshj Uqfsyfyntsx tsj, Htssjhynhzy knaj, Sjb
Dtwp xnc, Sjb Ojwxjd ktzw, Ujssxdqafsnf jnlmy, Ijqfbfwj tsj, Rfwdqfsi
xnc, Anwlnsnf yjs, Stwym Hfwtqnsf knaj, Xtzym Hfwtqnsf knaj, fsi
Ljtwlnf ymwjj.
Bmjs afhfshnjx mfuujs ns ymj wjuwjxjsyfynts kwtr fsd Xyfyj, ymj
Jcjhzynaj Fzymtwnyd ymjwjtk xmfqq nxxzj bwnyx tk jqjhynts yt knqq xzhm
afhfshnjx.
Ymj Mtzxj tk Wjuwjxjsyfynajx xmfqq hmttxj ymjnw Xujfpjw fsi tymjw
tkknhjwx; fsi xmfqq mfaj ymj xtqj utbjw tk nrujfhmrjsy.
Xjhynts 3
Ymj Xjsfyj tk ymj Zsnyji Xyfyjx xmfqq gj htrutxji tk ybt Xjsfytwx kwtr
jfhm Xyfyj, hmtxjs gd ymj Qjlnxqfyzwj ymjwjtk, ktw xnc djfwx; fsi jfhm
Xjsfytw xmfqq mfaj tsj atyj.
Nrrjinfyjqd fkyjw ymjd xmfqq gj fxxjrgqji ns htsxjvzjshj tk ymj knwxy
jqjhynts, ymjd xmfqq gj inaniji fx jvzfqqd fx rfd gj nsyt ymwjj
hqfxxjx. Ymj xjfyx tk ymj Xjsfytwx tk ymj knwxy hqfxx xmfqq gj
afhfyji fy ymj jcunwfynts tk ymj xjhtsi djfw, tk ymj xjhtsi hqfxx fy
ymj jcunwfynts tk ymj ktzwym djfw, fsi tk ymj ymnwi hqfxx fy ymj
jcunwfynts tk ymj xncym djfw, xt ymfy tsj-ymnwi rfd gj hmtxjs jajwd
xjhtsi djfw; fsi nk afhfshnjx mfuujs gd wjxnlsfynts, tw tymjwbnxj,
izwnsl ymj wjhjxx tk ymj Qjlnxqfyzwj tk fsd Xyfyj, ymj Jcjhzynaj
ymjwjtk rfd rfpj yjrutwfwd fuutnsyrjsyx zsynq ymj sjcy rjjynsl tk ymj
Qjlnxqfyzwj, bmnhm xmfqq ymjs knqq xzhm afhfshnjx.
St ujwxts xmfqq gj f Xjsfytw bmt xmfqq sty mfaj fyyfnsji yt ymj flj tk
ymnwyd djfwx, fsi gjjs snsj djfwx f hnynejs tk ymj Zsnyji Xyfyjx, fsi
bmt xmfqq sty, bmjs jqjhyji, gj fs nsmfgnyfsy tk ymfy Xyfyj ktw bmnhm
mj xmfqq gj hmtxjs.
Ymj Anhj-Uwjxnijsy tk ymj Zsnyji Xyfyjx xmfqq gj Uwjxnijsy tk ymj
Xjsfyj, gzy xmfqq mfaj st atyj, zsqjxx ymjd gj jvzfqqd inaniji.
Ymj Xjsfyj xmfqq hmttxj ymjnw tymjw tkknhjwx, fsi fqxt f Uwjxnijsy
_uwt_yjrutwj_, ns ymj fgxjshj tk ymj Anhj Uwjxnijsy, tw bmjs mj xmfqq
jcjwhnxj ymj tkknhj tk ymj Uwjxnijsy tk ymj Zsnyji Xyfyjx.
Ymj Xjsfyj xmfqq mfaj ymj xtqj utbjw yt ywd fqq nrujfhmrjsyx. Bmjs
xnyynsl ktw ymfy uzwutxj, ymjd xmfqq gj ts tfym tw fkknwrfynts. Bmjs
ymj Uwjxnijsy tk ymj Zsnyji Xyfyjx nx ywnji, ymj Hmnjk Ozxynhj xmfqq
uwjxnij: fsi st ujwxts xmfqq gj htsanhyji bnymtzy ymj htshzwwjshj tk
ybt-ymnwix tk ymj rjrgjwx uwjxjsy.
Oziljrjsy ns hfxjx tk nrujfhmrjsy xmfqq sty jcyjsi kzwymjw ymfs yt
wjrtafq kwtr tkknhj, fsi inxvzfqnknhfynts yt mtqi fsi jsotd fsd tkknhj
tk mtstw, ywzxy, tw uwtkny zsijw ymj Zsnyji Xyfyjx: gzy ymj ufwyd
htsanhyji xmfqq sjajwymjqjxx gj qnfgqj fsi xzgojhy yt nsinhyrjsy,
ywnfq, oziljrjsy fsi uzsnxmrjsy, fhhtwinsl yt qfb.

100
tests/caesar.constout Normal file
View File

@@ -0,0 +1,100 @@
The Constitution of the United States of America
Preamble
We, the people of the United States, in order to form a more perfect
union, establish justice, insure domestic tranquility, provide for the
common defense, promote the general welfare, and secure the blessings
of liberty to ourselves and our posterity, do ordain and establish
this Constitution for the United States of America.
Article I
Section 1
All legislative powers herein granted shall be vested in a Congress of
the United States, which shall consist of a Senate and House of
Representatives.
Section 2
The House of Representatives shall be composed of members chosen every
second year by the people of the several States, and the elector in
each State shall have the qualifications requisite for electors of the
most numerous branch of the State Legislature.
No person shall be a Representative who shall not have attained the
age of twenty-five years, and been seven years a citizen of the United
States, and who shall not, when elected, be an inhabitant of that
State in which he shall be chosen.
Representatives and direct taxes shall be apportioned among the
several States which may be included within this Union, according to
their respective numbers, which shall be determined by adding the
whole number of free persons, including those bound to service for a
term of years, and excluding Indians not taxed, three-fifths of all
other persons. The actual enumeration shall be made within three
years after the first meeting of the Congress of the United States,
and within every subsequent term of ten years, in such manner as they
shall by law direct. The number of Representatives shall not exceed
one for every thirty thousand, but each State shall have at least one
Representative; and until such enumeration shall be made, the State of
New Hampshire shall be entitled to choose three, Massachusetts eight,
Rhode Island and Providence Plantations one, Connecticut five, New
York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland
six, Virginia ten, North Carolina five, South Carolina five, and
Georgia three.
When vacancies happen in the representation from any State, the
Executive Authority thereof shall issue writs of election to fill such
vacancies.
The House of Representatives shall choose their Speaker and other
officers; and shall have the sole power of impeachment.
Section 3
The Senate of the United States shall be composed of two Senators from
each State, chosen by the Legislature thereof, for six years; and each
Senator shall have one vote.
Immediately after they shall be assembled in consequence of the first
election, they shall be divided as equally as may be into three
classes. The seats of the Senators of the first class shall be
vacated at the expiration of the second year, of the second class at
the expiration of the fourth year, and of the third class at the
expiration of the sixth year, so that one-third may be chosen every
second year; and if vacancies happen by resignation, or otherwise,
during the recess of the Legislature of any State, the Executive
thereof may make temporary appointments until the next meeting of the
Legislature, which shall then fill such vacancies.
No person shall be a Senator who shall not have attained to the age of
thirty years, and been nine years a citizen of the United States, and
who shall not, when elected, be an inhabitant of that State for which
he shall be chosen.
The Vice-President of the United States shall be President of the
Senate, but shall have no vote, unless they be equally divided.
The Senate shall choose their other officers, and also a President
_pro_tempore_, in the absence of the Vice President, or when he shall
exercise the office of the President of the United States.
The Senate shall have the sole power to try all impeachments. When
sitting for that purpose, they shall be on oath or affirmation. When
the President of the United States is tried, the Chief Justice shall
preside: and no person shall be convicted without the concurrence of
two-thirds of the members present.
Judgement in cases of impeachment shall not extend further than to
removal from office, and disqualification to hold and enjoy any office
of honor, trust, or profit under the United States: but the party
convicted shall nevertheless be liable and subject to indictment,
trial, judgement and punishment, according to law.

44
tests/caesar.test Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
# tests/caesar.test - test functionality of caesar.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec caesar caesar/caesar
testno 1
caesar/caesar <tests/caesar.constin >test.out 2>&1 || failtest
compare test.out tests/caesar.constout
rm -f test.out
testno 2
caesar/caesar 21 <tests/caesar.constin >test.out 2>&1 || failtest
compare test.out tests/caesar.constout
rm -f test.out

55
tests/common Normal file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
# tests/common - common functions for bsd-games testsuite.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# testexec game executable
testexec () {
testgame="$1"
if [ -x "$2" ]; then
true
else
exit 0
fi
}
testno () {
printf "%s" "$testgame test $1... "
}
failtest () {
echo "FAIL"
exit 1
}
compare () {
if cmp -s "$1" "$2"; then
echo "PASS"
else
failtest
fi
}

2
tests/factor.123456 Normal file
View File

@@ -0,0 +1,2 @@
123: 3 41
456: 2 2 2 3 19

1
tests/factor.123456789 Normal file
View File

@@ -0,0 +1 @@
123456789: 3 3 3607 3803

1
tests/factor.987654321 Normal file
View File

@@ -0,0 +1 @@
987654321: 3 3 17 17 379721

57
tests/factor.test Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/sh
# tests/factor.test - test functionality of factor.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec factor factor/factor
testno 1
factor/factor 123456789 >test.out 2>&1 || failtest
compare test.out tests/factor.123456789
rm -f test.out
testno 2
factor/factor 987654321 >test.out 2>&1 || failtest
compare test.out tests/factor.987654321
rm -f test.out
testno 3
factor/factor 123 456 >test.out 2>&1 || failtest
compare test.out tests/factor.123456
rm -f test.out
testno 4
factor/factor <<EOF >test.out 2>&1 || failtest
123
456
EOF
compare test.out tests/factor.123456
rm -f test.out

3
tests/morse.SOS Normal file
View File

@@ -0,0 +1,3 @@
...,
---,
...,

3
tests/morse.foo Normal file
View File

@@ -0,0 +1,3 @@
dit dit daw dit,
daw daw daw,
daw daw daw,

1
tests/morse.sos Normal file
View File

@@ -0,0 +1 @@
sos

52
tests/morse.test Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# morse.test - test functionality of morse.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec morse morse/morse
# morse is somewhat broken and should probably be replaced with the
# OpenBSD version. This limits the tests we can do until we fix it.
testno 1
morse/morse foo >test.out 2>&1 || failtest
compare test.out tests/morse.foo
rm -f test.out
testno 2
morse/morse -s SOS >test.out 2>&1 || failtest
compare test.out tests/morse.SOS
rm -f test.out
testno 3
morse/morse -d <tests/morse.SOS >test.out 2>&1 || failtest
compare test.out tests/morse.sos
rm -f test.out

3
tests/number.-0.1 Normal file
View File

@@ -0,0 +1,3 @@
minus
one.
tenths.

2
tests/number.123456 Normal file
View File

@@ -0,0 +1,2 @@
one hundred twenty-three thousand.
four hundred fifty-six.

3
tests/number.987654321 Normal file
View File

@@ -0,0 +1,3 @@
nine hundred eighty-seven million.
six hundred fifty-four thousand.
three hundred twenty-one.

49
tests/number.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# number.test - test functionality of number.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec number number/number
testno 1
number/number -- -0.1 >test.out 2>&1 || failtest
compare test.out tests/number.-0.1
rm -f test.out
testno 2
number/number 123456 >test.out 2>&1 || failtest
compare test.out tests/number.123456
rm -f test.out
testno 3
number/number -- 987654321 >test.out 2>&1 || failtest
compare test.out tests/number.987654321
rm -f test.out

49
tests/pig.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# pig.test - test functionality of pig.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec pig pig/pig
testno 1
echo "This is a test." |pig/pig >test.out 2>&1 || failtest
compare test.out tests/pig.test1
rm -f test.out
testno 2
echo "Is this a test?" |pig/pig >test.out 2>&1 || failtest
compare test.out tests/pig.test2
rm -f test.out
testno 3
echo "IS THIS A TEST?" |pig/pig >test.out 2>&1 || failtest
compare test.out tests/pig.test3
rm -f test.out

1
tests/pig.test1 Normal file
View File

@@ -0,0 +1 @@
Isthay isway away esttay.

1
tests/pig.test2 Normal file
View File

@@ -0,0 +1 @@
Isway isthay away esttay?

1
tests/pig.test3 Normal file
View File

@@ -0,0 +1 @@
ISWAY ISTHAY AWAY ESTTAY?

1
tests/pom.1998fm1 Normal file
View File

@@ -0,0 +1 @@
Mon 1998 Jan 12 17:00:00 (UTC): The Moon was Full

1
tests/pom.1998fm2 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Nov 4 05:00:00 (UTC): The Moon was Full

1
tests/pom.1998fq1 Normal file
View File

@@ -0,0 +1 @@
Mon 1998 Jan 5 14:00:00 (UTC): The Moon was at the First Quarter

1
tests/pom.1998fq2 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Oct 28 12:00:00 (UTC): The Moon was at the First Quarter

1
tests/pom.1998lq1 Normal file
View File

@@ -0,0 +1 @@
Tue 1998 Jan 20 20:00:00 (UTC): The Moon was at the Last Quarter

1
tests/pom.1998lq2 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Nov 11 00:00:00 (UTC): The Moon was at the Last Quarter

1
tests/pom.1998nm1 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Jan 28 06:00:00 (UTC): The Moon was New

1
tests/pom.1998nm2 Normal file
View File

@@ -0,0 +1 @@
Tue 1998 Oct 20 10:00:00 (UTC): The Moon was New

84
tests/pom.test Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
# pom.test - test functionality of pom.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec pom pom/pom
# Test dates from Astronomical Almanac 1998, rounded to nearest hour.
# Should add dates from other years.
# We should also test the fraction illuminated given by the program, but
# it isn't really accurate enough to do this reliably and the Astronomical
# Almanac only gives these figures to 2 decimal places (like pom) so I don't
# know which are border cases and which are good tests.
export TZ=UTC0
testno 1
pom/pom 1998010514 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fq1
rm -f test.out
testno 2
pom/pom 1998011217 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fm1
rm -f test.out
testno 3
pom/pom 1998012020 >test.out 2>&1 || failtest
compare test.out tests/pom.1998lq1
rm -f test.out
testno 4
pom/pom 1998012806 >test.out 2>&1 || failtest
compare test.out tests/pom.1998nm1
rm -f test.out
testno 5
pom/pom 1998102010 >test.out 2>&1 || failtest
compare test.out tests/pom.1998nm2
rm -f test.out
testno 6
pom/pom 1998102812 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fq2
rm -f test.out
testno 7
pom/pom 1998110405 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fm2
rm -f test.out
testno 8
pom/pom 1998111100 >test.out 2>&1 || failtest
compare test.out tests/pom.1998lq2
rm -f test.out

10
tests/ppt.Foobarnl Normal file
View File

@@ -0,0 +1,10 @@
___________
| o .oo |
| oo o.ooo|
| oo o.ooo|
| o . |
| oo . o |
| oo . o|
| ooo . o |
| o. o |
___________

9
tests/ppt.foobar Normal file
View File

@@ -0,0 +1,9 @@
___________
| oo .oo |
| oo o.ooo|
| oo o.ooo|
| o . |
| oo . o |
| oo . o|
| ooo . o |
___________

49
tests/ppt.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# ppt.test - test functionality of ppt.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec ppt ppt/ppt
testno 1
ppt/ppt "foo bar" >test.out 2>&1 || failtest
compare test.out tests/ppt.foobar
rm -f test.out
testno 2
ppt/ppt foo bar >test.out 2>&1 || failtest
compare test.out tests/ppt.foobar
rm -f test.out
testno 3
echo "Foo bar" |ppt/ppt >test.out 2>&1 || failtest
compare test.out tests/ppt.Foobarnl
rm -f test.out

25
tests/primes.100 Normal file
View File

@@ -0,0 +1,25 @@
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97

24
tests/primes.1e6 Normal file
View File

@@ -0,0 +1,24 @@
1000003
1000033
1000037
1000039
1000081
1000099
1000117
1000121
1000133
1000151
1000159
1000171
1000183
1000187
1000193
1000199
1000211
1000213
1000231
1000249
1000253
1000273
1000289
1000291

16
tests/primes.1e9 Normal file
View File

@@ -0,0 +1,16 @@
1000000007
1000000009
1000000021
1000000033
1000000087
1000000093
1000000097
1000000103
1000000123
1000000181
1000000207
1000000223
1000000241
1000000271
1000000289
1000000297

49
tests/primes.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# primes.test - test functionality of primes.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec primes primes/primes
testno 1
primes/primes 1 100 >test.out 2>&1 || failtest
compare test.out tests/primes.100
rm -f test.out
testno 2
primes/primes 1000000 1000300 >test.out 2>&1 || failtest
compare test.out tests/primes.1e6
rm -f test.out
testno 3
primes/primes 1000000000 1000000300 >test.out 2>&1 || failtest
compare test.out tests/primes.1e9
rm -f test.out

2
tests/rot13.FooBar Normal file
View File

@@ -0,0 +1,2 @@
Sbb
One

1
tests/rot13.foo Normal file
View File

@@ -0,0 +1 @@
sbb

49
tests/rot13.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# rot13.test - test functionality of rot13.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec rot13 caesar/rot13
testno 1
caesar/rot13 >test.out 2>&1 <<EOF || failtest
foo
EOF
compare test.out tests/rot13.foo
rm -f test.out
testno 2
caesar/rot13 >test.out 2>&1 <<EOF || failtest
Foo
Bar
EOF
compare test.out tests/rot13.FooBar
rm -f test.out