initial checkin

This commit is contained in:
mes5k 2003-04-03 17:56:08 +00:00
parent ea987fad7a
commit 052681e0f0
35 changed files with 808 additions and 0 deletions

37
tests/Makefile.am Normal file
View File

@ -0,0 +1,37 @@
TESTS = test1.sh \
test2.sh \
test3.sh \
test4.sh \
test5.sh \
test6.sh \
test7.sh \
test8.sh \
test9.sh \
test10.sh \
test11.sh \
test12.sh \
test13.sh \
test14.sh \
test15.sh \
test16.sh
EXTRA_DIST = $(TESTS) \
test1.out \
test2.out \
test3.out \
test4.out \
test5.out \
test6.out \
test7.out \
test8.out \
test9.out \
test10.out \
test11.out \
test12.out \
test13.out \
test14.out \
test15.out \
test16.out

282
tests/Makefile.in Normal file
View File

@ -0,0 +1,282 @@
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
AMTAR = @AMTAR@
AWK = @AWK@
CXX = @CXX@
DEPDIR = @DEPDIR@
DOXYGEN = @DOXYGEN@
EXEEXT = @EXEEXT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
TESTS = test1.sh \
test2.sh \
test3.sh \
test4.sh \
test5.sh \
test6.sh \
test7.sh \
test8.sh \
test9.sh \
test10.sh \
test11.sh \
test12.sh \
test13.sh \
test14.sh \
test15.sh \
test16.sh
EXTRA_DIST = $(TESTS) \
test1.out \
test2.out \
test3.out \
test4.out \
test5.out \
test6.out \
test7.out \
test8.out \
test9.out \
test10.out \
test11.out \
test12.out \
test13.out \
test14.out \
test15.out \
test16.out
subdir = tests
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tests/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
uninstall-info-am:
tags: TAGS
TAGS:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
fi
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pR $$d/$$file $(distdir) \
|| exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-TESTS check-am clean clean-generic \
distclean distclean-generic distdir dvi dvi-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

11
tests/genOut.pl Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/perl
#
# Simple perl script to generate the expected output of test scripts.
# This should never really be run.
# If you do run it, make sure the output conforms to what you expect.
#
for ( $i = 1; $i <= $ARGV[0]; $i++ )
{
system "test$i.sh; mv tmp.out test$i.out";
}

1
tests/test1.out Normal file
View File

@ -0,0 +1 @@
My name is MIKE

10
tests/test1.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test1 -u -n mike > tmp.out 2>&1
if cmp -s tmp.out test1.out; then
exit 0
else
exit 1
fi

47
tests/test10.out Normal file
View File

@ -0,0 +1,47 @@
PARSE ERROR: for argument: undefined
One or more required arguments missing!
USAGE:
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
Where:
-f <float>, --floatTest <float>
(value required) float test
-i <int>, --intTest <int>
(required) (value required) integer test
-s <string>, --stringTest <string>
(required) (value required) string test
-A, --existTestA
tests for the existence of A
-C, --existTestC
tests for the existence of C
-B, --existTestB
tests for the existence of B
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
<string>
(required) (value required) unlabeld test
<string> (accepted multiple times)
(value required) file names
this is a message

10
tests/test10.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s hello > tmp.out 2>&1
if cmp -s tmp.out test10.out; then
exit 0
else
exit 1
fi

47
tests/test11.out Normal file
View File

@ -0,0 +1,47 @@
PARSE ERROR: for argument: -i (--intTest)
Argument already set!
USAGE:
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
Where:
-f <float>, --floatTest <float>
(value required) float test
-i <int>, --intTest <int>
(required) (value required) integer test
-s <string>, --stringTest <string>
(required) (value required) string test
-A, --existTestA
tests for the existence of A
-C, --existTestC
tests for the existence of C
-B, --existTestB
tests for the existence of B
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
<string>
(required) (value required) unlabeld test
<string> (accepted multiple times)
(value required) file names
this is a message

10
tests/test11.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s hello -i 9 > tmp.out 2>&1
if cmp -s tmp.out test11.out; then
exit 0
else
exit 1
fi

47
tests/test12.out Normal file
View File

@ -0,0 +1,47 @@
PARSE ERROR: for argument: -f (--floatTest)
Couldn't read argument value!
USAGE:
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
Where:
-f <float>, --floatTest <float>
(value required) float test
-i <int>, --intTest <int>
(required) (value required) integer test
-s <string>, --stringTest <string>
(required) (value required) string test
-A, --existTestA
tests for the existence of A
-C, --existTestC
tests for the existence of C
-B, --existTestB
tests for the existence of B
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
<string>
(required) (value required) unlabeld test
<string> (accepted multiple times)
(value required) file names
this is a message

10
tests/test12.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s hello -f nine > tmp.out 2>&1
if cmp -s tmp.out test12.out; then
exit 0
else
exit 1
fi

11
tests/test13.out Normal file
View File

@ -0,0 +1,11 @@
[-i] 0 9
[-i] 1 8
[ ] 0 marge
[ ] 1 bart
for float we got : 0
for int we got : 0
for string we got : bill
for ulabeled we got : homer
for bool A we got : 0
for bool B we got : 1
for bool C we got : 0

10
tests/test13.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test3 -s bill -i 9 -i 8 -B homer marge bart > tmp.out 2>&1
if cmp -s tmp.out test13.out; then
exit 0
else
exit 1
fi

11
tests/test14.out Normal file
View File

@ -0,0 +1,11 @@
[ ] 0 marge
[ ] 1 bart
[ ] 2 one
[ ] 3 two
for float we got : 0
for int we got : 0
for string we got : aaa
for ulabeled we got : homer
for bool A we got : 0
for bool B we got : 0
for bool C we got : 0

10
tests/test14.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test3 -s aaa homer marge bart -- one two > tmp.out 2>&1
if cmp -s tmp.out test14.out; then
exit 0
else
exit 1
fi

11
tests/test15.out Normal file
View File

@ -0,0 +1,11 @@
[ ] 0 marge
[ ] 1 bart
[ ] 2 -hv
[ ] 3 two
for float we got : 0
for int we got : 0
for string we got : bbb
for ulabeled we got : homer
for bool A we got : 0
for bool B we got : 0
for bool C we got : 0

11
tests/test15.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
../examples/test3 -s bbb homer marge bart -- -hv two > tmp.out 2>&1
if cmp -s tmp.out test15.out; then
exit 0
else
exit 1
fi

38
tests/test16.out Normal file
View File

@ -0,0 +1,38 @@
PARSE ERROR: for argument: -B (--existTest B)
Argument already set!
USAGE:
../examples/test3 [-i <int>] ... -s <string> [-B] [--] [-v] [-h] <string> <fileNameString> ...
Where:
-i <int>, --intTest <int> (accepted multiple times)
(value required) multi int test
-s <string>, --stringTest <string>
(required) (value required) string test
-B, --existTest B
exist Test B
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
<string>
(required) (value required) unlabeld test
<fileNameString> (accepted multiple times)
(value required) file names
this is a message

10
tests/test16.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test3 -s one homer -B -Bh > tmp.out 2>&1
if cmp -s tmp.out test16.out; then
exit 0
else
exit 1
fi

1
tests/test2.out Normal file
View File

@ -0,0 +1 @@
My name is mike

10
tests/test2.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test1 -n mike > tmp.out 2>&1
if cmp -s tmp.out test2.out; then
exit 0
else
exit 1
fi

1
tests/test3.out Normal file
View File

@ -0,0 +1 @@
My name is MIKE

10
tests/test3.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test1 -n mike -u > tmp.out 2>&1
if cmp -s tmp.out test3.out; then
exit 0
else
exit 1
fi

29
tests/test4.out Normal file
View File

@ -0,0 +1,29 @@
PARSE ERROR: for argument: undefined
One or more required arguments missing!
USAGE:
../examples/test1 [-u] -n <string> [--] [-v] [-h]
Where:
-u, --upperCase
Print in upper case
-n <string>, --name <string>
(required) (value required) Name to print
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
Command description message

10
tests/test4.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test1 > tmp.out 2>&1
if cmp -s tmp.out test4.out; then
exit 0
else
exit 1
fi

9
tests/test5.out Normal file
View File

@ -0,0 +1,9 @@
0 bart
1 lisa
for float we got : 3.7
for int we got : 10
for string we got : homer
for ulabeled we got : marge
for bool A we got : 0
for bool B we got : 0
for bool C we got : 0

10
tests/test5.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s homer marge bart lisa > tmp.out 2>&1
if cmp -s tmp.out test5.out; then
exit 0
else
exit 1
fi

7
tests/test6.out Normal file
View File

@ -0,0 +1,7 @@
for float we got : 3.7
for int we got : 10
for string we got : hello
for ulabeled we got : goodbye
for bool A we got : 1
for bool B we got : 1
for bool C we got : 1

10
tests/test6.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s hello goodbye -ABC > tmp.out 2>&1
if cmp -s tmp.out test6.out; then
exit 0
else
exit 1
fi

44
tests/test7.out Normal file
View File

@ -0,0 +1,44 @@
USAGE:
../examples/test2 [-f <float>] -i <int> -s <string> [-A] [-C] [-B] [--] [-v] [-h] <string> <string> ...
Where:
-f <float>, --floatTest <float>
(value required) float test
-i <int>, --intTest <int>
(required) (value required) integer test
-s <string>, --stringTest <string>
(required) (value required) string test
-A, --existTestA
tests for the existence of A
-C, --existTestC
tests for the existence of C
-B, --existTestB
tests for the existence of B
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
<string>
(required) (value required) unlabeld test
<string> (accepted multiple times)
(value required) file names
this is a message

10
tests/test7.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s hello goodbye -hABC > tmp.out 2>&1
if cmp -s tmp.out test7.out; then
exit 0
else
exit 1
fi

3
tests/test8.out Normal file
View File

@ -0,0 +1,3 @@
../examples/test2 version: 0.99

10
tests/test8.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -v > tmp.out 2>&1
if cmp -s tmp.out test8.out; then
exit 0
else
exit 1
fi

10
tests/test9.out Normal file
View File

@ -0,0 +1,10 @@
0 -hv
1 one
2 two
for float we got : 3.7
for int we got : 10
for string we got : hello
for ulabeled we got : goodbye
for bool A we got : 0
for bool B we got : 0
for bool C we got : 0

10
tests/test9.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
../examples/test2 -i 10 -s hello goodbye -- -hv one two > tmp.out 2>&1
if cmp -s tmp.out test9.out; then
exit 0
else
exit 1
fi