diff options
Diffstat (limited to 'contrib/libg++/libg++/tests')
79 files changed, 0 insertions, 8357 deletions
diff --git a/contrib/libg++/libg++/tests/ChangeLog b/contrib/libg++/libg++/tests/ChangeLog deleted file mode 100644 index de6d9d79821c4..0000000000000 --- a/contrib/libg++/libg++/tests/ChangeLog +++ /dev/null @@ -1,346 +0,0 @@ -Wed Feb 28 13:42:46 1996 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.sh: Remove tCurses rules. - -Wed Jan 24 18:27:16 1996 Brendan Kehoe <brendan@lisa.cygnus.com> - - * Makefile.sh (TSRCS): Take out tCurses.cc. - (TOUTS): Remove tCurses. - (tests): Take off tCurses and the message about running tCurses. - -Wed Nov 15 20:27:22 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * Makefile.sh (tCurses): New rule to only link dynamically if we - have a shared curses library. - (LIB_FOR_tCurses): Delete. Take tCurses out of the for loop. - -Fri Sep 1 16:56:27 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * tBitString.cc, tBitString.exp: Added test for operator +=, - from Curtis A. Snyder <C1S@icf.hrb.com>. - -Mon Aug 21 11:45:25 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * configure.in (srctrigger): Use tObstack.cc instead of tComplex.cc. - - * Makefile.sh: Forget tComplex. - * tComplex.*: Remove. - -Sun Jun 11 12:22:21 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * test_h.cc: Don't include <memory.h>. - -Fri May 5 13:04:17 1995 Mike Stump <mrs@cygnus.com> - - * Move `for' decl out of `for' statement. - -Fri Jan 20 00:19:57 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * test_h.cc: No longer include complex.h. - -Wed Dec 14 18:49:12 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * tQueue.cc (test_resize), tQueue.inp: New test case from - Jocelyn Serot <jserot@alize.univ-bpclermont.fr>. - -Tue Dec 13 15:47:36 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * tiLList.cc (main): Add explicit variable to avoid warning - on passing non-lvalue by reference. - -Sat Nov 5 19:13:38 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.sh: Don't display the 'echo' command. - - * Makefile.in (LIBS): Remove. - -Sat Nov 5 14:29:00 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * tRational.cc (M_PI): #define it if it isn't defined. - - * tiLList.cc: Added new test from Magnus Nordborg. - * tiLList.exp: New file. - * Makefile.sh (check-tiLList): Merge with check-${TEST}. - -Mon Oct 24 16:03:14 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.sh: Re-arrange so tFix* tCurses etc don't need LIBTEST. - -Thu Sep 29 03:23:24 1994 Philippe De Muyter (phdm@info.ucl.ac.be) - - * test_h.cc: do not include 3 times <fcntl.h>, some systems - do not like that. Include <sys/wait.h> only if _G_HAVE_SYS_WAIT - -Mon Sep 5 13:07:01 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * test_h.cc: Remove #include <regex.h>. - -Thu Sep 1 17:35:33 1994 Jason Merrill (jason@deneb.cygnus.com) - - * tObstack.cc (main): Make output independent of size of pointers. - * tObstack.exp: Update accordingly. - -Fri Aug 12 17:36:44 1994 Brendan Kehoe (brendan@lisa.cygnus.com) - - * tFix24.cc (check): Add unsigned int version. - -Tue Jun 28 03:07:03 1994 Jason Merrill (jason@deneb.cygnus.com) - - * tFix.cc: Adjust to new organization of Fix class (overflow - handlers are now static members). - -Mon Jun 27 18:37:05 1994 Jason Merrill (jason@deneb.cygnus.com) - - * tVec.cc (print): Take parm by value. - - * tBitString.cc (accumtest): Make parms const refs. - -Wed Jun 15 11:04:47 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tString.cc (utiltest), tString.exp: Add a test to capitalize - a string with a bunch of apostrophes and single quotes. - -Wed Jun 1 13:59:53 1994 Jason Merrill (jason@deneb.cygnus.com) - - * tiLList.cc: Explicitly instantiate [SD]L{Node,List}<int>. - -Wed May 25 15:42:21 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.sh: Fixes so that you don't need to build libtest.a - for tests that don't need it. - -Fri May 13 16:49:13 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tCurses.cc: Check _G_HAVE_CURSES, so we can compile - (though not do anything useful) if curses.h is missing. - -Wed May 11 00:40:43 1994 Jason Merrill (jason@deneb.cygnus.com) - - Make libg++ build with gcc -ansi -pedantic-errors - * tRational.cc: Wrap use of <? and >? in #ifndef __STRICT_ANSI__ - * tBitSet.cc: Returns void. - -Thu Feb 10 16:44:04 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * tBitSet.cc (test4), tBitSet.exp: Add a new test. - -Sat Dec 4 16:14:38 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * test_h.cc: Remove #include <sys/socket.h> and <sys/resource.h>. - They're included by <osfcn.h>, and the multiple inclusion - loses on some systems (e.g. Ultrix). Also, don't #include - <sys/param.h>, as it's non-Posix. - -Wed Nov 24 12:41:07 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * test_h.cc: Include limits.h rather than values.h. - -Mon Oct 11 15:16:52 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * tSet.exp: Change VOHSet output to match new code. - -Wed Sep 15 14:46:40 1993 Mike Stump (mrs@cygnus.com) - - * Makefile.sh (LIB_FOR_tInteger): Add -lm for tInteger. - -Thu Aug 26 18:05:20 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * tInteger.cc (iotest), tInteger.inp, tInteger.exp: - Test a couple of more things. - -Thu Aug 19 21:41:40 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * configure.in (CXXINCLUDES): Remove line - not needed. - -Thu Aug 19 12:44:14 1993 Mike Stump (mrs@cygnus.com) - - * configure.in (CXXINCLUDES): Add -I../../libio so that make check - works when srcdir != objdir. - -Sat Jul 24 17:50:52 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * tComplex.cc: Add #include <builtin.h>, for abs(double). - -Tue Jun 1 17:02:12 1993 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.sh: Take out tFile, since it depends on GNU iostream. - * tInteger.cc (main), tInteger.exp: Add test for setbit/clearbit. - * tRational.cc (pitest): Only test >? and <? if g++. - * tRational.cc (simpletest), tRational.exp: New test. - * tString.cc (splittest): Cast 0 to (char*), to avoid ambiguity. - * tFix.cc (checkb), tFix16.cc (check), tFix24.cc (check): - New overloaded functions, to avoid ambiguities. - * tFix.cc (main): Explicitly call Integer::as_double(). - * tBag.cc, tBitSet.cc, tBitString.cc, tDeque.cc, tFix.cc, tFix16.cc, - tFix24.cc, tInteger.cc, tMap.cc, tObstack.cc, tPQ.cc, tQueue.cc, - tRational.cc, tSet.cc, tStack.cc, tVec.cc: Make sure main() return 0. - * test_h.cc: Don't include GNU-iostream specific files unless - we're using GNU iostream. - -Fri May 21 12:57:37 1993 Per Bothner (bothner@deneb.cygnus.com) - - * configure.in: Define TOLIBGXX. - * tiLList.cc, tList.cc: #include <iostream.h>, not old <stream.h>. - -Tue Apr 27 13:53:46 1993 Per Bothner (bothner@cygnus.com) - - * Makefile.in: Removed bogus re-definition of WRAP_C_INCLUDES/ - * tString.cc, tFile.cc, tComplex, tRandom.cc (main): Return 0. - -Mon Apr 19 01:30:01 1993 Per Bothner (bothner@cygnus.com) - - * Makefile.in, configure.in: Re-vamped configure scheme. - * Makefile.sh: New shell scipt, used at configure time. - This generates the repetitive rules of the Makefile. - * tBitSet.cc, tBitString.cc: Prefer new "standardized" - method names prev() instead of previous(). - -Thu Jan 21 18:27:27 1993 Per Bothner (bothner@cygnus.com) - - * tFix.cc: Remove obsolete 'overload' declarations. - -Mon Jan 18 16:49:19 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * tString.cc: Include stream.h for dec(int) support. - -Sun Nov 1 14:44:13 1992 Per Bothner (bothner@cygnus.com) - - * tInteger.cc (modtest): New function, from a bug report. - * tInteger.exp: New output. - -Fri Oct 16 15:33:11 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Remove some obsolete junk. - -Fri Sep 25 11:32:47 1992 Per Bothner (bothner@rtl.cygnus.com) - - * tiLList.cc: New files (derived from tList.cc) to - check template-based versions of SLList and DLList. - * Makefile.in: Use tiLList.cc. - -Mon Aug 10 15:11:42 1992 Per Bothner (bothner@cygnus.com) - - * Makefile.in (make-tests): New rule to build all the - tests without running them (useful when ross-compiling.) - * tSet.cc (main): Rename argc <-> argv. - * tSet.exp, tBag.exp, tMap.exp: Update to handle new hashing - policy for <int>VH{Set,Bag,Map} classes. - -Mon Jul 20 15:45:29 1992 Mike Stump (mrs@cygnus.com) - - * tObstack.cc (main): Add cast from void * to char since it is - not a standard conversion. - -Fri Jun 26 11:46:53 1992 Per Bothner (bothner@rtl.cygnus.com) - - * tRational.cc: Use the slightly more standard M_PI - instead of plain PI. - -Wed Jun 17 16:50:45 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Fix *clean rules. Add $(LDFLAGS) when linking. - Remove the '-' error suppressing prefix so that failing - checks cause the make to fail. - Clean out the remnants of the obsolete runtests rule. - * out.iostream, out.old-stream: Removed - no longer used. - * test_h.cc: Don't #include <bstring.h> - it is non-standard. - -Thu May 14 15:08:37 1992 Per Bothner (bothner@rtl.cygnus.com) - - * test_h.cc: Only #include sys/socket.h and sys/resource.h - if these are available (according to _G_config.h). - -Fri May 8 15:41:12 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Pass $(NOSTDINC) to compiler. - -Thu May 7 00:48:11 1992 Per Bothner (bothner@rtl.cygnus.com) - - * tList.cc (randseq): Evaluate 1st parameter of recursive - call to randeq() first (separately). (Unspecified order of - parameter evaluation was why the sun3 and sun4 versions - gave different results.) - -Wed May 6 01:10:58 1992 Per Bothner (bothner@rtl.cygnus.com) - - * tList.cc: For randseq(), use a dumb but portable - "random" number generator. (For unknown reason, the - old code gave different result on sun3 and sun4.) - * tList.exp: New output. - * Makefile.in: Don't run 'check-tRandom' as part of - 'check', because it isn't portable (byte-order problems?). - - * iostream.out: Split into multiple files, moving the - tFile output into tFile.exp, etc. - * Makefile.in: Add lots of new rules for check-tFile, - check-tObstack etc. THese run an individual test, - and compare the output to the matching *.exp file. - This makes it easier to track down problems, and - adds flexibility by making it easier to add or remove tests. - * test_h.cc: Don't include bool.h, which is deprecated - because it is likely to conflict with other header files. - -Fri Apr 17 14:48:26 1992 Per Bothner (bothner@cygnus.com) - - * tPQ.cc: Update delete of array to modern syntax. - * test_h.cc: #include _G_config.h. - Only #include <sys/resource.h> if not SYSV. - -Tue Mar 10 18:16:28 1992 Per Bothner (bothner@cygnus.com) - - * tests_h.cc: Include sys/time.h before sys/resource.h, - according to traditional requirement. - -Fri Mar 6 15:11:36 1992 Per Bothner (bothner@cygnus.com) - - * tests_h.cc: Don't include malloc.h, since it is - not a standard include file. - -Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in, configure.in: removed traces of namesubdir, - -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced - copyrights to '92, changed some from Cygnus to FSF. - -Fri Jan 31 17:07:30 1992 Per Bothner (bothner at cygnus.com) - - * Makefile.in: Add $(LSRCS) (the generated source files) - to DEPEND_SOURCES. (Otherwise, make fails to generate - some of the i*.h include files.) - - * Makefile.in: Add i{CH,Splay}Node.{cc,h,o} (because - CHNode and SplayNode have been moved into their own - include files). - * out.iostream: Change to match real output (now that - all discrepancies from old output are explained). - -Sat Jan 25 00:32:45 1992 Per Bothner (bothner at cygnus.com) - - * Makefile.in: Replace libtest.a by LIBTEST macro. - * out.iostream: "Fix". - * tFile.cc: New iostream class and classes derived from - it allow us to support much more of the fucntionality - of the old library. - -Thu Jan 16 18:00:04 1992 Per Bothner (bothner at cygnus.com) - - * expected.out, out_iostream, out.old_stream, Makefile.in: - Replace expected.out by two versions: One when using new - iostreams, and one for old streams. - * Makefile.in: Some tweaks to 'make depend.' - * tFix16.cc, tFix24.cc: Replace check macro by overloaded - inline functions. This forces side effects (including - error messages) when evaluating the operands to happen - before printing. - * tFile.cc: Comditionally compile depending on - _OLD_STREAMS macro (defined by stream.h) so that most - tests work for both new iostreams as well as old streams. - * test_h.cc: Remove obsolete include files. - -Sun Jan 5 00:03:06 1992 Per Bothner (bothner at cygnus.com) - - * Makefile.in, configure.in: Add 'make depend' support. - * tBag.cc, tMap.cc, tPQ.cc, tSet.cc: #include <builtin.h>, - because new iostream library doesn't automatically include it. - * tFile.cc, test_h.cc: #ifdef out code that won't work with new - iostream library. Other tweaks for new library. diff --git a/contrib/libg++/libg++/tests/Makefile.in b/contrib/libg++/libg++/tests/Makefile.in deleted file mode 100644 index 8faf11284a4d1..0000000000000 --- a/contrib/libg++/libg++/tests/Makefile.in +++ /dev/null @@ -1,22 +0,0 @@ -srcdir = . - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -GENCLASS = ../genclass/genclass -PROTODIR = $(srcdir)/../src/gen - -# compilation notes: -# The following g++ warnings are expected to appear: -# -# 2. Several warnings from genclass about classes with only .h, no .cc files -# -# 3. A few harmless reminder warnings that some classes have no data members. -# -# 4. Many harmless warnings that arguments to vector-delete are unnecessary -# when deleting arrays of builtin types. - -#--- NOTE: Lots of stuff gets added by ${srcdir}/Makefile.sh - -Makefile: $(srcdir)/Makefile.sh - diff --git a/contrib/libg++/libg++/tests/Makefile.sh b/contrib/libg++/libg++/tests/Makefile.sh deleted file mode 100755 index 427ad01828279..0000000000000 --- a/contrib/libg++/libg++/tests/Makefile.sh +++ /dev/null @@ -1,174 +0,0 @@ -cat <<'EOF' -# test files -TSRCS = tObstack.cc tString.cc tInteger.cc tRational.cc \ - tBitSet.cc tBitString.cc tRandom.cc tList.cc tPlex.cc \ - tLList.cc tVec.cc tStack.cc tQueue.cc tDeque.cc tPQ.cc tSet.cc tBag.cc \ - tMap.cc tFix.cc tFix16.cc tFix24.cc \ - tGetOpt.cc \ - tiLList.cc -EOF - -TESTS0="tObstack tString tInteger tRational tBitSet"\ -" tBitString tFix tFix16 tFix24 tRandom" -TESTS1="tStack tQueue tDeque tPQ tSet tBag tMap tList tPlex tLList tVec" - -cat <<EOF -# executables -TOUTS = test_h ${TESTS0} ${TESTS1} tiLList tGetOpt - -EOF - -cat <<'EOF' -# files for archived prototype classes -LOBJS = \ - iList.o iSLList.o iDLList.o iVec.o iAVec.o \ - iPlex.o iFPlex.o iXPlex.o iRPlex.o iMPlex.o \ - iSet.o iBag.o iMap.o iPQ.o \ - iXPSet.o iOXPSet.o iSLSet.o iOSLSet.o iBSTSet.o iCHNode.o \ - iAVLSet.o iSplayNode.o iSplaySet.o iVHSet.o iVOHSet.o iCHSet.o \ - iXPBag.o iOXPBag.o iSLBag.o iOSLBag.o iSplayBag.o iVHBag.o iCHBag.o \ - iVHMap.o iCHMap.o iSplayMap.o iAVLMap.o iRAVLMap.o \ - iSplayPQ.o iPHPQ.o iXPPQ.o \ - iVStack.o iVQueue.o iStack.o iQueue.o iDeque.o \ - iXPStack.o iSLStack.o iXPQueue.o iSLQueue.o iXPDeque.o iDLDeque.o - -LSRCS = \ - iList.cc iSLList.cc iDLList.cc iVec.cc iAVec.cc \ - iPlex.cc iFPlex.cc iXPlex.cc iRPlex.cc iMPlex.cc \ - iSet.cc iBag.cc iMap.cc iPQ.cc \ - iXPSet.cc iOXPSet.cc iSLSet.cc iOSLSet.cc iBSTSet.cc iCHNode.cc \ - iAVLSet.cc iSplayNode.cc iSplaySet.cc iVHSet.cc iVOHSet.cc iCHSet.cc \ - iXPBag.cc iOXPBag.cc iSLBag.cc iOSLBag.cc iSplayBag.cc iVHBag.cc iCHBag.cc \ - iVHMap.cc iCHMap.cc iSplayMap.cc iAVLMap.cc iRAVLMap.cc \ - iSplayPQ.cc iPHPQ.cc iXPPQ.cc \ - iVStack.cc iVQueue.cc iStack.cc iQueue.cc iDeque.cc \ - iXPStack.cc iSLStack.cc iXPQueue.cc iSLQueue.cc iXPDeque.cc iDLDeque.cc - -DEPEND_SOURCES = $(srcdir)/*.cc $(LSRCS) - -LHDRS = idefs.h - -.PHONY: all -all: - -.PHONY: info -info: -.PHONY: install-info -install-info: -.PHONY: clean-info -clean-info: - -.PHONY: check -check: tests - -.PHONY: check-tGetOpt -EOF - -for TEST in ${TESTS0} ${TESTS1} tiLList ; do - echo ".PHONY: check-${TEST}" - if [ -f ${srcdir}/${TEST}.inp ] ; then - echo "check-${TEST}: ${TEST}" '$(srcdir)'"/${TEST}.inp" - echo " ./${TEST} < "'$(srcdir)'"/${TEST}.inp > ${TEST}.out 2>&1" - else - echo "check-${TEST}: ${TEST}" - echo " ./${TEST} > ${TEST}.out 2>&1" - fi - echo ' diff -b $(srcdir)/'"${TEST}.exp ${TEST}.out" -done - -cat <<'EOF' - -check-tGetOpt: tGetOpt $(srcdir)/tGetOpt.inp - ./tGetOpt -abc -de10 -2000 -h3i \ - <$(srcdir)/tGetOpt.inp >tGetOpt.out 2>&1 - diff -b $(srcdir)/tGetOpt.exp tGetOpt.out - -$(TOUTS): $(LIBGXX) - -LIBTEST=libtest.a - -# We don't do check-tRandom, because it is not portable. - -# Comment this out if your compiler doesn't handle templates: -CHECK_TEMPLATES=check-templates - -tests checktests: clean_tests test_h \ - check-tObstack check-tString check-tInteger \ - check-tRational check-tBitSet check-tBitString \ - check-tFix check-tFix16 check-tFix24 check-tGetOpt \ - check-tList check-tPlex check-tLList check-tVec \ - check-tStack check-tQueue check-tDeque check-tPQ \ - check-tSet check-tBag check-tMap $(CHECK_TEMPLATES) - ./test_h - -check-templates: check-tiLList - -# Build all the tests, but don't run them. (Useful when cross-compiling.) - -EOF - -cat <<'EOF' -make-tests: $(TOUTS) - -test_h: test_h.o - $(CXX) $(LDFLAGS) test_h.o -o $@ $(LIBS) -lm - -$(LIBTEST): $(LHDRS) $(LOBJS) - rm -f $(LIBTEST) - $(AR) r $(LIBTEST) $(LOBJS) - $(RANLIB) $(LIBTEST) - -# -# other tests -# -EOF - -LIB_FOR_tRational=-lm -LIB_FOR_tInteger=-lm -LIB_FOR_tRandom=-lm -LIB_FOR_tFix=-lm -LIB_FOR_tFix16=-lm -LIB_FOR_tFix24=-lm - -for TEST in $TESTS0 tiLList tGetOpt; do - echo "${TEST}: ${TEST}.o" - echo ' $(CXX) $(LDFLAGS)' "${TEST}.o" '-o $@ $(LIBS)' \ - `eval echo '$LIB_FOR_'$TEST` - echo "" -done -for TEST in twrapper tgwrapper $TESTS1; do - echo "${TEST}: " '$(LIBTEST)' " ${TEST}.o" - echo ' $(CXX) $(LDFLAGS)' "${TEST}.o" '-o $@ $(LIBTEST) $(LIBS)' - echo "" -done - -cat <<'EOF' -idefs.h: - PROTODIR=$(PROTODIR); export PROTODIR; $(GENCLASS) int val defs i -EOF - -for TEST in Set XPSet OXPSet SLSet OSLSet BSTSet AVLSet SplayNode SplaySet VHSet VOHSet CHSet CHNode Bag XPBag OXPBag SLBag OSLBag SplayBag VHBag CHBag PQ PHPQ SplayPQ XPPQ Stack Queue Deque SLStack SLQueue DLDeque List Plex FPlex XPlex MPlex RPlex FPStack XPStack FPQueue XPQueue XPDeque SLList DLList Vec AVec; do - echo "i$TEST.h i$TEST.cc:" - echo ' PROTODIR=$(PROTODIR); export PROTODIR; $(GENCLASS) int val' $TEST i -done - -for TEST in Map VHMap CHMap SplayMap AVLMap RAVLMap; do - echo "i${TEST}.h i$TEST.cc:" - echo ' PROTODIR=$(PROTODIR); export PROTODIR; $(GENCLASS) -2 int val int val' $TEST i -done - -cat <<'EOF' -iVStack.h iVStack.cc: iStack.h - PROTODIR=$(PROTODIR); export PROTODIR; $(GENCLASS) int val VStack i -iVQueue.h iVQueue.cc: iQueue.h - PROTODIR=$(PROTODIR); export PROTODIR; $(GENCLASS) int val VQueue i - -relink: force - rm -f $(TOUTS) - -.PHONY: clean_tests -clean_tests: force - rm -f *.out - -force: -EOF diff --git a/contrib/libg++/libg++/tests/configure.in b/contrib/libg++/libg++/tests/configure.in deleted file mode 100644 index 5608fb750be4b..0000000000000 --- a/contrib/libg++/libg++/tests/configure.in +++ /dev/null @@ -1,27 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary to tailor a template configure script into the configure -# script appropriate for this directory. For more information, check -# any existing configure script. - -configdirs= -srctrigger=tObstack.cc -srcname="tests for libg++" - -target_makefile_frag=../target-mkfrag -package_makefile_frag=Make.pack - -# per-host: - -# per-target: - -TOLIBGXX=../ -ALL=force -MOSTLYCLEAN='*.out *.o \#* core trie-gen ffile streamfile i*.cc i*.h CXX.hack* test.bye test.bye2 test.shell $(LIBTEST) $(TOUTS)' -CLEAN= - -(. ${srcdir}/../config.shared) >${package_makefile_frag} - -# post-target: - -(. ${srcdir}/Makefile.sh) >>Makefile -rm -f ${package_makefile_frag} diff --git a/contrib/libg++/libg++/tests/depend b/contrib/libg++/libg++/tests/depend deleted file mode 100644 index dbd33e1774c7b..0000000000000 --- a/contrib/libg++/libg++/tests/depend +++ /dev/null @@ -1,161 +0,0 @@ - - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -tBag.o : tBag.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iBag.h \ - iXPBag.h \ - iSLBag.h \ - iVHBag.h \ - iCHBag.h \ - iOXPBag.h \ - iOSLBag.h \ - iSplayBag.h -tBitSet.o : tBitSet.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tBitString.o : tBitString.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tComplex.o : tComplex.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tCurses.o : tCurses.cc -tDeque.o : tDeque.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iDeque.h \ - iXPDeque.h \ - iDLDeque.h -tFile.o : tFile.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - $(srcdir)/../$(IO_DIR)/strstream.h \ - $(srcdir)/../$(IO_DIR)/SFile.h \ - $(srcdir)/../$(IO_DIR)/fstream.h \ - $(srcdir)/../$(IO_DIR)/PlotFile.h -tFix.o : tFix.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tFix16.o : tFix16.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tFix24.o : tFix24.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tGetOpt.o : tGetOpt.cc -tInteger.o : tInteger.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tLList.o : tLList.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iSLList.h \ - iDLList.h -tList.o : tList.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iList.h -tMap.o : tMap.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iMap.h \ - iSplayMap.h \ - iVHMap.h \ - iCHMap.h \ - iAVLMap.h \ - iRAVLMap.h -tObstack.o : tObstack.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tPQ.o : tPQ.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iPQ.h \ - iXPPQ.h \ - iPHPQ.h \ - iSplayPQ.h -tPlex.o : tPlex.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iPlex.h \ - iFPlex.h \ - iXPlex.h \ - iMPlex.h \ - iRPlex.h -tQueue.o : tQueue.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iQueue.h \ - iXPQueue.h \ - iVQueue.h \ - iSLQueue.h -tRandom.o : tRandom.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tRational.o : tRational.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tSet.o : tSet.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iSet.h \ - iXPSet.h \ - iSLSet.h \ - iVHSet.h \ - iVOHSet.h \ - iCHSet.h \ - iOXPSet.h \ - iOSLSet.h \ - iBSTSet.h \ - iAVLSet.h \ - iSplaySet.h -tStack.o : tStack.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iStack.h \ - iXPStack.h \ - iVStack.h \ - iSLStack.h -tString.o : tString.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h -tVec.o : tVec.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - iVec.h \ - iAVec.h -test_h.o : test_h.cc \ - $(srcdir)/../$(IO_DIR)/stream.h \ - $(srcdir)/../$(IO_DIR)/iostream.h \ - $(srcdir)/../$(IO_DIR)/streambuf.h \ - $(srcdir)/../$(IO_DIR)/istream.h \ - $(srcdir)/../$(IO_DIR)/ostream.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/contrib/libg++/libg++/tests/tBag.cc b/contrib/libg++/libg++/tests/tBag.cc deleted file mode 100644 index aa99ec13901df..0000000000000 --- a/contrib/libg++/libg++/tests/tBag.cc +++ /dev/null @@ -1,540 +0,0 @@ -/* - a test file for Bags -*/ - - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> -#include <builtin.h> - -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << " OK\n"; \ - else cerr << " Fail\n"; } - -#include "iBag.h" - -unsigned int hash(int x) { return multiplicativehash(x) ; } - -int SIZE; - -int *nums; -int *odds; -int *dups; - -void add(int x[], intBag& a) -{ - for (int i = 0; i < SIZE; ++i) a.add(x[i]); -} - - -#include <MLCG.h> - -MLCG randgen; - -void permute(int x[]) -{ - for (int i = 1; i < SIZE; ++i) - { - int j = randgen.asLong() % (i + 1); - int tmp = x[i]; x[i] = x[j]; x[j] = tmp; - } -} - -void makenums() -{ - for (int i = 0; i < SIZE; ++i) nums[i] = i + 1; -} - -void makeodds() -{ - for (int i = 0; i < SIZE; ++i) odds[i] = 2 * i + 1; - permute(odds); -} - -void makedups() -{ - for (int i = 0; i < SIZE; i += 2) dups[i] = dups[i+1] = i/2 + 1; - permute(dups); -} - -void printBag(intBag& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - Pix i; - for (i = a.first(); i != 0 && k < maxprint; a.next(i),++k) - cout << a(i) << " "; - if (i != 0) cout << "...]\n"; - else cout << "]\n"; -} - - -void generictest(intBag& a, intBag& b, intBag& c) -{ - c.clear(); - assert(c.empty()); - Pix k; - for (k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); -} - -#include "iXPBag.h" - -void XPtest() -{ - intXPBag a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intXPBag b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intXPBag c(SIZE); - add(dups, c); - assert(c.length() == SIZE); - intXPBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (int j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -#include "iSLBag.h" - -void SLtest() -{ - intSLBag a; - add(nums, a); - assert(a.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intSLBag b; - add(odds, b); - assert(b.length() == SIZE); - intSLBag c; - add(dups, c); - assert(c.length() == SIZE); - intSLBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -#include "iVHBag.h" - -void VHtest() -{ - intVHBag a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intVHBag b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intVHBag c(SIZE); - add(dups, c); - assert(c.length() == SIZE); - intVHBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iCHBag.h" - -void CHtest() -{ - intCHBag a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intCHBag b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intCHBag c(SIZE); - add(dups, c); - assert(c.length() == SIZE); - intCHBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iOXPBag.h" - -void OXPtest() -{ - intOXPBag a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intOXPBag b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intOXPBag c(SIZE); - add(dups, c); - assert(c.length() == SIZE); - intOXPBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -#include "iOSLBag.h" - -void OSLtest() -{ - intOSLBag a; - add(nums, a); - assert(a.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intOSLBag b; - add(odds, b); - assert(b.length() == SIZE); - intOSLBag c; - add(dups, c); - assert(c.length() == SIZE); - intOSLBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iSplayBag.h" - -void Splaytest() -{ - intSplayBag a; - add(nums, a); - assert(a.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intSplayBag b; - add(odds, b); - assert(b.length() == SIZE); - intSplayBag c; - add(dups, c); - assert(c.length() == SIZE); - intSplayBag d(a); - add(nums, d); - assert(d.length() == SIZE*2); - cout << "a: "; printBag(a); - cout << "b: "; printBag(b); - cout << "c: "; printBag(c); - cout << "d: "; printBag(d); - for (j = 1; j <= SIZE; ++j) assert(d.nof(j) == 2); - d.del(1); - assert(d.nof(1) == 1); - d.del(1); - assert(d.nof(1) == 0); - d.remove(2); - assert(!d.contains(2)); - for (Pix l = c.first(); l; c.next(l)) d.remove(c(l)); - assert(d.length() == SIZE); - - c.clear(); - assert(c.empty()); - for (Pix k = a.first(); k != 0; a.next(k)) c.add(a(k)); - for (Pix k = a.first(); k != 0; a.next(k)) assert(c.contains(a(k))); - c.del(a(a.first())); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = b.first(); k != 0; b.next(k)) c.add(b(k)); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - for (Pix k = a.first(); k != 0; a.next(k)) c.remove(a(k)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -double return_elapsed_time ( double ); -double start_timer ( void ); - -int main(int argv, char** argc) -{ - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - nums = new int[SIZE]; - odds = new int[SIZE]; - dups = new int[SIZE]; - makenums(); - makeodds(); - makedups(); - start_timer(); - cout << "VHtest\n"; VHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "CHtest\n"; CHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "SLtest\n"; SLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "XPtest\n"; XPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "Splaytest\n"; Splaytest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "OSLtest\n"; OSLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "OXPtest\n"; OXPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - - return 0; -} diff --git a/contrib/libg++/libg++/tests/tBag.exp b/contrib/libg++/libg++/tests/tBag.exp deleted file mode 100644 index d86cf3461e6a6..0000000000000 --- a/contrib/libg++/libg++/tests/tBag.exp +++ /dev/null @@ -1,35 +0,0 @@ -VHtest -a: [72 77 13 3 26 16 39 29 52 42 65 55 78 91 9 22 35 48 61 74 ...] -b: [167 77 13 3 193 39 139 29 93 47 65 55 155 109 91 9 117 171 35 143 ...] -c: [13 31 3 26 16 39 11 29 47 42 42 27 12 9 22 43 35 28 48 8 ...] -d: [85 3 26 29 52 21 61 17 55 78 13 57 22 48 74 70 30 74 26 15 ...] -CHtest -a: [72 36 85 49 13 3 98 62 26 16 75 39 29 88 52 42 6 65 55 19 ...] -b: [167 49 85 121 13 3 157 193 111 39 75 147 29 183 137 65 101 173 55 19 ...] -c: [36 36 49 13 13 49 3 3 26 26 16 16 39 39 29 29 6 42 6 42 ...] -d: [72 36 36 72 85 49 13 13 49 85 3 3 98 62 26 26 62 98 16 16 ...] -SLtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [3 197 151 161 81 69 27 37 189 147 13 75 181 117 173 11 191 185 101 105 ...] -c: [33 2 48 18 37 5 35 49 1 12 50 9 31 26 10 42 37 17 13 11 ...] -d: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -XPtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [3 197 151 161 81 69 27 37 189 147 13 75 181 117 173 11 191 185 101 105 ...] -c: [33 2 48 18 37 5 35 49 1 12 50 9 31 26 10 42 37 17 13 11 ...] -d: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -Splaytest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -d: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -OSLtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -d: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -OXPtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -d: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] diff --git a/contrib/libg++/libg++/tests/tBag.inp b/contrib/libg++/libg++/tests/tBag.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tBag.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tBitSet.cc b/contrib/libg++/libg++/tests/tBitSet.cc deleted file mode 100644 index d98d3d453dcde..0000000000000 --- a/contrib/libg++/libg++/tests/tBitSet.cc +++ /dev/null @@ -1,220 +0,0 @@ -/* - a test/demo of BitSets -*/ - -#include <assert.h> - -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << "OK\n"; \ - else cerr << "Fail\n"; } - - - -#include <BitSet.h> - - -void test3S(BitSet a, BitSet b, BitSet c) -{ -// neg - assert(~(~a) == a); -// commutative - assert((a | b) == (b | a)); - assert((a & b) == (b & a)); -// associative - assert((a | (b | c)) == ((a | b) | c)); - assert((a & (b & c)) == ((a & b) & c)); -// distrib - assert((a & (b | c)) == ((a & b) | (a & c))); - assert((a | (b & c)) == ((a | b) & (a | c))); -// absorption - assert((a & (a | b)) == a); - assert((a | (a & b)) == a); -// demorgan - assert((a | b) == ~(~a & ~b)); - assert((a & b) == ~(~a | ~b)); -// def of - - assert((a - b) == (a & ~b)); - assert(((a - b) | b) == (a | b)); -// def of disjoint union - assert((a ^ b) == ((a | b) & ~(a & b))); - assert((a ^ b) == ((a - b) | (b - a))); - - BitSet x = a; - x &= b; - assert(x == (a & b)); - x |= c; - assert(x == ((a & b) | c)); - x -= a; - assert(x == (((a & b) | c) - a)); - x ^= b; - assert(x == ((((a & b) | c) - a) ^ b)); - assert(x.OK()); -} - -/* This regression test found a bug in BitSetresize. - Based on a bug report from Joaquim Jorge <jorgej@avs.cs.rpi.edu>.*/ - -void -test4() -{ - BitSet a; cout << "a: " << a << endl; - a.set(1, 2); cout << "after set(1,2): " << a << endl; - a = BitSet();cout << "after copy: " << a << endl; - a.set(1); cout << "after set(1): " << a << endl; -} - -int main() -{ - cout << "BitSet tests:\n"; - - BitSet a; - cout << "a = " << a << "\n"; - assert(a.OK()); - - BitSet b = longtoBitSet(1024); - cout << "b = " << b << "\n"; - assert(b.OK()); - assert(b[10] == 1); - assert(b.count() == 1); - b[0] = b[10]; - assert(b[0] == 1); - assert(b.count() == 2); - - BitSet c = atoBitSet("1010101010101010101010101010101010101010"); - cout << "c = " << c << "\n"; - assert(c.OK()); - assert(c.count() == 20); - for (int i = 0; i < 40; i += 2) - { - assert(c[i] == 1); - assert(c[i+1] == 0); - } - for (int p = 0; p < 5; ++p) - cout << "c[" << p << "] =" << int(c[p]) << "\n"; - - BitSet d = atoBitSet("0011001100110011001100110011001100110011"); - cout << "d = " << d << "\n"; - assert(d.OK()); - assert(d.count() == 20); - assert(d.count(0) == -1); - - BitSet e = atoBitSet("1111000011110000111100001111000011110000"); - cout << "e = " << e << "\n"; - assert(e.OK()); - assert(e.count() == 20); - - BitSet u = ~a; - cout << "u = ~a = " << u << "\n"; - assert(a == ~u); - - BitSet g = ~e; - cout << "g = ~e = " << g << "\n"; - - cout << "~c = " << (~c) << "\n"; - cout << "c & d = " << (c & d) << "\n"; - cout << "c | d = " << (c | d) << "\n"; - cout << "c - d = " << (c - d) << "\n"; - cout << "c ^ d = " << (c ^ d) << "\n"; - - test3S(b, c, d); - test3S(a, a, a); - test3S(a, b, c); - test3S(a, c, b); - test3S(c, b, a); - test3S(c, c, c); - test3S(c, d, e); - test3S(e, d, c); - - BitSet f = b; - cout << "f = b = " << f << "\n"; - f &= c; - cout << "f &= c = " << f << "\n"; - f |= d; - cout << "f |= d = " << f << "\n"; - f -= e; - cout << "f -= e = " << f << "\n"; - f ^= u; - cout << "f ^= u = " << f << "\n"; - assert(f.OK()); - - assert(c != d); - assert(!(c == d)); - assert(!(c < d)); - assert(!(c > d)); - assert(!(c <= d)); - assert(!(c >= d)); - - - BitSet h = d; - cout << "h = d\n:" << h << "\n"; - - assert(d == h); - assert(d <= h); - assert(d >= h); - assert(!(d != h)); - assert(!(d > h)); - assert(!(d < h)); - - h.set(0); - cout << "h.set(0):\n" << h << "\n"; - - assert(!(d == h)); - assert(!(d >= h)); - assert(!(d > h)); - assert((d != h)); - assert(d <= h); - assert((d < h)); - - h.set(65); - cout << "h.set(65):\n" << h << "\n"; - assert(h[65] == 1); - assert(h[64] == 0); - assert(h[66] == 0); - h.clear(2); - cout << "h.clear(2):\n" << h << "\n"; - assert(h[2] == 0); - assert(h[3] == 1); - assert(h[11] == 1); - h.invert(11,20); - cout << "h.invert(11,20):\n" << h << "\n"; - assert(h[11] == 0); - h.set(21,30); - cout << "h.set(21,30):\n" << h << "\n"; - assert(h[21] == 1); - h.clear(31,40); - cout << "h.clear(31, 40):\n" << h << "\n"; - assert(h[33] == 0); - cout << "h.test(0,5) = " << h.test(0, 5) << "\n"; - cout << "h.test(31,40) = " << h.test(31, 40) << "\n"; - - cout << "set bits in e:\n"; - for (int p = e.first(); p >= 0; p = e.next(p)) - { - assert(e[p] == 1); - cout << p << " "; - } - cout << "\n"; - - cout << "clear bits in g (reverse order):\n"; - for (int p = g.last(0); p >= 0; p = g.prev(p, 0)) - { - assert(g[p] == 0); - cout << p << " "; - } - cout << "\n"; - - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - assert(e.OK()); - assert(f.OK()); - assert(g.OK()); - assert(h.OK()); - - test4(); - - cout << "\nEnd of test.\n"; - return 0; -} - diff --git a/contrib/libg++/libg++/tests/tBitSet.exp b/contrib/libg++/libg++/tests/tBitSet.exp deleted file mode 100644 index 689874d00b35b..0000000000000 --- a/contrib/libg++/libg++/tests/tBitSet.exp +++ /dev/null @@ -1,49 +0,0 @@ -BitSet tests: -a = 0* -b = 000000000010* -c = 1010101010101010101010101010101010101010* -c[0] =1 -c[1] =0 -c[2] =1 -c[3] =0 -c[4] =1 -d = 00110011001100110011001100110011001100110* -e = 1111000011110000111100001111000011110* -u = ~a = 1* -g = ~e = 0000111100001111000011110000111100001* -~c = 0101010101010101010101010101010101010101* -c & d = 0010001000100010001000100010001000100010* -c | d = 10111011101110111011101110111011101110110* -c - d = 10001000100010001000100010001000100010* -c ^ d = 10011001100110011001100110011001100110010* -f = b = 100000000010* -f &= c = 100000000010* -f |= d = 10110011001100110011001100110011001100110* -f -= e = 00000011000000110000001100000011000000110* -f ^= u = 11111100111111001111110011111100111111001* -h = d -:00110011001100110011001100110011001100110* -h.set(0): -10110011001100110011001100110011001100110* -h.set(65): -1011001100110011001100110011001100110011000000000000000000000000010* -h.clear(2): -1001001100110011001100110011001100110011000000000000000000000000010* -h.invert(11,20): -1001001100101100110010110011001100110011000000000000000000000000010* -h.set(21,30): -1001001100101100110011111111111100110011000000000000000000000000010* -h.clear(31, 40): -1001001100101100110011111111111000000000000000000000000000000000010* -h.test(0,5) = 1 -h.test(31,40) = 0 -set bits in e: -0 1 2 3 8 9 10 11 16 17 18 19 24 25 26 27 32 33 34 35 -clear bits in g (reverse order): -35 34 33 32 27 26 25 24 19 18 17 16 11 10 9 8 3 2 1 0 -a: 0* -after set(1,2): 0110* -after copy: 0* -after set(1): 010* - -End of test. diff --git a/contrib/libg++/libg++/tests/tBitSet.inp b/contrib/libg++/libg++/tests/tBitSet.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tBitSet.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tBitString.cc b/contrib/libg++/libg++/tests/tBitString.cc deleted file mode 100644 index f397a2136dc6c..0000000000000 --- a/contrib/libg++/libg++/tests/tBitString.cc +++ /dev/null @@ -1,327 +0,0 @@ -/* - a test/demo of BitStrings -*/ - -#include <assert.h> -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << " OK\n"; \ - else cerr << " Fail\n"; } - - -#include <BitString.h> - -void doubletest(BitString a) -{ - BitString x; - BitString y; - x = a + reverse(a); - for (int i = 0; i < 7; ++i) - { - y = x; - x += x; - assert(x == reverse(x)); - assert(x.index(y) == 0); - assert(x.index(y, -1) == x.length() / 2); - assert(x.OK()); - } -} - -// identities for equal-length args - -void identitytest(BitString a, BitString b, BitString c) -{ -// neg - assert(~(~a) == a); -// commutative - assert((a | b) == (b | a)); - assert((a & b) == (b & a)); -// associative - assert((a | (b | c)) == ((a | b) | c)); - assert((a & (b & c)) == ((a & b) & c)); -// distrib - assert((a & (b | c)) == ((a & b) | (a & c))); - assert((a | (b & c)) == ((a | b) & (a | c))); -// absorption - assert((a & (a | b)) == a); - assert((a | (a & b)) == a); -// demorgan - assert((a | b) == ~(~a & ~b)); - assert((a & b) == ~(~a | ~b)); -// def of - - assert((a - b) == (a & ~b)); - assert(((a - b) | b) == (a | b)); -// def of disjoint union - assert((a ^ b) == ((a | b) & ~(a & b))); - assert((a ^ b) == ((a - b) | (b - a))); -// shift - assert(((a << 1) >> 1) == a); -// concat - assert((a + (b + c)) == ((a + b) + c)); - - BitString x; - x = a + b; - assert(x.after(a) == b); - assert(x.before(b, -1) == a); - - x = a; - int l = x.length(); - x.set(l); - assert(x == (a + 1)); - x.clear(l); - assert(x == (a + 0)); -} - -void accumtest(const BitString& a, const BitString& b, const BitString& c) -{ - BitString x = a; - x &= b; - assert(x == (a & b)); - x |= c; - assert(x == ((a & b) | c)); - x -= a; - assert(x == (((a & b) | c) - a)); - x ^= b; - assert(x == ((((a & b) | c) - a) ^ b)); - x += c; - assert(x == (((((a & b) | c) - a) ^ b) + c)); - x <<= 7; - assert(x == ((((((a & b) | c) - a) ^ b) + c) << 7)); - x >>= 5; - assert(x == (((((((a & b) | c) - a) ^ b) + c) << 7) >> 5)); - x += 0; - assert(x == ((((((((a & b) | c) - a) ^ b) + c) << 7) >> 5) + 0)); - - assert(x.OK()); -} - - -void cmptest(BitString& x) -{ - BitString a = x; - a[0] = 0; - BitString b = a; - - assert(a == b); - assert(a <= b); - assert(a >= b); - assert(!(a != b)); - assert(!(a > b)); - assert(!(a < b)); - assert(lcompare(a, b) == 0); - assert(a.matches(b)); - assert(a.contains(b)); - - b[0] = 1; - cout << "b.set(0) :" << b << "\n"; - - assert(!(a == b)); - assert(!(a >= b)); - assert(!(a > b)); - assert((a != b)); - assert(a <= b); - assert((a < b)); - assert(lcompare(a, b) < 0); - assert(!a.matches(b)); - assert(!a.contains(b)); - assert(a.after(0) == b.after(0)); - - b.set(65); - cout << "b.set(65):\n" << b << "\n"; - assert(b[65] == 1); - assert(b[64] == 0); - assert(b.length() == 66); - b.clear(2); - cout << "b.clear(2):\n" << b << "\n"; - assert(b[2] == 0); - b.set(11); - b.invert(11,20); - cout << "b.invert(11,20):\n" << b << "\n"; - assert(b[11] == 0); - b.set(21,30); - cout << "b.set(21,30):\n" << b << "\n"; - assert(b[21] == 1); - b.clear(31,40); - cout << "b.clear(31, 40):\n" << b << "\n"; - assert(b.test(33, 38) == 0); -} - -void subtest(BitString c) -{ - BitString k = c.at(1, 4); - cout << "k = " << k << "\n"; - assert(c.index(k) == 1); - assert(c.index(k, -1) != -1); - - cout << "c.before(k) = " << c.before(k) << "\n"; - assert(c.before(k) == c.before(1)); - cout << "c.at(k) = " << c.at(k) << "\n"; - assert(c.at(k) == k); - cout << "c.after(k) = " << c.after(k) << "\n"; - assert(c.after(k) == c.after(4)); - c.after(k) = k; - cout << "c.after(k)=k :" << c << "\n"; - assert(c.after(4) == k); - c.before(k) = k; - cout << "c.before(k)=k:" << c << "\n"; - assert(c.after(c.after(k)) == k); - - assert(c.contains(k, 0)); - assert(common_prefix(c, k) == k); - assert(common_suffix(c, k) == k); - cout << "reverse(k) = " << reverse(k) << "\n"; - k.left_trim(0); - assert(k[0] == 1); - cout << "k.left_trim(0) : " << k << "\n"; - k.right_trim(1); - assert(k[k.length() - 1] == 0); - cout << "k.right_trim(1) : " << k << "\n"; -} - -int main() -{ - BitString a; - BitString b = atoBitString("1000000001"); - BitString c = atoBitString("10101010101010101010"); - BitString d = atoBitString("00110011001100110011"); - BitString e = atoBitString("11110000111100001111"); - BitString f = b; - BitString g = ~e; - BitString h = d; - BitString zz; - - assert(a.OK()); - assert(a.empty()); - assert(b.OK()); - assert(!b.empty()); - assert(c.OK()); - assert(c.count(1) == 10); - assert(c.count(0) == 10); - assert(d.OK()); - assert(c.count(1) == 10); - assert(c.count(0) == 10); - assert(e.OK()); - assert(e.count(1) == 12); - assert(e.count(0) == 8); - assert(f == b); - assert(h == d); - assert(g == ~e); - assert(~g == e); - assert(f.OK()); - assert(g.OK()); - assert(h.OK()); - - cout << "a = " << a << "\n"; - cout << "b = " << b << "\n"; - cout << "c = " << c << "\n"; - cout << "d = " << d << "\n"; - cout << "e = " << e << "\n"; - cout << "f = b = " << f << "\n"; - cout << "g = ~e = " << g << "\n"; - cout << "h = d = " << h << "\n"; - - for (int i = 0; i < 20; ++i) - { - assert(h[i] == d[i]); - assert(g[i] != e[i]); - assert(c[i] == !(i % 2)); - } - - cout << "bits in e:\n"; - for (int p = e.first(); p >= 0; p = e.next(p)) - { - assert(e[p] == 1); - cout << p << " "; - } - cout << "\n"; - - cout << "clear bits in g (reverse order):\n"; - for (int p = g.last(0); p >= 0; p = g.prev(p, 0)) - { - assert(g[p] == 0); - cout << p << " "; - } - cout << "\n"; - - cout << "~c = " << (~c) << "\n"; - cout << "c & d = " << (c & d) << "\n"; - cout << "c | d = " << (c | d) << "\n"; - cout << "c - d = " << (c - d) << "\n"; - cout << "c ^ d = " << (c ^ d) << "\n"; - cout << "c + d = " << (c + d) << "\n"; - cout << "c <<2 = " << (c << 2) << "\n"; - cout << "c >>2 = " << (c >> 2) << "\n"; - - f &= c; - cout << "f &= c = " << f << "\n"; - f |= d; - cout << "f |= d = " << f << "\n"; - f -= d; - cout << "f -= e = " << f << "\n"; - f ^= c; - cout << "f ^= c = " << f << "\n"; - f += b; - cout << "f += b = " << f << "\n"; - f <<= 5; - cout << "f <<=5 = " << f << "\n"; - f >>= 10; - cout << "f >>=10= " << f << "\n"; - - assert(c != d); - assert(!(c == d)); - assert(!(c < d)); - assert(!(c > d)); - assert(!(c <= d)); - assert(!(c >= d)); - assert(lcompare(c, d) > 0); - - - BitString l = c + d + c; - cout << "l = " << l << "\n"; - BitPattern pat(d, e); - assert(pat.OK()); - cout << "BitPattern pat = " << pat << "\n"; - cout << "pat.pattern = " << pat.pattern << "\n"; - cout << "pat.mask = " << pat.mask << "\n"; - assert(d.matches(pat)); - cout << "l.index(pat) = " << l.index(pat) << "\n"; - cout << "l.index(pat,-1)= " << l.index(pat, -1) << "\n"; - cout << "l.before(pat) = " << l.before(pat) << "\n"; - cout << "l.at(pat) = " << l.at(pat) << "\n"; - cout << "l.after(pat) = " << l.after(pat) << "\n"; - int eind = l.index(pat); - l.at(pat) = e; - assert(l.index(e) == eind); - - identitytest(d, g, h); - identitytest(a, a, a); - identitytest(c, d, e); - identitytest(e, d, c); - identitytest(longtoBitString(0), longtoBitString((unsigned)(~(0L))), - shorttoBitString(1025)); - identitytest(a+b+c+d+e+f+g+h, h+g+f+e+d+c+b+a, a+c+e+g+b+d+f+h); - - accumtest(d, g, h); - accumtest(a, b, c); - accumtest(c, d, e); - accumtest(e, d, c); - accumtest(a+b+c+d+e+f+g+h+l, f+e+d+c+b+a+pat.mask, e+g+b+d+f+h+pat.pattern); - - doubletest(a); - doubletest(b); - doubletest(c); - doubletest(a+b+c+d+e+f+g+h); - - cmptest(b); - cmptest(d); - - subtest(c); - subtest(d); - - for (int i=0; i<64; i++) { - zz += 1; - } - cout << "zz = " << zz << "\n"; - - cout << "\nEnd of test.\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tBitString.exp b/contrib/libg++/libg++/tests/tBitString.exp deleted file mode 100644 index 142187aa0d502..0000000000000 --- a/contrib/libg++/libg++/tests/tBitString.exp +++ /dev/null @@ -1,79 +0,0 @@ -a = -b = 1000000001 -c = 10101010101010101010 -d = 00110011001100110011 -e = 11110000111100001111 -f = b = 1000000001 -g = ~e = 00001111000011110000 -h = d = 00110011001100110011 -bits in e: -0 1 2 3 8 9 10 11 16 17 18 19 -clear bits in g (reverse order): -19 18 17 16 11 10 9 8 3 2 1 0 -~c = 01010101010101010101 -c & d = 00100010001000100010 -c | d = 10111011101110111011 -c - d = 10001000100010001000 -c ^ d = 10011001100110011001 -c + d = 1010101010101010101000110011001100110011 -c <<2 = 0010101010101010101010 -c >>2 = 101010101010101010 -f &= c = 1000000000 -f |= d = 10110011001100110011 -f -= e = 10000000000000000000 -f ^= c = 00101010101010101010 -f += b = 001010101010101010101000000001 -f <<=5 = 00000001010101010101010101000000001 -f >>=10= 0101010101010101000000001 -l = 101010101010101010100011001100110011001110101010101010101010 -BitPattern pat = 0011XXXX0011XXXX0011 -pat.pattern = 00110011001100110011 -pat.mask = 11110000111100001111 -l.index(pat) = 20 -l.index(pat,-1)= 20 -l.before(pat) = 10101010101010101010 -l.at(pat) = 00110011001100110011 -l.after(pat) = 10101010101010101010 -b.set(0) :1000000001 -b.set(65): -100000000100000000000000000000000000000000000000000000000000000001 -b.clear(2): -100000000100000000000000000000000000000000000000000000000000000001 -b.invert(11,20): -100000000100111111111000000000000000000000000000000000000000000001 -b.set(21,30): -100000000100111111111111111111100000000000000000000000000000000001 -b.clear(31, 40): -100000000100111111111111111111100000000000000000000000000000000001 -b.set(0) :10110011001100110011 -b.set(65): -101100110011001100110000000000000000000000000000000000000000000001 -b.clear(2): -100100110011001100110000000000000000000000000000000000000000000001 -b.invert(11,20): -100100110010110011001000000000000000000000000000000000000000000001 -b.set(21,30): -100100110010110011001111111111100000000000000000000000000000000001 -b.clear(31, 40): -100100110010110011001111111111100000000000000000000000000000000001 -k = 0101 -c.before(k) = 1 -c.at(k) = 0101 -c.after(k) = 010101010101010 -c.after(k)=k :101010101 -c.before(k)=k:010101010101 -reverse(k) = 1010 -k.left_trim(0) : 101 -k.right_trim(1) : 10 -k = 0110 -c.before(k) = 0 -c.at(k) = 0110 -c.after(k) = 011001100110011 -c.after(k)=k :001100110 -c.before(k)=k:011001100110 -reverse(k) = 0110 -k.left_trim(0) : 110 -k.right_trim(1) : 110 -zz = 1111111111111111111111111111111111111111111111111111111111111111 - -End of test. diff --git a/contrib/libg++/libg++/tests/tBitString.inp b/contrib/libg++/libg++/tests/tBitString.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tBitString.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tCurses.cc b/contrib/libg++/libg++/tests/tCurses.cc deleted file mode 100644 index ae635dd314593..0000000000000 --- a/contrib/libg++/libg++/tests/tCurses.cc +++ /dev/null @@ -1,80 +0,0 @@ -#include <_G_config.h> -#if !_G_HAVE_CURSES - -#include <iostream.h> -int main () -{ - cerr << "(CursesWindow is not supported on this system)"; -} -#else /* _G_HAVE_CURSES */ - -#include <CursesW.h> - -// a simple test/demo for CursesWindow - -int main() -{ - CursesWindow big(23, 79, 0, 0); - CursesWindow corner(10, 10, 0, 0); - CursesWindow small(10, 10, 5, 5); - CursesWindow sub(big, 10, 10, (big.height()>>1)-5, (big.width()>>1)-5); - CursesWindow sub2(big, 5, 5, big.height()-6, big.width()-6); - CursesWindow subsub(sub, 5, 5, 1, 1, 'r'); - - int i; - char c='A'; - - big.box('B','B'); - - sub.box('|','-'); - for (i=1;i<10;++i) - sub.mvaddch(i, i, '*'); - for (i=1;i<10;++i) - sub.mvaddch(10-i, i, '*'); - - big.refresh(); - - big.mvprintw(0,0,"begx=%d,maxx=%d,begy=%d,maxy=%d,height=%d,width=%d", - big.begx(), big.maxx(), big.begy(), big.maxy(), - big.height(), big.width()); - big.refresh(); - - sub2.box('2', '2'); - subsub.box('s', 's'); - - big.refresh(); - - i=13; - const char * cptr = "Cstar"; - - long l = 0xffffffff; - double d= 3.1415926; - float f= 10.0/d; - - big.mvprintw(2,2,"printw test:%d, %c, %s, %ld, %lf, %f\n",i,c,cptr,l,d,f); - big.refresh(); - - corner.box('c','c'); - big.mvprintw(5,20,"enter an int:"); - big.refresh(); - big.scanw("%d",&i); - big.move(6,20); - big.printw("number = %d\n",i); - big.refresh(); - corner.refresh(); - - small.box('S','S'); small.refresh(); - big.mvprintw(20,20,"enter a char:"); - big.refresh(); - big.scanw("%c",&c); - big.move(21,20); - big.printw("char = %c\n",c); - small.box(c, c); - big.refresh(); - small.refresh(); - corner.overlay(small); - big.overwrite(corner); - corner.refresh(); -} -#endif /* _G_HAVE_CURSES */ - diff --git a/contrib/libg++/libg++/tests/tCurses.inp b/contrib/libg++/libg++/tests/tCurses.inp deleted file mode 100644 index 3624789167201..0000000000000 --- a/contrib/libg++/libg++/tests/tCurses.inp +++ /dev/null @@ -1,2 +0,0 @@ -123 -a diff --git a/contrib/libg++/libg++/tests/tDeque.cc b/contrib/libg++/libg++/tests/tDeque.cc deleted file mode 100644 index 0c1f561256cb0..0000000000000 --- a/contrib/libg++/libg++/tests/tDeque.cc +++ /dev/null @@ -1,168 +0,0 @@ -/* - test of Deques -*/ - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> - -#include "iDeque.h" - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - - -int SIZE; - -void print(intDeque& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - while (!a.empty() && k++ < maxprint) - cout << a.deq() << " "; - if (k == maxprint) - cout << "]\n"; - else - { - while (!a.empty()) a.del_front(); - cout << "...]\n"; - } - assert(a.empty()); -} - -#include "iXPDeque.h" - -void XPtest () -{ - intXPDeque d(SIZE); - assert(d.OK()); - for (int i = 0; i < SIZE; ++i) - { - if (i % 2 == 0) - d.enq(i); - else - d.push(i); - } - assert(d.length() == SIZE); - assert(d.front() == (SIZE-1)); - assert(d.rear() == (SIZE-2)); - assert(!d.full()); - intXPDeque d1(SIZE/2); - for (int i = (SIZE-1); i >= 0; --i) - { - int x; - if (i % 2 == 0) - { - x = d.rear(); - d.del_rear(); - } - else - { - x = d.front(); - d.del_front(); - } - d1.enq(x); - } - assert(d.empty()); - assert(d1.length() == SIZE); - assert(d1.front() == (SIZE-1)); - assert(d1.rear() == 0); - assert(d.OK()); - assert(d1.OK()); - intXPDeque d2 (d1); - assert(d2.length() == SIZE); - assert(d2.front() == (SIZE-1)); - assert(d2.OK()); - d1.clear(); - assert(d1.empty()); - d1 = d2; - assert(d1.length() == SIZE); - assert(d1.front() == (SIZE-1)); - cout << "d1:"; print(d1); - assert(d.OK()); - assert(d1.OK()); - assert(d2.OK()); -} - - -#include "iDLDeque.h" - -void DLtest () -{ - intDLDeque d; - assert(d.OK()); - for (int i = 0; i < SIZE; ++i) - { - if (i % 2 == 0) - d.enq(i); - else - d.push(i); - } - assert(d.length() == SIZE); - assert(d.front() == (SIZE-1)); - assert(d.rear() == (SIZE-2)); - assert(!d.full()); - intDLDeque d1; - for (int i = (SIZE-1); i >= 0; --i) - { - int x; - if (i % 2 == 0) - { - x = d.rear(); - d.del_rear(); - } - else - { - x = d.front(); - d.del_front(); - } - d1.enq(x); - } - assert(d.empty()); - assert(d1.length() == SIZE); - assert(d1.front() == (SIZE-1)); - assert(d1.rear() == 0); - assert(d.OK()); - assert(d1.OK()); - intDLDeque d2 (d1); - assert(d2.length() == SIZE); - assert(d2.front() == (SIZE-1)); - assert(d2.OK()); - d1.clear(); - assert(d1.empty()); - d1 = d2; - assert(d1.length() == SIZE); - assert(d1.front() == (SIZE-1)); - cout << "d1:"; print(d1); - - assert(d.OK()); - assert(d1.OK()); - assert(d2.OK()); -} - - -int main(int argv, char** argc) -{ - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - - start_timer(); - cout << "XP deques:\n"; XPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "DL deques:\n"; DLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tDeque.exp b/contrib/libg++/libg++/tests/tDeque.exp deleted file mode 100644 index 2d60c350b75b3..0000000000000 --- a/contrib/libg++/libg++/tests/tDeque.exp +++ /dev/null @@ -1,6 +0,0 @@ -XP deques: -d1:[99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 ...] -DL deques: -d1:[99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 ...] - -End of test diff --git a/contrib/libg++/libg++/tests/tDeque.inp b/contrib/libg++/libg++/tests/tDeque.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tDeque.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tFile.cc b/contrib/libg++/libg++/tests/tFile.cc deleted file mode 100644 index d846f877df1c9..0000000000000 --- a/contrib/libg++/libg++/tests/tFile.cc +++ /dev/null @@ -1,371 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* - * a few tests for streams - * - */ - -#include <stream.h> -#ifndef _OLD_STREAMS -#include <strstream.h> -#include "unistd.h" -#endif -#include <SFile.h> -#include <PlotFile.h> - -#include <std.h> -#include <assert.h> - -class record -{ -public: - char c; int i; double d; -}; - -ostream& operator<<(ostream& s, record& r) -{ - return(s << "(i = " << r.i << " c = " << r.c << " d = " << r.d << ")"); -} - -void t1() -{ - char ch; - - assert(cout.good()); - assert(cout.writable()); - assert(cout.is_open()); - cout << "Hello, world via cout\n"; - assert(cerr.good()); - assert(cerr.writable()); - assert(cerr.is_open()); - cerr << "Hello, world via cerr\n"; - - assert(cin.good()); - assert(cin.readable()); - assert(cin.is_open()); - - cout << "enter a char:"; cin >> ch; - cout.put('c'); cout.put(' '); cout.put('='); cout.put(' '); - cout.put('"'); cout.put(ch); cout << '"'; cout << char('\n'); - assert(cin.good()); - assert(cout.good()); -} - -void t2() -{ - int i; - short h; - long l; - float f; - double d; - char s[100]; - - cout << "enter three integers (short, int, long):"; - cin >> h; cin >> i; - // cin.scan("%ld", &l); - cin >> l; - cout << "first = " << h << " via dec = " << dec(h, 8) << "\n"; - cout << "second = " << i << form(" via form = %d = 0%o", i, i); - cout.form(" via cout.form = %d = 0x%x\n", i, i); - cout << "third = " << l << " via hex = " << hex(l) << "\n"; - assert(cin.good()); - assert(cout.good()); - - cout << "enter a float then a double:"; cin >> f; cin >> d; - cout << "first = " << f << "\n"; - cout << "second = " << d << "\n"; - assert(cin.good()); - assert(cout.good()); - - cout << "enter 5 characters separated with spaces:"; cin >> s; - cout << "first = " << s << "\n"; - cin.get(s, 100); - cout << "rest = " << s << "\n"; - - assert(cin.good()); - assert(cout.good()); - -} - -void t3() -{ - char ch; - cout << "\nMaking streams sout and sin..."; -#ifdef _OLD_STREAMS - ostream sout("streamfile", io_writeonly, a_create); -#else - ofstream sout("streamfile"); -#endif - assert(sout.good()); - assert(sout.is_open()); - assert(sout.writable()); - assert(!sout.readable()); - sout << "This file has one line testing output streams.\n"; - sout.close(); - assert(!sout.is_open()); -#ifdef _OLD_STREAMS - istream sin("streamfile", io_readonly, a_useonly); -#else - ifstream sin("streamfile"); -#endif - assert(sin.good()); - assert(sin.is_open()); - assert(!sin.writable()); - assert(sin.readable()); - cout << "contents of file:\n"; - while(sin >> ch) cout << ch; - sin.close(); - assert(!sin.is_open()); -} - - -void t4() -{ - char s[100]; - char ch; - int i; - - cout << "\nMaking File tf ... "; -#ifdef _OLD_STREAMS - File tf("tempfile", io_readwrite, a_create); -#else - fstream tf("tempfile", ios::in|ios::out|ios::trunc); -#endif - assert(tf.good()); - assert(tf.is_open()); - assert(tf.writable()); - assert(tf.readable()); - strcpy(s, "This is the first and only line of this file.\n"); -#ifdef _OLD_STREAMS - tf.put(s); - tf.seek(0); -#else - tf << s; - tf.rdbuf()->seekoff(0, ios::beg); -#endif - tf.get(s, 100); - assert(tf.good()); - cout << "first line of file:\n" << s << "\n"; - cout << "next char = "; - tf.get(ch); - cout << (int)ch; - cout.put('\n'); - assert(ch == 10); - strcpy(s, "Now there is a second line.\n"); - cout << "reopening tempfile, appending: " << s; -#ifdef _OLD_STREAMS - tf.open(tf.name(), io_appendonly, a_use); -#else - tf.close(); - tf.open("tempfile", ios::app); -#endif - assert(tf.good()); - assert(tf.is_open()); - assert(tf.writable()); - assert(!tf.readable()); -#ifdef _OLD_STREAMS - tf.put(s); - assert(tf.good()); - tf.open(tf.name(), io_readonly, a_use); -#else - tf << s; - assert(tf.good()); - tf.close(); - tf.open("tempfile", ios::in); -#endif - tf.raw(); - assert(tf.good()); - assert(tf.is_open()); - assert(!tf.writable()); - assert(tf.readable()); - cout << "First 10 chars via raw system read after reopen for input:\n"; - read(tf.filedesc(), s, 10); - assert(tf.good()); - for (i = 0; i < 10; ++ i) - cout.put(s[i]); - lseek(tf.filedesc(), 5, 0); - cout << "\nContents after raw lseek to pos 5:\n"; - while ( (tf.get(ch)) && (cout.put(ch)) ); -#ifdef _OLD_STREAMS - tf.remove(); -#else - tf.close(); - unlink("tempfile"); -#endif - assert(!tf.is_open()); -} - -void t5() -{ - record r; - int i; - cout << "\nMaking SFile rf..."; -#ifdef _OLD_STREAMS - SFile rf("recfile", sizeof(record), io_readwrite, a_create); -#else - SFile rf("recfile", sizeof(record), ios::in|ios::out|ios::trunc); -#endif - assert(rf.good()); - assert(rf.is_open()); - assert(rf.writable()); - assert(rf.readable()); - for (i = 0; i < 10; ++i) - { - r.c = i + 'a'; - r.i = i; - r.d = (double)(i) / 1000.0; - rf.put(&r); - } - assert(rf.good()); - cout << "odd elements of file in reverse order:\n"; - for (i = 9; i >= 0; i -= 2) - { - rf[i].get(&r); - assert(r.c == i + 'a'); - assert(r.i == i); - cout << r << "\n"; - } - assert(rf.good()); -#ifdef _OLD_STREAMS - rf.remove(); -#else - rf.close(); - unlink("recfile"); -#endif - assert(!rf.is_open()); -} - -void t6() -{ - cout << "\nMaking PlotFile pf ..."; - static const char plot_name[] = "plot.out"; - PlotFile pf(plot_name); - assert(pf.good()); - assert(pf.is_open()); - assert(pf.writable()); - assert(!pf.readable()); - pf.move(10,10); - pf.label("Test"); - pf.circle(300,300,200); - pf.line(100, 100, 500, 500); - assert(pf.good()); -#ifdef _OLD_STREAMS - cout << "(You may delete or attempt to plot " << pf.name() << ")\n"; -#else - cout << "(You may delete or attempt to plot " << plot_name << ")\n"; -#endif -} - -void t7() -{ - char ch; - char mybuf[1000]; -#ifdef _OLD_STREAMS - cout << "creating string-based ostream...\n"; - ostream strout(1000, mybuf); -#else - cout << "creating ostrstream...\n"; - ostrstream strout(mybuf, 1000); -#endif - assert(strout.good()); - assert(strout.writable()); - strout << "This is a string-based stream.\n"; - strout << "With two lines.\n"; - strout.put(char(0)); - assert(strout.good()); - cout << "with contents:\n"; - cout << mybuf; -#ifdef _OLD_STREAMS - cout << "using it to create string-based istream...\n"; - istream strin(strlen(mybuf), mybuf); -#else - cout << "using it to create istrstream...\n"; - istrstream strin(mybuf, strlen(mybuf)); -#endif - assert(strin.good()); - assert(strin.readable()); - cout << "with contents:\n"; - while (strin.get(ch)) cout.put(ch); -} - -void t8() -{ -#ifdef _OLD_STREAMS - cout << "\nThe following file open should generate error message:"; - cout.flush(); - File ef("shouldnotexist", io_readonly, a_useonly); -#else - ifstream ef("shouldnotexist"); -#endif - assert(!ef.good()); - assert(!ef.is_open()); -} - -void t9() -{ - char ch; - static char ffile_name[] = "ffile"; - { - cout << "\nMaking filebuf streams fout and fin..."; - filebuf foutbuf; -#ifdef _OLD_STREAMS - foutbuf.open(ffile_name, output); -#else - foutbuf.open(ffile_name, ios::out); -#endif - ostream fout(&foutbuf); - assert(fout.good()); - assert(fout.is_open()); - assert(fout.writable()); - assert(!fout.readable()); - fout << "This file has one line testing output streams.\n"; -#ifdef _OLD_STREAMS - fout.close(); - assert(!fout.is_open()); -#endif - } - filebuf finbuf; -#ifdef _OLD_STREAMS - finbuf.open(ffile_name, input); -#else - finbuf.open(ffile_name, ios::in); -#endif - istream fin(&finbuf); - assert(fin.good()); - assert(fin.is_open()); - assert(!fin.writable()); - assert(fin.readable()); - cout << "contents of file:\n"; - while(fin >> ch) cout << ch; -#ifndef _OLD_STREAMS - cout << '\n'; -#endif - fin.close(); - assert(!fin.is_open()); -} - -main() -{ - t1(); - t2(); - t3(); - t4(); - t5(); - t6(); - t7(); - t9(); - t8(); - - cout << "\nFinal names & states:\n"; -#ifdef _OLD_STREAMS - cout << "cin: " << cin.name() << "\t" << cin.rdstate() << "\n"; - cout << "cout: " << cout.name() << "\t" << cout.rdstate() << "\n"; - cout << "cerr: " << cerr.name() << "\t" << cerr.rdstate() << "\n"; -#else - cout << "cin: " << "(stdin)" << "\t" << cin.rdstate() << "\n"; - cout << "cout: " << "(stdout)" << "\t" << cout.rdstate() << "\n"; - cout << "cerr: " << "(stderr)" << "\t" << cerr.rdstate() << "\n"; -#endif - cout << "\nend of test.\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tFile.exp b/contrib/libg++/libg++/tests/tFile.exp deleted file mode 100644 index 6827c5cf191c5..0000000000000 --- a/contrib/libg++/libg++/tests/tFile.exp +++ /dev/null @@ -1,49 +0,0 @@ -Hello, world via cout -Hello, world via cerr -enter a char:c = "a" -enter three integers (short, int, long):first = 123 via dec = 123 -second = 4567 via form = 4567 = 010727 via cout.form = 4567 = 0x11d7 -third = 89012 via hex = 15bb4 -enter a float then a double:first = 123.456 -second = -0.012 -enter 5 characters separated with spaces:first = 1 -rest = 2 3 4 5 - -Making streams sout and sin...contents of file: -Thisfilehasonelinetestingoutputstreams. -Making File tf ... first line of file: -This is the first and only line of this file. -next char = 10 -reopening tempfile, appending: Now there is a second line. -First 10 chars via raw system read after reopen for input: -This is th -Contents after raw lseek to pos 5: -is the first and only line of this file. -Now there is a second line. - -Making SFile rf...odd elements of file in reverse order: -(i = 9 c = j d = 0.009) -(i = 7 c = h d = 0.007) -(i = 5 c = f d = 0.005) -(i = 3 c = d d = 0.003) -(i = 1 c = b d = 0.001) - -Making PlotFile pf ...(You may delete or attempt to plot plot.out) -creating ostrstream... -with contents: -This is a string-based stream. -With two lines. -using it to create istrstream... -with contents: -This is a string-based stream. -With two lines. - -Making filebuf streams fout and fin...contents of file: -Thisfilehasonelinetestingoutputstreams. - -Final names & states: -cin: (stdin) 0 -cout: (stdout) 0 -cerr: (stderr) 0 - -end of test. diff --git a/contrib/libg++/libg++/tests/tFile.inp b/contrib/libg++/libg++/tests/tFile.inp deleted file mode 100644 index 436a5212c8dcc..0000000000000 --- a/contrib/libg++/libg++/tests/tFile.inp +++ /dev/null @@ -1,4 +0,0 @@ -a -123 4567 89012 -123.456 -1.2e-2 -1 2 3 4 5 diff --git a/contrib/libg++/libg++/tests/tFix.cc b/contrib/libg++/libg++/tests/tFix.cc deleted file mode 100644 index 96256f466dd99..0000000000000 --- a/contrib/libg++/libg++/tests/tFix.cc +++ /dev/null @@ -1,101 +0,0 @@ -// -// testFix.cc : test Fix (variable length) classes -// - -#include <Fix.h> - -void check(const char* x, Fix y) { cout << x << " = " << (y) << "\n"; } - -void check(const char* x, int y) { cout << x << " = " << (y) << "\n"; } - -void check(const char* x, long y) { cout << x << " = " << (y) << "\n"; } - -void check(const char* x, double y) { cout << x << " = " << (y) << "\n"; } - -void checkb(const char* x, const Fix y) -{ - cout << x << " = " << (y) << " [" << length(y) << "]"<< "\n"; -} - - - -int main() { - cout << "Fix: identities should be displayed\n" - << "[X] displays the precision of a given value\n" - << "[*] indicates that the full precision is not used for coding reasons\n"; - - Fix a; checkb("0 [16]",a); - Fix b = .5; checkb(".5 [16]",b); - Fix c(17,-.5); checkb("-.5 [17]",c); - Fix d(33,.1); checkb(".1 [33]",d); - Fix e = c; checkb("-.5 [17]",e); - - checkb(".3 [16]",a = .3); - checkb(".5 [16]",a = b); - checkb(".1 [16]",a = d); - checkb(".1 [33*]",d = a); - checkb("-.2 [17]",c = -.2); - checkb("-.5 [17]",e); - - check(".1 [16] == .1 [33*]",a == d); - d = .1; - check(".1 [16] == .1 [33]",a == d); - check(".1 [33] != .5 [16]",d != b); - check(".1 [33] > .5 [16]",d > b); - check(".1 [33] <= -.2 [17]",d <= c); - - e = .5; - check("1073741824",mantissa(e).as_double()); - check(".5",value(e)); - - checkb(".5 [17]",+e); - checkb("-.5 [17]",-e); - - checkb(".1 [33] + .5 [16]",d+b); - checkb(".1 [33] - .5 [16]",d-b); - checkb(".1 [33] * .5 [16]",d*b); - checkb(".1 [33] * 3",d*3); - checkb(".1 [33] * -3",d*-3); - checkb("-.1 [33] * 3",(-d)*3); - checkb("-.1 [33] * -3",(-d)*-3); - checkb(".5 [17] * -2",e*-2); - checkb(".1 [33] % 25",d%25); - checkb(".1 [33] % -25",d%-25); - checkb(".1 [33] / .5 [16]",d/b); - checkb(".1 [33] << 1",d<<1); - checkb("-.1 [33] >> 2",(-d)>>2); - - checkb("abs(-.2)",abs(c)); - checkb("abs(.2)",abs(-c)); - check("sgn(-.2)",sgn(c)); - check("sgn(.2)",sgn(-c)); - - cout << "\nshow .1 [33]\n"; - show(d); - - Fix g = .95; - - cout << "\nFix: range errors warned\n"; - - Fix f = 1.1; checkb("1.1 [16]",f); - - checkb(".5 [16] / .1 [33]",b/d); - checkb(".5 [16] / 0. [16]",b/Fix(0.)); - checkb(".5 [17] * 32768",e*32768); - - cout << "\nFix: overflows saturated\n"; - Fix::set_overflow_handler(Fix::overflow_saturate); - - checkb(".95 [16] + .1 [33]",g+d); - checkb("-.1 [33] - .95 [16]",-d-g); - checkb(".5 [17] * 2",e*2); - - cout << "\nFix: overflows generate warnings\n"; - Fix::set_overflow_handler(Fix::overflow_warning); - - checkb(".95 [16] + .1 [33]",g+d); - checkb("-.1 [33] - .95 [16]",-d-g); - checkb(".5 [17] * 2",e*2); - - return 0; -} diff --git a/contrib/libg++/libg++/tests/tFix.exp b/contrib/libg++/libg++/tests/tFix.exp deleted file mode 100644 index 3ab0051aab2f5..0000000000000 --- a/contrib/libg++/libg++/tests/tFix.exp +++ /dev/null @@ -1,70 +0,0 @@ -Fix: identities should be displayed -[X] displays the precision of a given value -[*] indicates that the full precision is not used for coding reasons -0 [16] = 0.00000 [16] -.5 [16] = 0.50000 [16] --.5 [17] = -0.50000 [17] -.1 [33] = 0.10000 [33] --.5 [17] = -0.50000 [17] -.3 [16] = 0.29999 [16] -.5 [16] = 0.50000 [16] -.1 [16] = 0.09998 [16] -.1 [33*] = 0.09998 [33] --.2 [17] = -0.20001 [17] --.5 [17] = -0.50000 [17] -.1 [16] == .1 [33*] = 1 -.1 [16] == .1 [33] = 0 -.1 [33] != .5 [16] = 1 -.1 [33] > .5 [16] = 0 -.1 [33] <= -.2 [17] = 0 -1073741824 = 1.07374e+09 -.5 = 0.5 -.5 [17] = 0.50000 [17] --.5 [17] = -0.50000 [17] -.1 [33] + .5 [16] = 0.60000 [33] -.1 [33] - .5 [16] = -0.40000 [33] -.1 [33] * .5 [16] = 0.05000 [49] -.1 [33] * 3 = 0.30000 [33] -.1 [33] * -3 = -0.30000 [33] --.1 [33] * 3 = -0.30000 [33] --.1 [33] * -3 = 0.30000 [33] -.5 [17] * -2 = -1.00000 [17] -.1 [33] % 25 = 0.10000 [58] -.1 [33] % -25 = 0.09375 [8] -.1 [33] / .5 [16] = 0.20001 [33] -.1 [33] << 1 = 0.20000 [33] --.1 [33] >> 2 = 0.47500 [33] -abs(-.2) = 0.20001 [17] -abs(.2) = 0.20001 [17] -sgn(-.2) = -1 -sgn(.2) = 1 - -show .1 [33] -len = 33 -siz = 3 -ref = 1 -man = ccccccc8000 -val = 0.1 - -Fix: range errors warned -Fix: range error in declaration -1.1 [16] = 0.00000 [16] -Fix: range error in division -.5 [16] / .1 [33] = 0.00000 [16] -Fix: range error in division -- division by zero -.5 [16] / 0. [16] = 0.00000 [16] -Fix: range error in multiply by int -- int too large -.5 [17] * 32768 = -1.00000 [17] - -Fix: overflows saturated -.95 [16] + .1 [33] = 1.00000 [33] --.1 [33] - .95 [16] = -1.00000 [33] -.5 [17] * 2 = 0.99998 [17] - -Fix: overflows generate warnings -Fix: overflow warning -.95 [16] + .1 [33] = -0.94999 [33] -Fix: overflow warning --.1 [33] - .95 [16] = 0.94999 [33] -Fix: overflow warning -.5 [17] * 2 = -0.49994 [17] diff --git a/contrib/libg++/libg++/tests/tFix.inp b/contrib/libg++/libg++/tests/tFix.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tFix.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tFix16.cc b/contrib/libg++/libg++/tests/tFix16.cc deleted file mode 100644 index beedc463fafc9..0000000000000 --- a/contrib/libg++/libg++/tests/tFix16.cc +++ /dev/null @@ -1,110 +0,0 @@ -// -// testFix16.cc : test Fix16/32 classes -// - -#include <Fix16.h> - -// This set of inlines (instead of a macro) is to force the side effects -// of evaluating y to happen before x is printed. - -inline void check(char *x, int y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, long y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, double y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, Fix16 y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, Fix32 y) { cout << x << " = " << (y) << "\n"; } - -void test16() { - cout << "Fix16: identities should be displayed\n"; - - Fix16 a; check("0",a); - Fix16 b = .5; check(".5",b); - Fix16 c = -.5; check("-.5",c); - Fix16 d = .1; check(".1",d); - Fix16 e = b; check(".5",e); - - check(".5",a = b); - check(".25",a = .25); - check("8192",mantissa(a)); - mantissa(a)=8192; - check(".25",a); - check(".25",value(a)); - - check(".25",+a); - check("-.25",-a); - - check(".1 + .5",d+b); - check(".1 - .5",d-b); - check(".1 * .5",d*b); - check(".1 * 3",d*3); - check(".1 * -3",d*-3); - check(".1 / .5",d/b); - check(".1 << 1",d<<1); - check("-.5 >> 2",c>>2); - - check(".1 == .5",d == b); - check(".1 != .5",d != b); - check(".1 > .5",d > b); - check(".5 <= -.5",b <= c); - - cout << "Fix16: range errors ignored and overflows saturated\n"; - set_Fix16_overflow_handler(Fix16_overflow_saturate); - set_Fix16_range_error_handler(Fix16_ignore); - - Fix16 f = 1.1; check("1.1",f); - - Fix16 g = .7; - check(".7 + .5",g+b); - check("-.5 - .7",c-g); - check(".5 / .1",b/d); -} - -void test32() { - cout << "Fix32: identities should be displayed\n"; - - Fix32 a; check("0",a); - Fix32 b = .5; check(".5",b); - Fix32 c = -.5; check("-.5",c); - Fix32 d = .1; check(".1",d); - Fix32 e = b; check(".5",e); - - check(".5",a = b); - check(".25",a = .25); - check("536870912",mantissa(a)); - mantissa(a)=536870912; - check(".25",a); - check(".25",value(a)); - - check(".25",+a); - check("-.25",-a); - - check(".1 + .5",d+b); - check(".1 - .5",d-b); - check(".1 * .5",d*b); - check(".1 * 3",d*3); - check(".1 * -3",d*-3); - check(".1 / .5",d/b); - check(".1 << 1",d<<1); - check("-.5 >> 2",c>>2); - - check(".1 == .5",d == b); - check(".1 != .5",d != b); - check(".1 > .5",d > b); - check(".5 <= -.5",b <= c); - - cout << "Fix32: range errors reported and overflows reported\n"; - set_Fix32_overflow_handler(Fix32_warning); - set_Fix32_range_error_handler(Fix32_warning); - - Fix32 f = 1.1; check("1.1",f); - - Fix32 g = .7; - check(".7 + .5",g+b); - check("-.5 - .7",c-g); - check(".5 / .1",b/d); -} - -int main() { - test16(); - test32(); - return 0; -} diff --git a/contrib/libg++/libg++/tests/tFix16.exp b/contrib/libg++/libg++/tests/tFix16.exp deleted file mode 100644 index be40a2aae382f..0000000000000 --- a/contrib/libg++/libg++/tests/tFix16.exp +++ /dev/null @@ -1,64 +0,0 @@ -Fix16: identities should be displayed -0 = 0 -.5 = 0.5 --.5 = -0.5 -.1 = 0.100006 -.5 = 0.5 -.5 = 0.5 -.25 = 0.25 -8192 = 8192 -.25 = 0.25 -.25 = 0.25 -.25 = 0.25 --.25 = -0.25 -.1 + .5 = 0.600006 -.1 - .5 = -0.399994 -.1 * .5 = 0.0500031 -.1 * 3 = 0.300018 -.1 * -3 = -0.300018 -.1 / .5 = 0.200012 -.1 << 1 = 0.200012 --.5 >> 2 = -0.125 -.1 == .5 = 0 -.1 != .5 = 1 -.1 > .5 = 0 -.5 <= -.5 = 0 -Fix16: range errors ignored and overflows saturated -1.1 = 0.999969 -.7 + .5 = 0.999969 --.5 - .7 = -1 -.5 / .1 = 0.999969 -Fix32: identities should be displayed -0 = 0 -.5 = 0.5 --.5 = -0.5 -.1 = 0.1 -.5 = 0.5 -.5 = 0.5 -.25 = 0.25 -536870912 = 536870912 -.25 = 0.25 -.25 = 0.25 -.25 = 0.25 --.25 = -0.25 -.1 + .5 = 0.6 -.1 - .5 = -0.4 -.1 * .5 = 0.05 -.1 * 3 = 0.3 -.1 * -3 = -0.3 -.1 / .5 = 0.2 -.1 << 1 = 0.2 --.5 >> 2 = -0.125 -.1 == .5 = 0 -.1 != .5 = 1 -.1 > .5 = 0 -.5 <= -.5 = 0 -Fix32: range errors reported and overflows reported -warning: Fix32 result out of range -1.1 = 1 -warning: Fix32 result out of range -.7 + .5 = -0.8 -warning: Fix32 result out of range --.5 - .7 = 0.8 -warning: Fix32 result out of range -.5 / .1 = 1 diff --git a/contrib/libg++/libg++/tests/tFix16.inp b/contrib/libg++/libg++/tests/tFix16.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tFix16.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tFix24.cc b/contrib/libg++/libg++/tests/tFix24.cc deleted file mode 100644 index 08bd00994cbd5..0000000000000 --- a/contrib/libg++/libg++/tests/tFix24.cc +++ /dev/null @@ -1,113 +0,0 @@ -// -// testFix24.cc : test Fix24/48 classes -// - -#include <Fix24.h> - -// This a set of inlines instead of a macro to force the side effects -// of evaluating y to happen before x is printed. - -inline void check(char *x, int y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, unsigned int y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, long y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, unsigned long y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, double y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, Fix24 y) { cout << x << " = " << (y) << "\n"; } -inline void check(char *x, Fix48 y) { cout << x << " = " << (y) << "\n"; } - -void test24() { - cout << "Fix24: identities should be displayed\n"; - - Fix24 a; check("0",a); - Fix24 b = .5; check(".5",b); - Fix24 c = -.5; check("-.5",c); - Fix24 d = .1; check(".1",d); - Fix24 e = b; check(".5",e); - - check(".5",a = b); - check(".25",a = .25); - check("536870912",mantissa(a)); - mantissa(a)=536870912; - check(".25",a); - check(".25",value(a)); - - check(".25",+a); - check("-.25",-a); - - check(".1 + .5",d+b); - check(".1 - .5",d-b); - check(".1 * .5",d*b); - check(".1 * 3",d*3); - check(".1 * -3",d*-3); - check(".1 / .5",d/b); - check(".1 << 1",d<<1); - check("-.5 >> 2",c>>2); - - check(".1 == .5",d == b); - check(".1 != .5",d != b); - check(".1 > .5",d > b); - check(".5 <= -.5",b <= c); - - cout << "Fix24: range errors ignored and overflows saturated\n"; - set_Fix24_overflow_handler(Fix24_overflow_saturate); - set_Fix24_range_error_handler(Fix24_ignore); - - Fix24 f = 1.1; check("1.1",f); - - Fix24 g = .7; - check(".7 + .5",g+b); - check("-.5 - .7",c-g); - check(".5 / .1",b/d); -} - -void test48() { - cout << "Fix48: identities should be displayed\n"; - - Fix48 a; check("0",a); - Fix48 b = .5; check(".5",b); - Fix48 c = -.5; check("-.5",c); - Fix48 d = .1; check(".1",d); - Fix48 e = b; check(".5",e); - - check(".5",a = b); - check(".25",a = .25); - twolongs t; - t = mantissa(a); - check("536870912",t.u); - check("0",t.l); - mantissa(a)=t; - check(".25",a); - check(".25",value(a)); - - check(".25",+a); - check("-.25",-a); - - check(".1 + .5",d+b); - check(".1 - .5",d-b); - check(".1 * 3",d*3); - check(".1 * -3",d*-3); - check(".1 << 1",d<<1); - check("-.5 >> 2",c>>2); - - check(".1 == .5",d == b); - check(".1 != .5",d != b); - check(".1 > .5",d > b); - check(".5 <= -.5",b <= c); - - cout << "Fix48: range errors reported and overflows reported\n"; - set_Fix48_overflow_handler(Fix48_warning); - set_Fix48_range_error_handler(Fix48_warning); - - Fix48 f = 1.1; check("1.1",f); - - Fix48 g = .7; - check(".7 + .5",g+b); - check("-.5 - .7",c-g); -} - -int main() { - test24(); - test48(); - return 0; -} - diff --git a/contrib/libg++/libg++/tests/tFix24.exp b/contrib/libg++/libg++/tests/tFix24.exp deleted file mode 100644 index 598f8054e6992..0000000000000 --- a/contrib/libg++/libg++/tests/tFix24.exp +++ /dev/null @@ -1,61 +0,0 @@ -Fix24: identities should be displayed -0 = 0 -.5 = 0.5 --.5 = -0.5 -.1 = 0.1 -.5 = 0.5 -.5 = 0.5 -.25 = 0.25 -536870912 = 536870912 -.25 = 0.25 -.25 = 0.25 -.25 = 0.25 --.25 = -0.25 -.1 + .5 = 0.6 -.1 - .5 = -0.4 -.1 * .5 = 0.05 -.1 * 3 = 0.3 -.1 * -3 = -0.3 -.1 / .5 = 0.2 -.1 << 1 = 0.2 --.5 >> 2 = -0.125 -.1 == .5 = 0 -.1 != .5 = 1 -.1 > .5 = 0 -.5 <= -.5 = 0 -Fix24: range errors ignored and overflows saturated -1.1 = 1 -.7 + .5 = 1 --.5 - .7 = -1 -.5 / .1 = 1 -Fix48: identities should be displayed -0 = 0 -.5 = 0.5 --.5 = -0.5 -.1 = 0.1 -.5 = 0.5 -.5 = 0.5 -.25 = 0.25 -536870912 = 536870912 -0 = 0 -.25 = 0.25 -.25 = 0.25 -.25 = 0.25 --.25 = -0.25 -.1 + .5 = 0.6 -.1 - .5 = -0.4 -.1 * 3 = 0.3 -.1 * -3 = -0.3 -.1 << 1 = 0.2 --.5 >> 2 = -0.125 -.1 == .5 = 0 -.1 != .5 = 1 -.1 > .5 = 0 -.5 <= -.5 = 0 -Fix48: range errors reported and overflows reported -warning: Fix48 result out of range -1.1 = 1 -warning: Fix48 result out of range -.7 + .5 = -0.8 -warning: Fix48 result out of range --.5 - .7 = 0.8 diff --git a/contrib/libg++/libg++/tests/tFix24.inp b/contrib/libg++/libg++/tests/tFix24.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tFix24.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tGetOpt.cc b/contrib/libg++/libg++/tests/tGetOpt.cc deleted file mode 100644 index c9eb7e7d1ce2f..0000000000000 --- a/contrib/libg++/libg++/tests/tGetOpt.cc +++ /dev/null @@ -1,65 +0,0 @@ - -#include <GetOpt.h> - -int -main (int argc, char **argv) -{ - int digit_optind = 0; - GetOpt getopt (argc, argv, "abc:d:0123456789"); - - while (1) - { - int this_option_optind = getopt.optind; - int ch; - if ((ch = getopt ()) == EOF) - break; - char c = char(ch); - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", getopt.optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (getopt.optind < argc) - { - printf ("non-option ARGV-elements: "); - while (getopt.optind < argc) - printf ("%s ", argv[getopt.optind++]); - printf ("\n"); - } - - return 0; -} - diff --git a/contrib/libg++/libg++/tests/tGetOpt.exp b/contrib/libg++/libg++/tests/tGetOpt.exp deleted file mode 100644 index 827bb56abc285..0000000000000 --- a/contrib/libg++/libg++/tests/tGetOpt.exp +++ /dev/null @@ -1,11 +0,0 @@ -./tGetOpt: unrecognized option `-h' -./tGetOpt: unrecognized option `-i' -option a -option b -option c with value `-de10' -option 2 -option 0 -option 0 -option 0 -digits occur in two different argv-elements. -option 3 diff --git a/contrib/libg++/libg++/tests/tGetOpt.inp b/contrib/libg++/libg++/tests/tGetOpt.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tGetOpt.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tInteger.cc b/contrib/libg++/libg++/tests/tInteger.cc deleted file mode 100644 index f0c335e5ac3a3..0000000000000 --- a/contrib/libg++/libg++/tests/tInteger.cc +++ /dev/null @@ -1,437 +0,0 @@ -/* - a test file for Integer class - */ - -#include <Integer.h> -#include <assert.h> - -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << " OK\n"; \ - else cerr << " Fail\n"; } - - -Integer factorial(Integer n) -{ - Integer f; - if (n < 0) - f = 0; - else - { - f = 1; - while (n > 0) - { - f *= n; - --n; - } - } - return f; -} - -Integer fibonacci(long n) -{ - Integer f; - if (n <= 0) - f = 0; - else - { - f = 1; - Integer prev = 0; - Integer tmp; - while (n > 1) - { - tmp = f; - f += prev; - prev = tmp; - --n; - } - } - return f; -} - - -void identitytest(Integer& a, Integer& b, Integer& c) -{ - assert( -(-a) == a); - assert( (a + b) == (b + a)); - assert( (a + (-b)) == (a - b)); - assert( (a * b) == (b * a)); - assert( (a * (-b)) == -(a * b)); - assert( (a / (-b)) == -(a / b)); - assert( (a - b) == -(b - a)); - assert( (a + (b + c)) == ((a + b) + c)); - assert( (a * (b * c)) == ((a * b) * c)); - assert( (a * (b + c)) == ((a * b) + (a * c))); - assert( ((a - b) + b) == a); - assert( ((a + b) - b) == a); - assert( ((a * b) / b) == a); - assert( ((a * b) % b) == 0); - assert( (b * (a / b) + (a % b)) == a); - assert( ((a + b) % c) == ((a % c) + (b % c)) % c); -} - -void utiltest(Integer& a) -{ - assert(sqrt(sqr(a)) == a); - assert(sqr(sqrt(a)) <= a); - - Integer x = 1; - for (int i = 0; i < 10; ++i) - { - assert(pow(a, i) == x); - x *= a; - } - setbit(x, 0); - assert(testbit(x, 0)); - assert(odd(x)); - assert(!even(x)); - clearbit(x, 0); - clearbit(x, 1); - assert(even(x)); - assert(!odd(x)); - assert(x % 4 == 0); - -} - -void bittest(Integer& a, Integer& b, Integer& c) -{ - assert( (a | b) == (b | a)); - assert( (a & b) == (b & a)); - assert( (a ^ b) == (b ^ a)); - assert( (a | (b | c)) == ((a | b) | c)); - assert( (a & (b & c)) == ((a & b) & c)); - assert( (a & (b | c)) == ((a & b) | (a & c))); - assert( (a | (b & c)) == ((a | b) & (a | c))); - assert( (a & (a | b)) == a); - assert( (a | (a & b)) == a); -} - -void accumtest(Integer& a, Integer& b, Integer& c) -{ - Integer x = a; - x *= b; - assert(x == (a * b)); - x += c; - assert(x == ((a * b) + c)); - x -= a; - assert(x == (((a * b) + c) - a)); - x /= b; - assert(x == ((((a * b) + c) - a) / b)); - x %= c; - assert(x == (((((a * b) + c) - a) / b) % c)); - x &= a; - assert(x == ((((((a * b) + c) - a) / b) % c) & a)); - x |= b; - assert(x == (((((((a * b) + c) - a) / b) % c) & a) | b)); - x ^= c; - assert(x == ((((((((a * b) + c) - a) / b) % c) & a) | b) ^ c)); - - assert(x.OK()); -} - -void longidentitytest(Integer& a, long b, long c) -{ - assert( (a + b) == (b + a)); - assert( (a + (-b)) == (a - b)); - assert( (a * b) == (b * a)); - assert( (a * (-b)) == -(a * b)); - assert( (a / (-b)) == -(a / b)); - assert( (a - b) == -(b - a)); - assert( (a + (b + c)) == ((a + b) + c)); - assert( (a * (b * c)) == ((a * b) * c)); - assert( (a * (b + c)) == ((a * b) + (a * c))); - assert( ((a - b) + b) == a); - assert( ((a + b) - b) == a); - assert( ((a * b) / b) == a); - assert( ((a * b) % b) == 0); - assert( (b * (a / b) + (a % b)) == a); - assert( ((a + b) % c) == ((a % c) + (b % c)) % c); -} - -void longbittest(Integer& a, long b, long c) -{ - assert( (a | b) == (b | a)); - assert( (a & b) == (b & a)); - assert( (a ^ b) == (b ^ a)); - assert( (a | (b | c)) == ((a | b) | c)); - assert( (a & (b & c)) == ((a & b) & c)); - assert( (a & (b | c)) == ((a & b) | (a & c))); - assert( (a | (b & c)) == ((a | b) & (a | c))); - assert( (a & (a | b)) == a); - assert( (a | (a & b)) == a); -} - -void longaccumtest(Integer& a, long b, long c) -{ - Integer x = a; - x *= b; - assert(x == (a * b)); - x += c; - assert(x == ((a * b) + c)); - x -= a; - assert(x == (((a * b) + c) - a)); - x /= b; - assert(x == ((((a * b) + c) - a) / b)); - x %= c; - assert(x == (((((a * b) + c) - a) / b) % c)); - x &= a; - assert(x == ((((((a * b) + c) - a) / b) % c) & a)); - x |= b; - assert(x == (((((((a * b) + c) - a) / b) % c) & a) | b)); - x ^= c; - assert(x == ((((((((a * b) + c) - a) / b) % c) & a) | b) ^ c)); - - assert(x.OK()); -} - -void anothertest() -{ - Integer pow64 = Ipow(2, 64); - cout << "pow64 = Ipow(2, 64) = " << pow64 << "\n"; - assert(pow64.OK()); - cout << "lg(pow64) = " << lg(pow64) << "\n"; - assert(lg(pow64) == 64); - int k; - for (k = 0; k < 64; ++k) assert(testbit(pow64, k) == 0); - assert(testbit(pow64, k) != 0); - - Integer s64 = 1; - s64 <<= 64; - cout << "s64 = 1 << 64 = " << s64 << "\n"; - assert(s64.OK()); - - assert(s64 == pow64); - assert(s64 >= pow64); - assert(s64 <= pow64); - assert(!(s64 != pow64)); - assert(!(s64 > pow64)); - assert(!(s64 < pow64)); - - Integer s32 = s64 >> 32; - cout << "s32 = s64 >> 32 = " << s32 << "\n"; - assert(s32.OK()); - assert(lg(s32) == 32); - assert(!(pow64 == s32)); - assert(!(pow64 < s32)); - assert(!(pow64 <= s32)); - assert(pow64 != s32); - assert(pow64 >= s32); - assert(pow64 > s32); - - Integer comps64 = ~s64; - cout << "comps64 = ~s64 = " << comps64 << "\n"; - for (k = 0; k < 64; ++k) assert(testbit(comps64, k) == !testbit(s64, k)); - Integer result = (comps64 & s32); - cout << "comps64 & s32 = " << result << "\n"; - assert(result.OK()); - result = (comps64 | s32); - cout << "comps64 | s32 = " << result << "\n"; - assert(result.OK()); - result = (comps64 ^ s32); - cout << "comps64 ^ s32 = " << result << "\n"; - assert(result.OK()); - - identitytest(s64, s32, comps64); - bittest(s32, s64, comps64); - accumtest(comps64, s32, pow64); - utiltest(s32); - longidentitytest(s64, 1000, 50); - longbittest(s64, 12345, 67890); - longaccumtest(s32, 100000, 1); - -} - -void iotest() -{ - Integer result; - - cout << "\nenter an Integer: "; - cin.setf(0, ios::basefield); - cin >> result; - cout << "number = " << hex << result << dec << "\n"; - assert(result.OK()); - - cout << "enter another Integer: "; - cin >> result; - cout << "number = " << result << "\n"; - assert(result.OK()); - - cout << "enter another Integer: "; - cin >> dec >> result; - cout << "number = " << result << "\n"; - assert(result.OK()); - -} - -void fibtest() -{ - Integer fib50 = fibonacci(50); - cout << "fib50 = fibonacci(50) = " << fib50 << "\n"; - assert(fib50.OK()); - Integer fib48 = fibonacci(48); - cout << "fib48 = fibonacci(48) = " << fib48 << "\n"; - assert(fib48.OK()); - - Integer result = fib48 + fib50; - cout << "fib48 + fib50 = " << result << "\n"; - result = fib48 - fib50; - cout << "fib48 - fib50 = " << result << "\n"; - result = fib48 * fib50; - cout << "fib48 * fib50 = " << result << "\n"; - result = fib48 / fib50; - cout << "fib48 / fib50 = " << result << "\n"; - result = fib48 % fib50; - cout << "fib48 % fib50 = " << result << "\n"; - result = gcd(fib50, fib48); - cout << "gcd(fib50, fib48) = " << result << "\n"; - result = sqrt(fib50); - cout << "sqrt(fib50) = " << result << "\n"; - - identitytest(result, fib50, fib48); - bittest(result, fib50, fib48); - accumtest(result, fib50, fib48); - utiltest(fib48); - longidentitytest(fib50, 1000, 50); - longaccumtest(fib48, 100000, 1); -} - - -void facttest(Integer& one, Integer& two) -{ - Integer fact30(factorial(30)); - cout << "fact30 = factorial(30) = " << fact30 << "\n"; - assert(fact30.OK()); - - Integer fact28(factorial(28)); - cout << "fact28 = factorial(28) = " << fact28 << "\n"; - assert(fact28.OK()); - assert(fact30 == fact28 * 870); - - Integer result = fact30 + fact28; - cout << "fact30 + fact28 = " << result << "\n"; - result = fact30 - fact28; - cout << "fact30 - fact28 = " << result << "\n"; - result = fact30 * fact28; - cout << "fact30 * fact28 = " << result << "\n"; - result = fact30 / fact28; - cout << "fact30 / fact28 = " << result << "\n"; - result = fact30 % fact28; - cout << "fact30 % fact28 = " << result << "\n"; - - result = -fact30; - cout << "-fact30 = " << result << "\n"; - assert(abs(result) == fact30); - - cout << "lg(fact30) = " << lg(fact30) << "\n"; - assert(lg(fact30) == 107); - - result = gcd(fact30, fact28); - cout << "gcd(fact30, fact28) = " << result << "\n"; - assert(result == fact28); - - result = sqrt(fact30); - cout << "sqrt(fact30) = " << result << "\n"; - - Integer negfact31 = fact30 * -31; - Integer posfact31 = abs(negfact31); - assert(negfact31.OK()); - assert(posfact31.OK()); - cout << "negfact31 = " << negfact31 << "\n"; - result = fact30 + negfact31; - cout << "fact30 + negfact31 = " << result << "\n"; - result = fact30 - negfact31; - cout << "fact30 - negfact31 = " << result << "\n"; - result = fact30 * negfact31; - cout << "fact30 * negfact31 = " << result << "\n"; - result = fact30 / negfact31; - cout << "fact30 / negfact31 = " << result << "\n"; - result = fact30 % negfact31; - cout << "fact30 % negfact31 = " << result << "\n"; - result = gcd(fact30, negfact31); - cout << "gcd(fact30, negfact31) = " << result << "\n"; - assert(result == fact30); - - identitytest(one, one, one); - identitytest(one, one, one); - identitytest(one, two, fact30); - identitytest(fact30, posfact31, fact28); - identitytest(fact30, negfact31, fact28); - identitytest(negfact31, posfact31, fact28); - - bittest(one, one, one); - bittest(one, one, one); - bittest(one, two, fact30); - bittest(fact30, posfact31, fact28); - - accumtest(one, one, one); - accumtest(one, one, one); - accumtest(one, two, fact30); - accumtest(fact30, posfact31, fact28); - - utiltest(one); - utiltest(fact30); - utiltest(posfact31); - - longidentitytest(one, 1, 1); - longidentitytest(one, 2, 3); - longidentitytest(fact30, 3, -20); - longidentitytest(fact30, 4, 20000); - longidentitytest(negfact31, -100, 20000); - - longbittest(one, 1, 1); - longbittest(one, 2, 3); - longbittest(fact30, 4, 20000); - longbittest(fact28, 1000, 50); - - longaccumtest(one, 1, 1); - longaccumtest(one, 2, 3); - longaccumtest(fact30, 4, 20000); - longaccumtest(fact30, 1000, 50); - longaccumtest(fact28, 10000000, 100000000); -} - -void modtest() -{ - Integer b, e, m; - - m = 1; m <<= 32; - b = m + 1; - - e = Ipow( 2, 32 ); - b = Ipow( 2, 32 ); // use b as a comparison - cout << "2^32 = " << e << "\n"; - - e %= (e-1); // do same op two ways... - b = b % (b - 1); - - cout << "2^32 % (2^32-1) = " << e << "\n"; // e is incorrect here - cout << "2^32 % (2^32-1) = " << b << "\n"; // but b is ok -} - -int main() -{ - Integer one = 1; - cout << "one = " << one << "\n"; - assert(one.OK()); - assert(one == 1); - cout << "one + 1 = " << (one + 1) << "\n"; - - Integer two = 2; - cout << "two = " << two << "\n"; - assert(two.OK()); - assert(two == 2); - -/* inbox/1782 */ - Integer n (0); - setbit (n, 8); - clearbit (n, 16); - cout << "twofiftysix = " << n << '\n'; - - facttest(one, two); - fibtest(); - anothertest(); - iotest(); - modtest(); - - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tInteger.exp b/contrib/libg++/libg++/tests/tInteger.exp deleted file mode 100644 index 6a0d7e61fb807..0000000000000 --- a/contrib/libg++/libg++/tests/tInteger.exp +++ /dev/null @@ -1,48 +0,0 @@ -one = 1 -one + 1 = 2 -two = 2 -twofiftysix = 256 -fact30 = factorial(30) = 265252859812191058636308480000000 -fact28 = factorial(28) = 304888344611713860501504000000 -fact30 + fact28 = 265557748156802772496809984000000 -fact30 - fact28 = 264947971467579344775806976000000 -fact30 * fact28 = 80872505331661933764010628483512781121876047953920000000000000 -fact30 / fact28 = 870 -fact30 % fact28 = 0 --fact30 = -265252859812191058636308480000000 -lg(fact30) = 107 -gcd(fact30, fact28) = 304888344611713860501504000000 -sqrt(fact30) = 16286585271694955 -negfact31 = -8222838654177922817725562880000000 -fact30 + negfact31 = -7957585794365731759089254400000000 -fact30 - negfact31 = 8488091513990113876361871360000000 -fact30 * negfact31 = -2181131468794922353615366650200339706856997013317222400000000000000 -fact30 / negfact31 = 0 -fact30 % negfact31 = 265252859812191058636308480000000 -gcd(fact30, negfact31) = 265252859812191058636308480000000 -fib50 = fibonacci(50) = 12586269025 -fib48 = fibonacci(48) = 4807526976 -fib48 + fib50 = 17393796001 -fib48 - fib50 = -7778742049 -fib48 * fib50 = 60508827864880718400 -fib48 / fib50 = 0 -fib48 % fib50 = 4807526976 -gcd(fib50, fib48) = 1 -sqrt(fib50) = 112188 -pow64 = Ipow(2, 64) = 18446744073709551616 -lg(pow64) = 64 -s64 = 1 << 64 = 18446744073709551616 -s32 = s64 >> 32 = 4294967296 -comps64 = ~s64 = 18446744073709551615 -comps64 & s32 = 4294967296 -comps64 | s32 = 18446744073709551615 -comps64 ^ s32 = 18446744069414584319 - -enter an Integer: number = 1234abdecf99fed123 -enter another Integer: number = 0 -enter another Integer: number = -12345678901234567890 -2^32 = 4294967296 -2^32 % (2^32-1) = 1 -2^32 % (2^32-1) = 1 - -End of test diff --git a/contrib/libg++/libg++/tests/tInteger.inp b/contrib/libg++/libg++/tests/tInteger.inp deleted file mode 100644 index 3dee0b82c9aab..0000000000000 --- a/contrib/libg++/libg++/tests/tInteger.inp +++ /dev/null @@ -1,3 +0,0 @@ -0x1234abdecf99FED123 -0 --012345678901234567890 diff --git a/contrib/libg++/libg++/tests/tLList.cc b/contrib/libg++/libg++/tests/tLList.cc deleted file mode 100644 index b491438a26454..0000000000000 --- a/contrib/libg++/libg++/tests/tLList.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* - test/demo of linked structures -*/ - - -#include <assert.h> - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - -#include <stream.h> -#include "iSLList.h" - - -void printlist(intSLList& l) -{ - for (Pix p = l.first(); p != 0; l.next(p)) cout << l(p) << " "; - cout << "\n"; -} - - -void SLtest() -{ - int i; - intSLList a; - assert(a.OK()); - assert(a.empty()); - cout << "prepending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == i); - a.prepend(i); - assert(a.front() == i); - } - cout << "a: "; printlist(a); - cout << "appending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == 10 + i); - a.append(i); - assert(a.rear() == i); - } - cout << "a: "; printlist(a); - intSLList b = a; - cout << "b = a: " << "\n"; printlist(b); - assert(b.OK()); - assert(b.length() == a.length()); - assert(b.front() == a.front()); - assert(b.rear() == a.rear()); - cout << "remove_front of first 10 elements:\n"; - for (i = 0; i < 10; ++i) - { - assert(b.length() == 20 - i); - assert(b.front() == 9 - i); - b.remove_front(); - } - assert(b.length() == 10); - cout << "b: "; printlist(b); - - cout << "inserting 100 after sixth element...\n"; - Pix bp = b.first(); - for (i = 0; i < 5; ++i) b.next(bp); - b.ins_after(bp, 100); - assert(b.length() == 11); - cout << "b: "; printlist(b); - a.join(b); - cout << "after a.join(b)\n"; printlist(a); - assert(b.empty()); - assert(a.length() == 31); - cout << "b: " << "\n"; printlist(b); - b.prepend(999); - cout << "b: " << "\n"; printlist(b); - assert(b.length() == 1); - assert(b.front() == 999); - assert(b.rear() == 999); - assert(b.OK()); - intSLList bb = b; - cout << "bb: " << "\n"; printlist(bb); - assert(bb.OK()); - assert(bb.length() == 1); - assert(bb.front() == 999); - assert(bb.rear() == 999); - assert(bb.remove_front() == 999); - b.prepend(1234); - assert(b.length() == 2); - b.del_after(b.first()); - assert(b.rear() == 1234); - assert(b.length() == 1); - b.del_after(0); - assert(b.length() == 0); - - assert(a.OK()); - assert(b.OK()); - assert(bb.OK()); -} - -#include "iDLList.h" - -void printDlist(intDLList& l) -{ - for (Pix p = l.first(); p != 0; l.next(p)) cout << l(p) << " "; - cout << "\n"; -} - -void DLtest() -{ - int i; - intDLList a; - assert(a.OK()); - assert(a.empty()); - assert(a.length() == 0); - cout << "prepending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == i); - a.prepend(i); - assert(a.front() == i); - } - cout << "a: " << "\n"; printDlist(a); - cout << "appending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == 10 + i); - a.append(i); - assert(a.rear() == i); - } - cout << "a: "; printDlist(a); - intDLList b = a; - assert(b.OK()); - assert(b.length() == a.length()); - assert(b.front() == a.front()); - assert(b.rear() == a.rear()); - cout << "b = a: "; printDlist(b); - cout << "remove_front of first 10 elements:\n"; - for (i = 0; i < 10; ++i) - { - assert(b.length() == 20 - i); - assert(b.front() == 9 - i); - b.remove_front(); - } - assert(b.length() == 10); - cout << "b: "; printDlist(b); - - cout << "inserting 100 after sixth element...\n"; - Pix bp = b.first(); - for (i = 0; i < 5; ++i) b.next(bp); - b.ins_after(bp, 100); - assert(b.length() == 11); - cout << "b: "; printDlist(b); - intDLList aa = a; - aa.join(b); - cout << "after aa = a; aa.join(b)\n"; printDlist(aa); - assert(aa.length() == 31); - assert(b.empty()); - cout << "b: " << "\n"; printDlist(b); - b.prepend(999); - cout << "b: " << "\n"; printDlist(b); - assert(b.length() == 1); - assert(b.front() == 999); - assert(b.rear() == 999); - assert(b.OK()); - intDLList bb = b; - cout << "bb: " << "\n"; printDlist(bb); - assert(bb.OK()); - assert(bb.length() == 1); - assert(bb.front() == 999); - assert(bb.rear() == 999); - assert(bb.remove_front() == 999); - assert(bb.OK()); - b.prepend(1234); - assert(b.length() == 2); - bp = b.first(); - b.next(bp); - b.del(bp, -1); - assert(b.rear() == 1234); - assert(b.length() == 1); - b.del(bp); - assert(b.length() == 0); - - intDLList z = a; - cout << "z = a: "; printDlist(z); - assert(z.OK()); - assert(z.length() == 20); - cout << "remove_rear of last 10 elements:\n"; - for (i = 0; i < 10; ++i) - { - assert(z.length() == 20 - i); - assert(z.rear() == 9 - i); - z.remove_rear(); - } - assert(z.length() == 10); - - cout << "z: "; printDlist(z); - - cout << "inserting 100 before alternate elements...\n"; - Pix zp; - for (zp = z.first(); zp; z.next(zp)) - { - z.ins_before(zp, 100); - } - assert(z.length() == 20); - cout << "z: "; printDlist(z); - - cout << "inserting 200 after sixth element...\n"; - zp = z.first(); - for (i = 0; i < 5; ++i) z.next(zp); - z.ins_after(zp, 200); - assert(z.length() == 21); - cout << "z: "; printDlist(z); - - cout << "deleting alternate elements of z..."; - for (zp = z.first(); zp; z.next(zp)) - { - cout << z(zp) << " "; - z.del(zp); - } - cout << "\n"; - assert(z.length() == 10); - cout << "z: "; printDlist(z); - - cout << "z in reverse order:\n"; - for (zp = z.last(); zp; z.prev(zp)) cout << z(zp) << " "; - cout << "\n"; - z.clear(); - assert(z.OK()); - assert(z.empty()); - assert(a.OK()); - assert(b.OK()); -} - -main() -{ - SLtest(); - DLtest(); - cout << "\nEnd of test\n"; -} diff --git a/contrib/libg++/libg++/tests/tLList.exp b/contrib/libg++/libg++/tests/tLList.exp deleted file mode 100644 index 727f9b538c756..0000000000000 --- a/contrib/libg++/libg++/tests/tLList.exp +++ /dev/null @@ -1,49 +0,0 @@ -prepending... -a: 9 8 7 6 5 4 3 2 1 0 -appending... -a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -b = a: -9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -remove_front of first 10 elements: -b: 0 1 2 3 4 5 6 7 8 9 -inserting 100 after sixth element... -b: 0 1 2 3 4 5 100 6 7 8 9 -after a.join(b) -9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 100 6 7 8 9 -b: - -b: -999 -bb: -999 -prepending... -a: -9 8 7 6 5 4 3 2 1 0 -appending... -a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -b = a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -remove_front of first 10 elements: -b: 0 1 2 3 4 5 6 7 8 9 -inserting 100 after sixth element... -b: 0 1 2 3 4 5 100 6 7 8 9 -after aa = a; aa.join(b) -9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 100 6 7 8 9 -b: - -b: -999 -bb: -999 -z = a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -remove_rear of last 10 elements: -z: 9 8 7 6 5 4 3 2 1 0 -inserting 100 before alternate elements... -z: 100 9 100 8 100 7 100 6 100 5 100 4 100 3 100 2 100 1 100 0 -inserting 200 after sixth element... -z: 100 9 100 8 100 7 200 100 6 100 5 100 4 100 3 100 2 100 1 100 0 -deleting alternate elements of z...100 100 100 200 6 5 4 3 2 1 0 -z: 9 8 7 100 100 100 100 100 100 100 -z in reverse order: -100 100 100 100 100 100 100 7 8 9 - -End of test diff --git a/contrib/libg++/libg++/tests/tLList.inp b/contrib/libg++/libg++/tests/tLList.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tLList.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tList.cc b/contrib/libg++/libg++/tests/tList.cc deleted file mode 100644 index b508b5526d90e..0000000000000 --- a/contrib/libg++/libg++/tests/tList.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* - test/demo of generic lists -*/ - -#include <assert.h> - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - -#include <iostream.h> -#include "iList.h" - -int int_compare(int a, int b) -{ - return a - b; -} - -int inc(int x) -{ - return x + 1; -} - -int plus(int x, int y) -{ - return x + y; -} - -void printint(int x) -{ - cout << x << " "; -} - -void print(intList& l) -{ - l.apply(printint); - cout << "\n"; -} - -int is_odd(int x) -{ - return x & 1; -} - -int is_even(int x) -{ - return (x & 1) == 0; -} - -intList sequence(int lo, int hi) -{ - if (lo > hi) - return intList(); - else - return intList(lo, sequence(lo+1, hi)); -} - -int old_rand = 9999; - -int get_rand() -{ - old_rand = ((long)old_rand * (long)1243) % (long)971; - return old_rand; -} - -intList randseq(int n) -{ - if (n <= 0) - return intList(); - int value = get_rand() % 50; - return intList(value, randseq(--n)); -} - -main() -{ - intList a = sequence(1, 20); - cout << "\nintList a = sequence(1, 20);\n"; print(a); - assert(a.OK()); - for (int i = 0; i < 20; ++i) assert(a[i] == i + 1); - assert(a.position(2) == 1); - intList b = randseq(20); - cout << "\nintList b = randseq(20);\n"; print(b); - intList c = concat(a, b); - cout << "\nintList c = concat(a, b);\n"; print(c); - assert(c.contains(a)); - assert(c.contains(b)); - assert(!(c.find(a).null())); - assert(c.find(b) == b); - intList d = map(inc, a); - for (int i = 0; i < 20; ++i) assert(d[i] == a[i] + 1); - cout << "\nintList d = map(inc, a);\n"; print(d); - intList e = reverse(a); - cout << "\nintList e = reverse(a);\n"; print(e); - for (int i = 0; i < 20; ++i) assert(e[i] == a[19 - i]); - intList f = select(is_odd, a); - cout << "\nintList f = select(is_odd, a);\n"; print(f); - intList ff = select(is_even, f); - assert(ff.null()); - int red = a.reduce(plus, 0); - cout << "\nint red = a.reduce(plus, 0);\n"; cout << red; - int second = a[2]; - cout << "\nint second = a[2];\n"; cout << second; - intList g = combine(plus, a, b); - cout << "\nintList g = combine(plus, a, b);\n"; print(g); - for (int i = 0; i < 20; ++i) assert(g[i] == a[i] + b[i]); - g.del((intPredicate)is_odd); - cout << "\ng.del(is_odd);\n"; print(g); - ff = select(is_odd, g); - assert(ff.null()); - b.sort(int_compare); - for (int i = 1; i < 20; ++i) assert(b[i] >= b[i-1]); - cout << "\nb.sort(int_compare);\n"; print(b); - intList h = merge(a, b, int_compare); - cout << "\nintList h = merge(a, b, int_compare);\n"; print(h); - for (int i = 1; i < 40; ++i) assert(h[i] >= h[i-1]); - for (Pix p = a.first(); p; a.next(p)) assert(h.contains(a(p))); - for (Pix p = b.first(); p; b.next(p)) assert(h.contains(b(p))); - cout << "\nh via Pix:\n"; - for (Pix p = h.first(); p; h.next(p)) cout << h(p) << ", "; - cout << "\n"; - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - assert(e.OK()); - assert(f.OK()); - assert(g.OK()); - assert(h.OK()); - cout << "\ndone\n"; -} diff --git a/contrib/libg++/libg++/tests/tList.exp b/contrib/libg++/libg++/tests/tList.exp deleted file mode 100644 index 989137f1b92e3..0000000000000 --- a/contrib/libg++/libg++/tests/tList.exp +++ /dev/null @@ -1,39 +0,0 @@ - -intList a = sequence(1, 20); -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - -intList b = randseq(20); -28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6 - -intList c = concat(a, b); -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6 - -intList d = map(inc, a); -2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 - -intList e = reverse(a); -20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 - -intList f = select(is_odd, a); -1 3 5 7 9 11 13 15 17 19 - -int red = a.reduce(plus, 0); -210 -int second = a[2]; -3 -intList g = combine(plus, a, b); -29 29 8 21 49 12 16 48 24 36 60 47 28 62 28 43 42 43 28 26 - -g.del(is_odd); -8 12 16 48 24 36 60 28 62 28 42 28 26 - -b.sort(int_compare); -5 6 6 9 9 13 15 15 17 25 25 26 27 27 28 35 40 44 48 49 - -intList h = merge(a, b, int_compare); -1 2 3 4 5 5 6 6 6 7 8 9 9 9 10 11 12 13 13 14 15 15 15 16 17 17 18 19 20 25 25 26 27 27 28 35 40 44 48 49 - -h via Pix: -1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 19, 20, 25, 25, 26, 27, 27, 28, 35, 40, 44, 48, 49, - -done diff --git a/contrib/libg++/libg++/tests/tList.inp b/contrib/libg++/libg++/tests/tList.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tList.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tMap.cc b/contrib/libg++/libg++/tests/tMap.cc deleted file mode 100644 index ad03d4a1b1d47..0000000000000 --- a/contrib/libg++/libg++/tests/tMap.cc +++ /dev/null @@ -1,339 +0,0 @@ -/* - a test file for Maps -*/ - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> -#include <builtin.h> - - -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << " OK\n"; \ - else cerr << " Fail\n"; } - -#include "iMap.h" - -unsigned int hash(int x) { return multiplicativehash(x) ; } - -int SIZE; - -int *nums; -int *odds; -int *perm; - -void add(int x[], int y[], intintMap& a) -{ - for (int i = 0; i < SIZE; ++i) a[x[i]] = y[i]; -} - -#include <MLCG.h> - -MLCG randgen; - -void permute(int x[]) -{ - for (int i = 1; i < SIZE; ++i) - { - int j = randgen.asLong() % (i + 1); - int tmp = x[i]; x[i] = x[j]; x[j] = tmp; - } -} - -void makenums() -{ - for (int i = 0; i < SIZE; ++i) nums[i] = i + 1; -} - -void makeodds() -{ - for (int i = 0; i < SIZE; ++i) odds[i] = 2 * i + 1; - permute(odds); -} - -void makeperm() -{ - for (int i = 0; i < SIZE; ++i) perm[i] = i + 1; - permute(perm); -} - -void printMap(intintMap& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - Pix i; - for (i = a.first(); i != 0 && k < maxprint; a.next(i),++k) - cout << "(" << a.key(i) << ", " << a.contents(i) << ") "; - if (i != 0) cout << "...]\n"; - else cout << "]\n"; -} - -#include "iSplayMap.h" - -void Splaytest() -{ - intintSplayMap a(-1); - add(nums, perm, a); - intintSplayMap b(-1); - add(perm, nums, b); - intintSplayMap c(-1); - add(perm, odds, c); - intintSplayMap d(a); - add(nums, nums, d); - cout << "a: "; printMap(a); - cout << "b: "; printMap(b); - cout << "c: "; printMap(c); - cout << "d: "; printMap(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - assert(a[SIZE+1] = -1); - - for (j = 1; j <= SIZE; ++j) assert(b.contains(j)); - - for (j = 1; j <= SIZE; ++j) assert(b[a[j]] == j); - for (j = 1; j <= SIZE; ++j) assert(a[b[j]] == j); - - for (j = 1; j <= SIZE; ++j) assert((c[j] & 1) != 0); - - for (j = 1; j <= SIZE; ++j) assert(d[j] == j); - - d.del(1); - assert(!d.contains(1)); - for (j = 1; j <= SIZE; ++j) d.del(j); - assert(d.empty()); - - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - -} - -#include "iVHMap.h" - -void VHtest() -{ - intintVHMap a(-1, SIZE); - add(nums, perm, a); - intintVHMap b(-1, SIZE); - add(perm, nums, b); - intintVHMap c(-1, SIZE); - add(perm, odds, c); - intintVHMap d(a); - add(nums, nums, d); - cout << "a: "; printMap(a); - cout << "b: "; printMap(b); - cout << "c: "; printMap(c); - cout << "d: "; printMap(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - assert(a[SIZE+1] = -1); - - for (j = 1; j <= SIZE; ++j) assert(b.contains(j)); - - for (j = 1; j <= SIZE; ++j) assert(b[a[j]] == j); - for (j = 1; j <= SIZE; ++j) assert(a[b[j]] == j); - - for (j = 1; j <= SIZE; ++j) assert((c[j] & 1) != 0); - - for (j = 1; j <= SIZE; ++j) assert(d[j] == j); - - d.del(1); - assert(!d.contains(1)); - for (j = 1; j <= SIZE; ++j) d.del(j); - assert(d.empty()); - - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - -} - -#include "iCHMap.h" - -void CHtest() -{ - intintCHMap a(-1, SIZE); - add(nums, perm, a); - intintCHMap b(-1, SIZE); - add(perm, nums, b); - intintCHMap c(-1, SIZE); - add(perm, odds, c); - intintCHMap d(a); - add(nums, nums, d); - cout << "a: "; printMap(a); - cout << "b: "; printMap(b); - cout << "c: "; printMap(c); - cout << "d: "; printMap(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - assert(a[SIZE+1] = -1); - - for (j = 1; j <= SIZE; ++j) assert(b.contains(j)); - - for (j = 1; j <= SIZE; ++j) assert(b[a[j]] == j); - for (j = 1; j <= SIZE; ++j) assert(a[b[j]] == j); - - for (j = 1; j <= SIZE; ++j) assert((c[j] & 1) != 0); - - for (j = 1; j <= SIZE; ++j) assert(d[j] == j); - - d.del(1); - assert(!d.contains(1)); - for (j = 1; j <= SIZE; ++j) d.del(j); - assert(d.empty()); - - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - -} - -#include "iAVLMap.h" - -void AVLtest() -{ - intintAVLMap a(-1); - add(nums, perm, a); - intintAVLMap b(-1); - add(perm, nums, b); - intintAVLMap c(-1); - add(perm, odds, c); - intintAVLMap d(a); - add(nums, nums, d); - cout << "a: "; printMap(a); - cout << "b: "; printMap(b); - cout << "c: "; printMap(c); - cout << "d: "; printMap(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - assert(a[SIZE+1] = -1); - - for (j = 1; j <= SIZE; ++j) assert(b.contains(j)); - - for (j = 1; j <= SIZE; ++j) assert(b[a[j]] == j); - for (j = 1; j <= SIZE; ++j) assert(a[b[j]] == j); - - for (j = 1; j <= SIZE; ++j) assert((c[j] & 1) != 0); - - for (j = 1; j <= SIZE; ++j) assert(d[j] == j); - - d.del(1); - assert(!d.contains(1)); - for (j = 1; j <= SIZE; ++j) d.del(j); - assert(d.empty()); - - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - -} - -#include "iRAVLMap.h" - -void RAVLtest() -{ - intintRAVLMap a(-1); - add(nums, perm, a); - intintRAVLMap b(-1); - add(perm, nums, b); - intintRAVLMap c(-1); - add(perm, odds, c); - intintRAVLMap d(a); - add(nums, nums, d); - cout << "a: "; printMap(a); - cout << "b: "; printMap(b); - cout << "c: "; printMap(c); - cout << "d: "; printMap(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - for (j = 1; j <= a.length(); ++j) assert(a.rankof(j) == j); - for (j = 1; j <= a.length(); ++j) assert(a.key(a.ranktoPix(j)) == j); - assert(a[SIZE+1] = -1); - - for (j = 1; j <= SIZE; ++j) assert(b.contains(j)); - - for (j = 1; j <= SIZE; ++j) assert(b[a[j]] == j); - for (j = 1; j <= SIZE; ++j) assert(a[b[j]] == j); - - for (j = 1; j <= SIZE; ++j) assert((c[j] & 1) != 0); - - for (j = 1; j <= SIZE; ++j) assert(d[j] == j); - - d.del(1); - assert(!d.contains(1)); - for (j = 1; j <= SIZE; ++j) d.del(j); - assert(d.empty()); - - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); - -} - -double return_elapsed_time ( double ); -double start_timer ( ); - -int main(int argv, char** argc) -{ - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - nums = new int[SIZE]; - odds = new int[SIZE]; - perm = new int[SIZE]; - makenums(); - makeodds(); - makeperm(); - start_timer(); - cout << "Splaytest\n"; Splaytest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "VHtest\n"; VHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "CHtest\n"; CHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "AVLtest\n"; AVLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "RAVLtest\n"; RAVLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - - return 0; -} diff --git a/contrib/libg++/libg++/tests/tMap.exp b/contrib/libg++/libg++/tests/tMap.exp deleted file mode 100644 index 2d745ee0fa3e0..0000000000000 --- a/contrib/libg++/libg++/tests/tMap.exp +++ /dev/null @@ -1,25 +0,0 @@ -Splaytest -a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...] -b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...] -c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...] -d: [(1, 1) (2, 2) (3, 3) (4, 4) (5, 5) (6, 6) (7, 7) (8, 8) (9, 9) (10, 10) (11, 11) (12, 12) (13, 13) (14, 14) (15, 15) (16, 16) (17, 17) (18, 18) (19, 19) (20, 20) ...] -VHtest -a: [(72, 66) (77, 99) (13, 61) (3, 96) (26, 63) (16, 84) (39, 54) (29, 50) (52, 32) (42, 94) (65, 47) (55, 45) (78, 91) (91, 55) (9, 1) (22, 57) (35, 90) (48, 67) (61, 71) (74, 89) ...] -b: [(72, 41) (77, 43) (85, 38) (3, 2) (26, 19) (16, 57) (39, 23) (29, 53) (52, 14) (42, 21) (65, 1) (55, 91) (78, 95) (91, 78) (9, 6) (22, 20) (35, 27) (48, 33) (61, 13) (13, 50) ...] -c: [(72, 53) (77, 133) (85, 45) (3, 197) (26, 101) (16, 35) (39, 77) (29, 83) (52, 117) (42, 121) (65, 3) (55, 89) (78, 97) (91, 31) (9, 69) (22, 105) (35, 63) (48, 167) (61, 181) (13, 171) ...] -d: [(72, 72) (13, 13) (3, 3) (26, 26) (16, 16) (39, 39) (29, 29) (52, 52) (42, 42) (65, 65) (55, 55) (78, 78) (91, 91) (12, 12) (9, 9) (22, 22) (35, 35) (48, 48) (61, 61) (74, 74) ...] -CHtest -a: [(72, 66) (36, 25) (85, 92) (49, 10) (13, 61) (3, 96) (98, 8) (62, 5) (26, 63) (16, 84) (75, 51) (39, 54) (29, 50) (88, 81) (52, 32) (42, 94) (6, 9) (65, 47) (55, 45) (19, 26) ...] -b: [(72, 41) (36, 4) (49, 64) (13, 50) (85, 38) (3, 2) (62, 90) (98, 82) (26, 19) (16, 57) (75, 80) (39, 23) (29, 53) (88, 100) (52, 14) (6, 30) (42, 21) (65, 1) (55, 91) (19, 15) ...] -c: [(72, 53) (36, 161) (49, 67) (13, 171) (85, 45) (3, 197) (62, 177) (98, 95) (26, 101) (16, 35) (75, 25) (39, 77) (29, 83) (88, 47) (52, 117) (6, 135) (42, 121) (65, 3) (55, 89) (19, 173) ...] -d: [(36, 36) (72, 72) (13, 13) (49, 49) (85, 85) (3, 3) (26, 26) (62, 62) (98, 98) (16, 16) (39, 39) (75, 75) (29, 29) (52, 52) (88, 88) (6, 6) (42, 42) (65, 65) (19, 19) (55, 55) ...] -AVLtest -a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...] -b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...] -c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...] -d: [(1, 1) (2, 2) (3, 3) (4, 4) (5, 5) (6, 6) (7, 7) (8, 8) (9, 9) (10, 10) (11, 11) (12, 12) (13, 13) (14, 14) (15, 15) (16, 16) (17, 17) (18, 18) (19, 19) (20, 20) ...] -RAVLtest -a: [(1, 65) (2, 3) (3, 96) (4, 36) (5, 74) (6, 9) (7, 70) (8, 97) (9, 1) (10, 24) (11, 100) (12, 17) (13, 61) (14, 52) (15, 19) (16, 84) (17, 73) (18, 34) (19, 26) (20, 22) ...] -b: [(1, 9) (2, 31) (3, 2) (4, 32) (5, 62) (6, 30) (7, 87) (8, 98) (9, 6) (10, 49) (11, 44) (12, 47) (13, 50) (14, 76) (15, 56) (16, 57) (17, 12) (18, 54) (19, 15) (20, 83) ...] -c: [(1, 189) (2, 195) (3, 197) (4, 57) (5, 125) (6, 135) (7, 149) (8, 129) (9, 69) (10, 9) (11, 163) (12, 59) (13, 171) (14, 137) (15, 141) (16, 35) (17, 75) (18, 49) (19, 173) (20, 93) ...] -d: [(1, 1) (2, 2) (3, 3) (4, 4) (5, 5) (6, 6) (7, 7) (8, 8) (9, 9) (10, 10) (11, 11) (12, 12) (13, 13) (14, 14) (15, 15) (16, 16) (17, 17) (18, 18) (19, 19) (20, 20) ...] diff --git a/contrib/libg++/libg++/tests/tMap.inp b/contrib/libg++/libg++/tests/tMap.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tMap.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tObstack.cc b/contrib/libg++/libg++/tests/tObstack.cc deleted file mode 100644 index f1914021404d9..0000000000000 --- a/contrib/libg++/libg++/tests/tObstack.cc +++ /dev/null @@ -1,80 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* - a little test of Obstacks - Thu Feb 18 11:16:28 1988 Doug Lea (dl at rocky.oswego.edu) -*/ - -#include <assert.h> - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - -#include <stream.h> -#include <Obstack.h> -#include <stddef.h> -#include <ctype.h> - -int -main() -{ - char* s[10000]; - int n = 0; - int got_one = 0; - Obstack os; - char c; - - s[n++] = (char *)os.copy("\nunique words:"); - assert(os.OK()); - assert(os.contains(s[0])); - - cout << "enter anything at all, end with an EOF(^D)\n"; - - while (cin.good() && n < 10000) - { - if (cin.get(c) && isalnum(c)) - { - got_one = 1; - os.grow(c); - } - else if (got_one) - { - char* current = (char *)os.finish(0); - for (int i = 0; i < n; ++i) // stupid, but this is only a test. - { - if (strcmp(s[i], current) == 0) - { - os.free(current); - current = 0; - break; - } - } - if (current != 0) - s[n++] = current; - got_one = 0; - } - } - assert(os.OK()); - - cout << s[0] << "\n"; - - for (int i = n - 1; i > 0; -- i) - { - assert(os.contains(s[i])); - cout << s[i] << "\n"; - os.free(s[i]); - } - - assert(os.OK()); - assert(os.contains(s[0])); - - cout << "\n\nObstack vars:\n"; - cout << "alignment_mask = " << os.alignment_mask() << "\n"; - cout << "chunk_size = " << os.chunk_size() << "\n"; - cout << "size = " << os.size() << "\n"; - cout << "room + chunk overhead = " << os.room() + 2*sizeof (char*) << "\n"; - - cout << "\nend of test\n"; - - return 0; -} diff --git a/contrib/libg++/libg++/tests/tObstack.exp b/contrib/libg++/libg++/tests/tObstack.exp deleted file mode 100644 index 32114e82b74fe..0000000000000 --- a/contrib/libg++/libg++/tests/tObstack.exp +++ /dev/null @@ -1,32 +0,0 @@ -enter anything at all, end with an EOF(^D) - -unique words: -deleted -redundant -with -this -in -words -the -list -simply -should -program -The -Obstacks -for -file -test -simple -a -is -This - - -Obstack vars: -alignment_mask = 3 -chunk_size = 4080 -size = 0 -room + chunk overhead = 4064 - -end of test diff --git a/contrib/libg++/libg++/tests/tObstack.inp b/contrib/libg++/libg++/tests/tObstack.inp deleted file mode 100644 index 32dea332140c9..0000000000000 --- a/contrib/libg++/libg++/tests/tObstack.inp +++ /dev/null @@ -1,5 +0,0 @@ -This is a simple test file for Obstacks The test program should -simply list the words in this file with redundant words deleted -This is a simple test file for Obstacks The test program should -simply list the words in this file with redundant words deleted - diff --git a/contrib/libg++/libg++/tests/tPQ.cc b/contrib/libg++/libg++/tests/tPQ.cc deleted file mode 100644 index 4cd144136ea46..0000000000000 --- a/contrib/libg++/libg++/tests/tPQ.cc +++ /dev/null @@ -1,275 +0,0 @@ -/* - a test file for PQs -*/ - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> -#include <builtin.h> - -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << " OK\n"; \ - else cerr << " Fail\n"; } - -#include "iPQ.h" - - -int SIZE; - -int *nums; -int *odds; -int *dups; - -void add(int x[], intPQ& a) -{ - for (int i = 0; i < SIZE; ++i) a.enq(x[i]); -} - -#include <MLCG.h> - -MLCG randgen; - -void permute(int x[]) -{ - for (int i = 1; i < SIZE; ++i) - { - int j = randgen.asLong() % (i + 1); - int tmp = x[i]; x[i] = x[j]; x[j] = tmp; - } -} - -void makenums() -{ - for (int i = 0; i < SIZE; ++i) nums[i] = i + 1; - permute(nums); -} - -void makeodds() -{ - for (int i = 0; i < SIZE; ++i) odds[i] = 2 * i + 1; - permute(odds); -} - -void makedups() -{ - for (int i = 0; i < SIZE; i += 2) dups[i] = dups[i+1] = i/2 + 1; - permute(dups); -} - -void printPQ(intPQ& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - Pix i; - for (i = a.first(); i != 0 && k < maxprint; a.next(i),++k) - cout << a(i) << " "; - if (i != 0) cout << "...]\n"; - else cout << "]\n"; -} - -#include "iXPPQ.h" - -void XPtest() -{ - intXPPQ a(SIZE); - add(nums, a); - intXPPQ b(SIZE); - add(odds, b); - intXPPQ c(SIZE); - add(dups, c); - intXPPQ d(a); - add(nums, d); - cout << "a: "; printPQ(a); - cout << "b: "; printPQ(b); - cout << "c: "; printPQ(c); - cout << "d: "; printPQ(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE*2); - assert(a.front() == 1); - assert(b.front() == 1); - assert(c.front() == 1); - assert(d.front() == 1); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - d.del_front(); - assert(d.front() == 1); - for (j = 1; j <= SIZE; ++j) assert(a.deq() == j); - assert(a.empty()); - for (j = 1; j <= SIZE*2; j+=2) assert(b.deq() == j); - assert(b.empty()); - Pix* indices = new Pix [SIZE]; - int m = 0; - for (Pix i = c.first(); i != 0; c.next(i), c.next(i)) indices[m++] = i; - assert(m == SIZE/2); - while (--m >= 0) c.del(indices[m]); - assert(c.length() == SIZE/2); - int last = -1; - j = 0; - while (!c.empty()) - { - int current = c.deq(); - assert(last <= current); - last = current; - ++j; - } - assert(j == SIZE/2); - - delete [] indices; - d.clear(); - assert(d.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); -} - -#include "iPHPQ.h" - -void PHtest() -{ - intPHPQ a(SIZE); - add(nums, a); - intPHPQ b(SIZE); - add(odds, b); - intPHPQ c(SIZE); - add(dups, c); - intPHPQ d(a); - add(nums, d); - cout << "a: "; printPQ(a); - cout << "b: "; printPQ(b); - cout << "c: "; printPQ(c); - cout << "d: "; printPQ(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE*2); - assert(a.front() == 1); - assert(b.front() == 1); - assert(c.front() == 1); - assert(d.front() == 1); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - d.del_front(); - assert(d.front() == 1); - for (j = 1; j <= SIZE; ++j) assert(a.deq() == j); - assert(a.empty()); - for (j = 1; j <= SIZE*2; j+=2) assert(b.deq() == j); - assert(b.empty()); - Pix* indices = new Pix [SIZE]; - int m = 0; - for (Pix i = c.first(); i != 0; c.next(i), c.next(i)) indices[m++] = i; - assert(m == SIZE/2); - while (--m >= 0) c.del(indices[m]); - assert(c.length() == SIZE/2); - int last = -1; - j = 0; - while (!c.empty()) - { - int current = c.deq(); - assert(last <= current); - last = current; - ++j; - } - assert(j == SIZE/2); - delete [] indices; - d.clear(); - assert(d.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); -} - -#include "iSplayPQ.h" - -void Splaytest() -{ - intSplayPQ a; - add(nums, a); - intSplayPQ b; - add(odds, b); - intSplayPQ c; - add(dups, c); - intSplayPQ d(a); - add(nums, d); - cout << "a: "; printPQ(a); - cout << "b: "; printPQ(b); - cout << "c: "; printPQ(c); - cout << "d: "; printPQ(d); - assert(a.length() == SIZE); - assert(b.length() == SIZE); - assert(c.length() == SIZE); - assert(d.length() == SIZE*2); - assert(a.front() == 1); - assert(b.front() == 1); - assert(c.front() == 1); - assert(d.front() == 1); - int j; - for (j = 1; j <= SIZE; ++j) assert(a.contains(j)); - d.del_front(); - assert(d.front() == 1); - for (j = 1; j <= SIZE; ++j) assert(a.deq() == j); - assert(a.empty()); - for (j = 1; j <= SIZE*2; j+=2) assert(b.deq() == j); - assert(b.empty()); - Pix* indices = new Pix[SIZE]; - int m = 0; - for (Pix i = c.first(); i != 0; c.next(i), c.next(i)) indices[m++] = i; - assert(m == SIZE/2); - while (--m >= 0) c.del(indices[m]); - assert(c.length() == SIZE/2); - int last = -1; - j = 0; - while (!c.empty()) - { - int current = c.deq(); - assert(last <= current); - last = current; - ++j; - } - assert(j == SIZE/2); - delete [] indices; - d.clear(); - assert(d.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - assert(d.OK()); -} - - - -int main(int argv, char** argc) -{ - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - nums = new int[SIZE]; - odds = new int[SIZE]; - dups = new int[SIZE]; - makenums(); - makeodds(); - makedups(); - start_timer(); - cout << "Splaytest\n"; Splaytest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "PHtest\n"; PHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "XPtest\n"; XPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tPQ.exp b/contrib/libg++/libg++/tests/tPQ.exp deleted file mode 100644 index f2d8e1156e001..0000000000000 --- a/contrib/libg++/libg++/tests/tPQ.exp +++ /dev/null @@ -1,15 +0,0 @@ -Splaytest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -d: [1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 ...] -PHtest -a: [2 99 76 81 41 35 14 19 95 74 7 38 91 59 87 6 96 93 51 53 ...] -b: [129 5 191 71 147 17 139 193 1 47 199 33 121 103 37 167 145 67 51 43 ...] -c: [47 27 20 28 31 15 50 46 39 29 1 1 4 43 11 8 2 7 9 26 ...] -d: [2 99 76 81 41 35 14 19 95 74 7 38 91 59 87 6 96 93 51 53 ...] -XPtest -a: [1 3 2 7 4 5 18 29 12 6 10 8 17 21 26 34 36 15 16 19 ...] -b: [1 5 3 7 13 15 9 41 27 21 23 19 35 29 11 85 51 65 49 47 ...] -c: [1 2 1 3 5 2 8 4 5 6 14 3 9 11 10 7 15 12 6 28 ...] -d: [1 1 2 3 3 2 6 9 5 6 4 5 7 18 8 29 15 7 16 19 ...] diff --git a/contrib/libg++/libg++/tests/tPQ.inp b/contrib/libg++/libg++/tests/tPQ.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tPQ.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tPlex.cc b/contrib/libg++/libg++/tests/tPlex.cc deleted file mode 100644 index cd3f90ad68430..0000000000000 --- a/contrib/libg++/libg++/tests/tPlex.cc +++ /dev/null @@ -1,719 +0,0 @@ -/* - test of Plexes -*/ - -#include <stream.h> -#include <assert.h> -#include "iPlex.h" - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - - -void printplex(intPlex& a) -{ - cout << "["; - int maxprint = 20; - int k = 0; - int i; - for (i = a.low(); i < a.fence() && k < maxprint; ++i, ++k) - cout << a[i] << " "; - if (i < a.fence()) cout << "]\n"; - else cout << "...]\n"; -} - -#include "iFPlex.h" - -void FPtest () -{ - intFPlex p(50); - assert(p.OK()); - assert (p.empty()); - - p.add_high (1000); - Pix px = p.index_to_Pix(0); - assert (p.length() == 1); - assert(p.owns(px)); - assert(p(px) == 1000); - assert(p.Pix_to_index(px) == 0); - - p.reset_low (10); - assert (p.length() == 1); - assert (p.low() == 10); - assert (p[10] == 1000); - assert(p(px) == 1000); - assert(p.Pix_to_index(px) == 10); - assert(p.index_to_Pix(10) == px); - assert(p.OK()); - - int h = p.high_element(); - int l = p.low_element(); - assert ( (h==l) && (h==1000)); - p.fill(222); - assert(p(px) == 222); - - p.del_high(); - assert(p.empty()); - assert(!p.owns(px)); - - intFPlex q(10, -50); - q.add_low (-1000); - assert (q[9] == -1000); - q[9] = 21; - assert(!q.valid(10)); - assert(q.OK()); - - q.del_low(); - assert (q.empty()); - - p.reset_low (0); - q.reset_low (0); - - int i; - for (i = 0; i < 50; i++) - { - if (i % 2 == 0) - { - p.add_high (i); - assert (p.high() == i/2); - p[i/2] = p[i/4]; - assert (p.high_element() == i/4); - p[i/2] = i/2; - } - else - { - q.add_low (-i); - int ii = - (i/2) -1; - assert (q.low() == ii); - q.low_element() = ii; - assert (q[ii] == ii); - } - } - - cout << "q:"; printplex(q); - assert (p.length() == 25); - assert (q.length() == 25); - - assert(p.valid(0)); - assert(p.owns(px)); - - px = p.first(); - i = 0; - for (int it1 = p.low(); it1 < p.fence(); p.next(it1)) - { - assert (p[it1] == it1); - assert(p(px) == p[it1]); - p.next(px); - ++i; - } - assert(px == 0); - px = q.last(); - for (int it1 = q.high(); it1 > q.ecnef(); q.prev(it1)) - { - assert (q[it1] == it1); - assert(p(px) == q[it1]); - q.prev(px); - ++i; - } - assert(i == 50); - q.reset_low (0); - assert (p.high() == q.high()); - assert(p.low() == 0); - - intFPlex p1 = p; - intFPlex p2 (p); - intFPlex p3 = p2; - assert (p1.length() == 25); - assert (p1.high() == 24); - assert(p1.low() == 0); - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - - i = 0; - for (int it5 = p.low(); it5 < p.fence(); p.next(it5)) - { - assert(p1.low() == it5); - p1.del_low(); - assert(!p1.valid(it5)); - p2.del_high (); - p3 [it5] = -it5; - ++i; - } - assert(i == 25); - - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - assert (p1.empty()); - assert (p2.empty()); - - p3.append (p); - assert(p3.OK()); - - p1.prepend (p); - p2.append (p); - assert(p1.length() == p.length()); - assert(p1.length() == p2.length()); - assert(p1.OK()); - assert(p2.OK()); - - p2.clear(); - assert(p2.OK()); - assert(p2.empty()); - p2 = p1; - assert(p2.OK()); - - p1 = p; - assert(p1.OK()); - p1.reset_low (p1.low_element()); - for (int it6 = p1.low(); it6 < p1.fence(); it6++) - { - assert (p1[it6] == it6); - } - p1[13] = 1313; - p1[7] = -7777; - p1[24] = 24242424; - assert(!p1.valid(25)); - assert(!p1.valid(-1)); - assert(p1.OK()); - -} - -#include "iXPlex.h" - -void XPtest () -{ - intXPlex p(3); - assert(p.OK()); - assert (p.empty()); - - p.add_high (1000); - Pix px = p.index_to_Pix(0); - assert(p.Pix_to_index(px) == 0); - assert (p.length() == 1); - assert(p.owns(px)); - assert(p(px) == 1000); - - p.reset_low(10); - assert (p.length() == 1); - assert (p.low() == 10); - assert (p[10] == 1000); - assert(p(px) == 1000); - assert(p.Pix_to_index(px) == 10); - assert(p.index_to_Pix(10) == px); - assert(p.OK()); - - int h = p.high_element(); - int l = p.low_element(); - assert ( (h==l) && (h==1000)); - p.fill(222); - assert(p(px) == 222); - - p.del_high(); - assert(p.empty()); - assert(!p.owns(px)); - - p.add_low(-1000); - assert (p[9] == -1000); - p[9] = 21; - assert(!p.valid(10)); - assert(p.OK()); - - p.del_low(); - assert (p.empty()); - p.reset_low (0); - - int i; - for (i = 0; i < 50; i++) - { - if (i % 2 == 0) - { - p.add_high (i); - assert (p.high() == i/2); - p[i/2] = p[i/4]; - assert (p.high_element() == i/4); - p[i/2] = i/2; - } - else - { - p.add_low (-i); - int ii = - (i/2) -1; - assert (p.low() == ii); - p.low_element() = ii; - assert (p[ii] == ii); - } - } - - assert (p.length() == 50); - cout << "p:"; printplex(p); - - assert(p.valid(0)); - assert(p.owns(px)); - - px = p.first(); - i = 0; - for (int it1 = p.low(); it1 < p.fence(); p.next(it1)) - { - assert (p[it1] == it1); - assert(p(px) == p[it1]); - p.next(px); - ++i; - } - assert(i == 50); - assert(px == 0); - p.reset_low (0); - assert (p.high() == 49); - assert(p.low() == 0); - - i = 0; - for (int it2 = p.high(); it2 > p.ecnef(); p.prev(it2)) - { - assert ( p[it2] == it2-25 ); - ++i; - } - assert(i == 50); - assert(p.OK()); - - intXPlex p1 = p; - intXPlex p2 (p); - intXPlex p3 = p2; - assert (p1.length() == 50); - assert (p1.high() == 49); - assert(p1.low() == 0); - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - - i = 0; - for (int it5 = p.low(); it5 < p.fence(); p.next(it5)) - { - assert(p1.low() == it5); - p1.del_low(); - assert(!p1.valid(it5)); - p2.del_high (); - p3 [it5] = -it5; - ++i; - } - assert(i == 50); - - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - assert (p1.empty()); - assert (p2.empty()); - - p3.append (p); - assert(p3.OK()); - - p1.prepend (p); - p2.append (p); - assert(p1.length() == p.length()); - assert(p1.length() == p2.length()); - assert(p1.OK()); - assert(p2.OK()); - - p2.clear(); - assert(p2.OK()); - assert(p2.empty()); - p2 = p1; - assert(p2.OK()); - - - p1 = p; - assert(p1.OK()); - p1.reset_low(p1.low_element()); - p1 [13] = 1313; - p1 [-7] = -7777; - p1 [-25] = -252525; - p1 [24] = 24242424; - assert(!p1.valid(25)); - assert(!p1.valid(-26)); - assert(p1.OK()); - - p1 = p; - p1.reset_low (p1.low_element()); - for (int it6 = p1.low(); it6 < p1.fence(); it6++) - { - assert (p1[it6] == it6); - } - p1.reverse(); - i = p1.high(); - for (int it6 = p1.low(); it6 < p1.fence(); it6++) - { - assert (p1[it6] == i); - --i; - } - assert(p1.OK()); - -} - -#include "iMPlex.h" - -void MPtest () -{ - intMPlex p(3); - assert(p.OK()); - assert (p.empty()); - - p.add_high (1000); - Pix px = p.index_to_Pix(0); - assert (p.length() == 1); - assert(p.owns(px)); - assert(p(px) == 1000); - assert(p.Pix_to_index(px) == 0); - - p.reset_low (10); - assert (p.length() == 1); - assert (p.low() == 10); - assert (p[10] == 1000); - assert(p(px) == 1000); - assert(p.Pix_to_index(px) == 10); - assert(p.index_to_Pix(10) == px); - assert(p.OK()); - - int h = p.high_element(); - int l = p.low_element(); - assert ( (h==l) && (h==1000)); - p.fill(222); - assert(p(px) == 222); - - p.del_high(); - assert(p.empty()); - assert(!p.owns(px)); - - p.add_low (-1000); - assert (p[9] == -1000); - p[9] = 21; - assert(!p.valid(10)); - assert(p.OK()); - - p.del_low(); - assert (p.empty()); - p.reset_low (0); - - int i; - for (i = 0; i < 50; i++) - { - if (i % 2 == 0) - { - p.add_high (i); - assert (p.high() == i/2); - p[i/2] = p[i/4]; - assert (p.high_element() == i/4); - p[i/2] = i/2; - } - else - { - p.add_low (-i); - int ii = - (i/2) -1; - assert (p.low() == ii); - p.low_element() = ii; - assert (p[ii] == ii); - } - } - - cout << "p:"; printplex(p); - assert (p.length() == 50); - assert (p.count() == 50); - - assert(p.available() == 0); - assert(p.valid(0)); - px = &p[0]; - assert(p.owns(px)); - p.del_index(0); - assert(p.count() == 49); - assert(p.available() == 1); - assert(p.unused_index() == 0); - assert(!p.valid(0)); - assert(!p.owns(px)); - p.undel_index(0); - p[0] = 0; - assert(p.count() == 50); - assert(p.available() == 0); - assert(p.valid(0)); - assert(p.owns(px)); - assert(p.OK()); - - p.del_index(0); - - px = p.first(); - i = 0; - for (int it1 = p.low(); it1 < p.fence(); p.next(it1)) - { - assert (p[it1] == it1); - assert(p(px) == p[it1]); - p.next(px); - ++i; - } - assert(i == 49); - assert(px == 0); - p.reset_low (0); - assert (p.high() == 49); - assert(p.low() == 0); - - i = 0; - for (int it2 = p.high(); it2 > p.ecnef(); p.prev(it2)) - { - assert ( p[it2] == it2-25 ); - assert(px != &p[it2]); - ++i; - } - assert(i == 49); - assert(p.OK()); - - p.del_index(1); - p.del_index(2); - assert (p.OK()); - assert (p.count() == 47); - - intMPlex p1 = p; - intMPlex p2 (p); - intMPlex p3 = p2; - assert (p1.length() == 50); - assert (p1.count() == 47); - assert (p1.high() == 49); - assert(p1.low() == 0); - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - - i = 0; - for (int it5 = p.low(); it5 < p.fence(); p.next(it5)) - { - assert(p1.low() == it5); - p1.del_low(); - assert(!p1.valid(it5)); - p2.del_high (); - p3 [it5] = -it5; - ++i; - } - assert(i == 47); - - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - assert (p1.empty()); - assert (p2.empty()); - - p3.append (p); - assert(p3.OK()); - - p1.prepend (p); - p2.append (p); - assert(p1.count() == p.count()); - assert(p1.count() == p2.count()); - assert(p1.OK()); - assert(p2.OK()); - - p2.clear(); - assert(p2.OK()); - assert(p2.empty()); - p2 = p1; - assert(p2.OK()); - - p1 = p; - p1.del_index(3); - p1.del_index(4); - p1.del_index(5); - p1.del_index(6); - p1.del_index(7); - p1.del_index(8); - p1.undel_index(6); - p1[6] = 6666; - p1[9] = 9999; - p1[0] = 0; - assert(p1[6] == 6666); - assert(!p1.valid(5)); - assert(!p1.valid(7)); - p1.del_low(); - assert(p1.low() == 6); - assert(p1.OK()); - -} - -#include "iRPlex.h" - -void RPtest () -{ - intRPlex p(3); - assert(p.OK()); - assert (p.empty()); - - p.add_high (1000); - Pix px = p.index_to_Pix(0); - assert(p.Pix_to_index(px) == 0); - assert (p.length() == 1); - assert(p.owns(px)); - assert(p(px) == 1000); - - p.reset_low(10); - assert (p.length() == 1); - assert (p.low() == 10); - assert (p[10] == 1000); - assert(p(px) == 1000); - assert(p.Pix_to_index(px) == 10); - assert(p.index_to_Pix(10) == px); - assert(p.OK()); - - int h = p.high_element(); - int l = p.low_element(); - assert ( (h==l) && (h==1000)); - p.fill(222); - assert(p(px) == 222); - - p.del_high(); - assert(p.empty()); - assert(!p.owns(px)); - - p.add_low(-1000); - assert (p[9] == -1000); - p[9] = 21; - assert(!p.valid(10)); - assert(p.OK()); - - p.del_low(); - assert (p.empty()); - p.reset_low (0); - - int i; - for (i = 0; i < 50; i++) - { - if (i % 2 == 0) - { - p.add_high (i); - assert (p.high() == i/2); - p[i/2] = p[i/4]; - assert (p.high_element() == i/4); - p[i/2] = i/2; - } - else - { - p.add_low (-i); - int ii = - (i/2) -1; - assert (p.low() == ii); - p.low_element() = ii; - assert (p[ii] == ii); - } - } - - assert (p.length() == 50); - cout << "p:"; printplex(p); - - assert(p.valid(0)); - assert(p.owns(px)); - - px = p.first(); - i = 0; - for (int it1 = p.low(); it1 < p.fence(); p.next(it1)) - { - assert (p[it1] == it1); - assert(p(px) == p[it1]); - p.next(px); - ++i; - } - assert(i == 50); - assert(px == 0); - p.reset_low (0); - assert (p.high() == 49); - assert(p.low() == 0); - - i = 0; - for (int it2 = p.high(); it2 > p.ecnef(); p.prev(it2)) - { - assert ( p[it2] == it2-25 ); - ++i; - } - assert(i == 50); - assert(p.OK()); - - intRPlex p1 = p; - intRPlex p2 (p); - intRPlex p3 = p2; - assert (p1.length() == 50); - assert (p1.high() == 49); - assert(p1.low() == 0); - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - - i = 0; - for (int it5 = p.low(); it5 < p.fence(); p.next(it5)) - { - assert(p1.low() == it5); - p1.del_low(); - assert(!p1.valid(it5)); - p2.del_high (); - p3 [it5] = -it5; - ++i; - } - assert(i == 50); - - assert(p.OK()); - assert(p1.OK()); - assert(p2.OK()); - assert(p3.OK()); - assert (p1.empty()); - assert (p2.empty()); - - p3.append (p); - assert(p3.OK()); - - p1.prepend (p); - p2.append (p); - assert(p1.length() == p.length()); - assert(p1.length() == p2.length()); - assert(p1.OK()); - assert(p2.OK()); - - p2.clear(); - assert(p2.OK()); - assert(p2.empty()); - p2 = p1; - assert(p2.OK()); - - - p1 = p; - assert(p1.OK()); - p1.reset_low(p1.low_element()); - p1 [13] = 1313; - p1 [-7] = -7777; - p1 [-25] = -252525; - p1 [24] = 24242424; - assert(!p1.valid(25)); - assert(!p1.valid(-26)); - assert(p1.OK()); - - p1 = p; - p1.reset_low (p1.low_element()); - for (int it6 = p1.low(); it6 < p1.fence(); it6++) - { - assert (p1[it6] == it6); - } - p1.reverse(); - i = p1.high(); - for (int it6 = p1.low(); it6 < p1.fence(); it6++) - { - assert (p1[it6] == i); - --i; - } - assert(p1.OK()); - -} - - -main() -{ - cout << "FPtest\n"; FPtest(); - cout << "XPtest\n"; XPtest(); - cout << "MPtest\n"; MPtest(); - cout << "RPtest\n"; RPtest(); - cout << "\nend of tests\n"; -} diff --git a/contrib/libg++/libg++/tests/tPlex.exp b/contrib/libg++/libg++/tests/tPlex.exp deleted file mode 100644 index 42f939f94208c..0000000000000 --- a/contrib/libg++/libg++/tests/tPlex.exp +++ /dev/null @@ -1,10 +0,0 @@ -FPtest -q:[-25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 ] -XPtest -p:[-25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 ] -MPtest -p:[-25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 ] -RPtest -p:[-25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 ] - -end of tests diff --git a/contrib/libg++/libg++/tests/tPlex.inp b/contrib/libg++/libg++/tests/tPlex.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tPlex.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tQueue.cc b/contrib/libg++/libg++/tests/tQueue.cc deleted file mode 100644 index 51615da020f7e..0000000000000 --- a/contrib/libg++/libg++/tests/tQueue.cc +++ /dev/null @@ -1,209 +0,0 @@ -/* - test of Queues -*/ - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> -#include "iQueue.h" - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - - -int SIZE; - -void print(intQueue& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - while (!a.empty() && k++ < maxprint) - cout << a.deq() << " "; - if (k == maxprint) - cout << "]\n"; - else - { - while (!a.empty()) a.del_front(); - cout << "...]\n"; - } - assert(a.empty()); -} - -#include "iXPQueue.h" - -void XPtest () -{ - intXPQueue q(SIZE/2); - assert(q.OK()); - for (int i = 0; i < SIZE; ++i) - q.enq(i); - assert(q.length() == SIZE); - assert(q.front() == 0); - assert(!q.full()); - intXPQueue q1(SIZE*2); - for (int i = 0; i < SIZE; ++i) - { - int x = q.deq(); - assert(x == i); - q1.enq(x); - } - assert(q.empty()); - assert(q1.length() == SIZE); - assert(q1.front() == 0); - assert(q.OK()); - assert(q1.OK()); - intXPQueue q2 (q1); - assert(q2.length() == SIZE); - assert(q2.front() == 0); - assert(q2.OK()); - q1.clear(); - assert(q1.empty()); - q1 = q2; - assert(q1.length() == SIZE); - assert(q1.front() == 0); - assert(q1.OK()); - q1.del_front(); - assert(q1.length() == (SIZE-1)); - assert(q1.front() == 1); - cout << "q1:"; print(q1); - assert(q.OK()); - assert(q1.OK()); - assert(q2.OK()); -} - -#include "iVQueue.h" - -void Vtest () -{ - intVQueue q(SIZE); - assert(q.OK()); - for (int i = 0; i < SIZE; ++i) - q.enq(i); - assert(q.length() == SIZE); - assert(q.front() == 0); - assert(q.full()); - intVQueue q1(SIZE); - for (int i = 0; i < SIZE; ++i) - { - int x = q.deq(); - assert(x == i); - q1.enq(x); - } - assert(q.empty()); - assert(q1.length() == SIZE); - assert(q1.front() == 0); - assert(q.OK()); - assert(q1.OK()); - intVQueue q2 (q1); - assert(q2.length() == SIZE); - assert(q2.front() == 0); - assert(q2.OK()); - q1.clear(); - assert(q1.empty()); - q1 = q2; - assert(q1.length() == SIZE); - assert(q1.front() == 0); - assert(q1.OK()); - q1.del_front(); - assert(q1.length() == (SIZE-1)); - assert(q1.front() == 1); - cout << "q1:"; print(q1); - assert(q.OK()); - assert(q1.OK()); - assert(q2.OK()); -} - -#include "iSLQueue.h" - -void SLtest () -{ - intXPQueue q; - assert(q.OK()); - for (int i = 0; i < SIZE; ++i) - q.enq(i); - assert(q.length() == SIZE); - assert(q.front() == 0); - assert(!q.full()); - intXPQueue q1; - for (int i = 0; i < SIZE; ++i) - { - int x = q.deq(); - assert(x == i); - q1.enq(x); - } - assert(q.empty()); - assert(q1.length() == SIZE); - assert(q1.front() == 0); - assert(q.OK()); - assert(q1.OK()); - intXPQueue q2 (q1); - assert(q2.length() == SIZE); - assert(q2.front() == 0); - assert(q2.OK()); - q1.clear(); - assert(q1.empty()); - q1 = q2; - assert(q1.length() == SIZE); - assert(q1.front() == 0); - assert(q1.OK()); - q1.del_front(); - assert(q1.length() == (SIZE-1)); - assert(q1.front() == 1); - cout << "q1:"; print(q1); - assert(q.OK()); - assert(q1.OK()); - assert(q2.OK()); -} - -/* Test case from Jocelyn Serot <jserot@alize.univ-bpclermont.fr> */ -void -test_resize () -{ - intVQueue Q(4); - Q.enq(1); - Q.enq(2); - cout << Q.deq() << endl; - Q.enq(3); - Q.enq(4); - cout << Q.deq() << endl; - Q.enq(5); - Q.enq(6); - cout << Q.deq() << endl; - Q.enq(7); // Q is now full - Q.resize(8); // Lets grow it - Q.enq(8); // *** bug manifest at this point - cout << Q.deq() << endl; - cout << Q.deq() << endl; - cout << Q.deq() << endl; - cout << Q.deq() << endl; // Q is now empty -} - -int main(int argv, char** argc) -{ - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - start_timer(); - cout << "XP queues:\n"; XPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "V queues:\n"; Vtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "SL queues:\n"; SLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - - test_resize (); - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tQueue.exp b/contrib/libg++/libg++/tests/tQueue.exp deleted file mode 100644 index 5571e7580a2a9..0000000000000 --- a/contrib/libg++/libg++/tests/tQueue.exp +++ /dev/null @@ -1,15 +0,0 @@ -XP queues: -q1:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -V queues: -q1:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -SL queues: -q1:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -1 -2 -3 -4 -5 -6 -7 - -End of test diff --git a/contrib/libg++/libg++/tests/tQueue.inp b/contrib/libg++/libg++/tests/tQueue.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tQueue.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tRandom.cc b/contrib/libg++/libg++/tests/tRandom.cc deleted file mode 100644 index e41e4bf4df64e..0000000000000 --- a/contrib/libg++/libg++/tests/tRandom.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - a test file for Random classes -*/ - -#include <assert.h> -#include <ACG.h> -#include <MLCG.h> -#include <SmplStat.h> -#include <SmplHist.h> -#include <Binomial.h> -#include <Erlang.h> -#include <Geom.h> -#include <HypGeom.h> -#include <NegExp.h> -#include <Normal.h> -#include <LogNorm.h> -#include <Poisson.h> -#include <Uniform.h> -#include <DiscUnif.h> -#include <Weibull.h> - -void demo(Random& r) -{ - SampleStatistic s; - cout << "five samples:\n"; - for (int i = 0; i < 5; ++i) - { - double x = r(); - cout << x << " "; - s += x; - } - cout << "\nStatistics for 100 samples:\n"; - for (; i < 100; ++i) - { - double x = r(); - s += x; - } - cout << "samples: " << s.samples() << " "; - cout << "min: " << s.min() << " "; - cout << "max: " << s.max() << "\n"; - cout << "mean: " << s.mean() << " "; - cout << "stdDev: " << s.stdDev() << " "; - cout << "var: " << s.var() << " "; - cout << "confidence(95): " << s.confidence(95) << "\n"; -} - -main() -{ - int i; - ACG gen1; - cout << "five random ACG integers:\n"; - for (i = 0; i < 5; ++i) - cout << gen1.asLong() << " "; - cout << "\n"; - - MLCG gen2; - cout << "five random MLCG integers:\n"; - for (i = 0; i < 5; ++i) - cout << gen2.asLong() << " "; - cout << "\n"; - - Binomial r1( 100, 0.5, &gen1); - cout << "Binomial r1( 100, 0.50, &gen1) ...\n"; - demo(r1); - Erlang r2( 2.0, 0.5, &gen1); - cout << "Erlang r2( 2.0, 0.5, &gen1) ...\n"; - demo(r2); - Geometric r3( 0.5, &gen1); - cout << "Geometric r3(&gen1, 0.5)...\n"; - demo(r3); - HyperGeometric r4( 10.0, 150.0, &gen1); - cout << "HyperGeometric r4( 10.0, 150.0, &gen1)...\n"; - demo(r4); - NegativeExpntl r5( 1.0, &gen1); - cout << "NegativeExpntl r5( 1.0, &gen1)...\n"; - demo(r5); - Normal r6( 0.0, 1.0, &gen1); - cout << "Normal r6( 0.0, 1.0, &gen1)...\n"; - demo(r6); - LogNormal r7( 1.0, 1.0, &gen1); - cout << "LogNormal r7( 1.0, 1.0, &gen1)...\n"; - demo(r7); - Poisson r8( 2.0, &gen1); - cout << "Poisson r8( 2.0, &gen1)...\n"; - demo(r8); - DiscreteUniform r9( 0, 1, &gen1); - cout << "DiscreteUniform r9( 0.0, 1.0, &gen1)...\n"; - demo(r9); - Uniform r10( 0.0, 1.0, &gen1); - cout << "Uniform r10( 0.0, 1.0, &gen1)...\n"; - demo(r10); - Weibull r11( 0.5, 1.0, &gen1); - cout << "Weibull r11( 0.5, 1.0, &gen1)...\n"; - demo(r11); - - cout << "SampleHistogram for 100 Normal samples\n"; - SampleHistogram h(-4.0, 4.0); - for (i = 0; i < 100; ++i) - h += r6(); - h.printBuckets(cout); - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tRandom.exp b/contrib/libg++/libg++/tests/tRandom.exp deleted file mode 100644 index 9906721b030f4..0000000000000 --- a/contrib/libg++/libg++/tests/tRandom.exp +++ /dev/null @@ -1,85 +0,0 @@ -five random ACG integers: -1525072166 1954057046 3406008937 226879594 4107049426 -five random MLCG integers: -1341853672 83475514 936613571 888739672 2097844081 -Binomial r1( 100, 0.50, &gen1) ... -five samples: -45 52 59 49 60 -Statistics for 100 samples: -samples: 100 min: 40 max: 64 -mean: 50.78 stdDev: 4.42577 var: 19.5875 confidence(95): 0.878369 -Erlang r2( 2.0, 0.5, &gen1) ... -five samples: -1.79909 1.92989 2.50816 2.31409 1.48158 -Statistics for 100 samples: -samples: 100 min: 0.592645 max: 3.81874 -mean: 1.96664 stdDev: 0.696406 var: 0.484981 confidence(95): 0.138213 -Geometric r3(&gen1, 0.5)... -five samples: -3 2 2 2 3 -Statistics for 100 samples: -samples: 100 min: 1 max: 7 -mean: 1.9 stdDev: 1.28315 var: 1.64646 confidence(95): 0.254662 -HyperGeometric r4( 10.0, 150.0, &gen1)... -five samples: -15.0752 5.25802 7.82211 20.4995 7.08199 -Statistics for 100 samples: -samples: 100 min: 0.0446068 max: 131.508 -mean: 12.6763 stdDev: 16.7567 var: 280.786 confidence(95): 3.32564 -NegativeExpntl r5( 1.0, &gen1)... -five samples: -1.90665 0.0921974 0.219318 1.79202 0.566202 -Statistics for 100 samples: -samples: 100 min: 0.00794624 max: 4.23124 -mean: 0.927343 stdDev: 0.8869 var: 0.786592 confidence(95): 0.17602 -Normal r6( 0.0, 1.0, &gen1)... -five samples: --0.174892 0.148871 -0.479753 0.65432 -0.92688 -Statistics for 100 samples: -samples: 100 min: -2.22325 max: 2.61771 -mean: 0.141292 stdDev: 0.972041 var: 0.944864 confidence(95): 0.192918 -LogNormal r7( 1.0, 1.0, &gen1)... -five samples: -2.15572 0.985688 0.340019 0.959144 1.06052 -Statistics for 100 samples: -samples: 100 min: 0.0393323 max: 6.16358 -mean: 1.03547 stdDev: 0.963892 var: 0.929088 confidence(95): 0.191301 -Poisson r8( 2.0, &gen1)... -five samples: -0 2 1 2 1 -Statistics for 100 samples: -samples: 100 min: 0 max: 5 -mean: 2 stdDev: 1.31041 var: 1.71717 confidence(95): 0.260073 -DiscreteUniform r9( 0.0, 1.0, &gen1)... -five samples: -1 1 0 0 0 -Statistics for 100 samples: -samples: 100 min: 0 max: 1 -mean: 0.45 stdDev: 0.5 var: 0.25 confidence(95): 0.0992334 -Uniform r10( 0.0, 1.0, &gen1)... -five samples: -0.557314 0.529968 0.997197 0.25163 0.947497 -Statistics for 100 samples: -samples: 100 min: 0.00205286 max: 0.997197 -mean: 0.518789 stdDev: 0.321429 var: 0.103317 confidence(95): 0.0637931 -Weibull r11( 0.5, 1.0, &gen1)... -five samples: -10.4918 0.295112 0.184577 2.14799 0.10053 -Statistics for 100 samples: -samples: 100 min: 0.000236481 max: 15.4934 -mean: 1.96369 stdDev: 2.97642 var: 8.85906 confidence(95): 0.59072 -SampleHistogram for 100 Normal samples -< -4 : 0 -< -3.2 : 0 -< -2.4 : 0 -< -1.6 : 7 -< -0.8 : 15 -< -2.22045e-16 : 36 -< 0.8 : 15 -< 1.6 : 19 -< 2.4 : 7 -< 3.2 : 1 -< 4 : 0 -< max : 0 - -End of test diff --git a/contrib/libg++/libg++/tests/tRandom.inp b/contrib/libg++/libg++/tests/tRandom.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tRandom.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tRational.cc b/contrib/libg++/libg++/tests/tRational.cc deleted file mode 100644 index 2c49a814dea24..0000000000000 --- a/contrib/libg++/libg++/tests/tRational.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - a test file for Rational class - */ - -#include <Rational.h> - -#include <assert.h> - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - - -void identtest(Rational& a, Rational& b, Rational& c) -{ - Rational one(1, 1); - - assert(-(-a) == a); - assert((a + b) == (b + a)); - assert((a + (-b)) == (a - b)); - assert((a * b) == (b * a)); - assert((a * (-b)) == -(a * b)); - assert((a / (-b)) == -(a / b)); - assert((a / b) == (a * (one / b))); - assert((a / b) == (one / (b / a))); - assert((a - b) == -(b - a)); - assert((a + (b + c)) == ((a + b) + c)); - assert((a * (b * c)) == ((a * b) * c)); - assert((a * (b + c)) == ((a * b) + (a * c))); - assert(((a - b) + b) == a); - assert(((a + b) - b) == a); - assert(((a * b) / b) == a); - assert(((a / b) * b) == a); - - Rational x = a; - x *= b; - assert(x == (a * b)); - x += c; - assert(x == ((a * b) + c)); - x -= a; - assert(x == (((a * b) + c) - a)); - x /= b; - assert(x == ((((a * b) + c) - a) / b)); - - assert(x.OK()); -} - - - -void simpletest() -{ - Rational one = 1; - assert(one.OK()); - Rational third(1, 3); - assert(third.OK()); - Rational half(1, 2); - assert(half.OK()); - - Rational two(2); - Rational zero(0); - Rational r; - r = two+zero; - - cout << "one = " << one << "\n"; - cout << "two = " << r << "\n"; - cout << "third = " << third << "\n"; - cout << "half = " << half << "\n"; - - cout << "third + half = " << third + half << "\n"; - cout << "third - half = " << third - half << "\n"; - cout << "third * half = " << third * half << "\n"; - cout << "third / half = " << third / half << "\n"; - - Rational onePointTwo = 1.2; - cout << "onePointTwo = " << onePointTwo << "\n"; - cout << "double(onePointTwo) = " << double(onePointTwo) << "\n"; - - Rational a = one; - cout << "a = " << a << "\n"; - assert(a.OK()); - a += half; - cout << "a += half = " << a << "\n"; - assert(a == Rational(3, 2)); - a -= half; - cout << "a -= half = " << a << "\n"; - assert(a == Rational(1)); - a *= half; - cout << "a *= half = " << a << "\n"; - assert(a == half); - a /= half; - cout << "a /= half = " << a << "\n"; - assert(a == Rational(1)); - assert(a.OK()); - - identtest(one, one, one); - identtest(one, third, half); - identtest(third, half, one); - identtest(onePointTwo, half, a); -} - -void pitest() -{ - Rational half(1, 2); - Rational approxpi(355, 113); - assert(approxpi.OK()); - cout << "approxpi = " << approxpi << "\n"; - cout << "double(approxpi) = " << double(approxpi) << "\n"; - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - Rational rpi = Rational(M_PI); - cout << "rpi = Rational(PI) = " << rpi << "\n"; - assert(rpi.OK()); - cout << "double(rpi) = " << double(rpi) << "\n"; - - cout << "approxpi + rpi = " << approxpi + rpi << "\n"; - cout << "approxpi - rpi = " << approxpi - rpi << "\n"; - cout << "approxpi * rpi = " << approxpi * rpi << "\n"; - cout << "approxpi / rpi = " << approxpi / rpi << "\n"; - - Rational negapproxpi = -approxpi; - - cout << "-approxpi = " << negapproxpi << "\n"; - assert(sign(negapproxpi) < 0); - cout << "abs(negapproxpi) = " << abs(negapproxpi) << "\n"; - assert(abs(negapproxpi) == approxpi); - - assert(approxpi != rpi); - assert(approxpi >= rpi); - assert(approxpi > rpi); - assert(!(approxpi == rpi)); - assert(!(approxpi <= rpi)); - assert(!(approxpi < rpi)); -#if defined (__GNUC__) && ! defined (__STRICT_ANSI__) - assert((approxpi >? rpi) == approxpi); - assert((approxpi <? rpi) == rpi); -#endif - - assert(floor(approxpi) == 3); - assert(ceil(approxpi) == 4); - assert(trunc(approxpi) == 3); - assert(round(approxpi) == 3); - - assert(floor(negapproxpi + half) == -3); - assert(ceil(negapproxpi + half) == -2); - assert(trunc(negapproxpi + half) == -2); - assert(round(negapproxpi + half) == -3); - - identtest(approxpi, rpi, negapproxpi); - identtest(rpi, approxpi, rpi); - identtest(negapproxpi, half, rpi); -} - - - -void IOtest() -{ - Rational a; - cout << "\nenter a Rational in form a/b or a: "; - cin >> a; - cout << "number = " << a << "\n"; - assert(a.OK()); -} - -// as a fct just to test Rational fcts -Rational estimate_e(long n) -{ - Rational x = Rational(n + 1, n); - Rational e = pow(x, n); - return e; -} - -void etest(long n) -{ - cout << "approximating e as pow(1+1/n),n) for n =" << n << "\n"; - Rational approxe = estimate_e(n); - assert(approxe.OK()); - cout << "double(approxe) = " << double(approxe) << "\n"; - cout << "log(approxe) = " << log(approxe) << "\n"; - assert(log(approxe) <= 1.0); - cout << "approxe = " << approxe << "\n"; -} - -int main() -{ - simpletest(); - pitest(); - IOtest(); - etest(10); - etest(100); - etest(1000); - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tRational.exp b/contrib/libg++/libg++/tests/tRational.exp deleted file mode 100644 index 743aadd886277..0000000000000 --- a/contrib/libg++/libg++/tests/tRational.exp +++ /dev/null @@ -1,41 +0,0 @@ -one = 1 -two = 2 -third = 1/3 -half = 1/2 -third + half = 5/6 -third - half = -1/6 -third * half = 1/6 -third / half = 2/3 -onePointTwo = 5404319552844595/4503599627370496 -double(onePointTwo) = 1.2 -a = 1 -a += half = 3/2 -a -= half = 1 -a *= half = 1/2 -a /= half = 1 -approxpi = 355/113 -double(approxpi) = 3.14159 -rpi = Rational(PI) = 884279719003555/281474976710656 -double(rpi) = 3.14159 -approxpi + rpi = 199847224979684595/31806672368304128 -approxpi - rpi = 8484881165/31806672368304128 -approxpi * rpi = 313919300246262025/31806672368304128 -approxpi / rpi = 19984723346456576/19984721649480343 --approxpi = -355/113 -abs(negapproxpi) = 355/113 - -enter a Rational in form a/b or a: number = 61727839/49382716 -approximating e as pow(1+1/n),n) for n =10 -double(approxe) = 2.59374 -log(approxe) = 0.953102 -approxe = 25937424601/10000000000 -approximating e as pow(1+1/n),n) for n =100 -double(approxe) = 2.70481 -log(approxe) = 0.995033 -approxe = 270481382942152609326719471080753083367793838278100277689020104911710151430673927943945601434674459097335651375483564268312519281766832427980496322329650055217977882315938008175933291885667484249510001/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -approximating e as pow(1+1/n),n) for n =1000 -double(approxe) = 2.71692 -log(approxe) = 0.9995 -approxe = 2716923932235892457383088121947577188964315018836572803722354774868894945523768158997885697298661429053421034015406256924859461187617653889457753593083386399572063538500432650176144488046171044844121805479607648086607018742077798375087855857012278053105042704758822511824867218226931719410407150364389665913091822576819072281835735365786202176167228686198158460724641052407506305826211156964723064441295969498221919251479211700941935114755531972677360157561485144237786816579422141378066423317811515462669946309306263409027388915931082226854264858661420878279983534424128672461206356847463821364630504359665171573635397346037274752410368174877433941234543153511100471651472869116068528478976916600585383497180172395573924789047989563714318957536493108041591460911612078698461739084741934442448701416575483263891529095158013233115648534154086009312190489168546024398834243847135102411661996020129557921444666343641039137906807591342742464200991933722791531063202677650581946360422027765645970182463780273161113009717582155489902677095053354207944772439271656447869921825959042801322775729022491402012084605367784456090892987682547811360481731795980637847551788259384243997341190753089343387201753821360405430310320564488741142120089460368986590136324737459372963666586532443570474179352656517635333744783401695951969936296323256525034685525470426185224036844803487442831639483152362831735350269624668701702424450940840884555271325190876102665277858154695092765613639718577127438538649414492678358762110235621776218781360881010654696273264706319088453035858355052988808507775439561385232652305316287705653436727647681405618323757201022946801118770148072424021385261829594248369890171583993147934044232792517118743393217276416179842097554494269012251329134783596037733973478306188255291484352384699871420472711423079586319041837563678498472779422282261024744394844558738378027105699691260086532632930941478779680554645850778168703661423819000515895232903243738763481571999080702098369316199601942246247887808385073821861517636839926907458184604648942036355256683219218129910422822177336785268627274482037476294341444562207197209503659518266210432791078248321015453218019586608696207295299183111963158564162419152742807437346241667671688466998244424726765837682151606230638111654756595917019206453978024157097042546937345673337179165242325399648121877178987723999503839197328183925340949191821443698275476295245249466361817367207248089144718808572152781037112209285944844021186534832159964297181970584453756163204297111185823467744743465840230098261424789313315093951766314459027947176701489215746884363426961577348384651887153140609616362927338107686794499974902581579897076172716541504294334300741444106749994715713419630688719451362658288812132056854807330827050505064714442618243101018812153563795539024370219967801515099970721926240625418512417940854760415566229746248973756297569452302821563467574313259066016089521122779204844875998864114930516063910324359331903843040069467324167490917499501000001/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - -End of test diff --git a/contrib/libg++/libg++/tests/tRational.inp b/contrib/libg++/libg++/tests/tRational.inp deleted file mode 100644 index c6aff5c42011c..0000000000000 --- a/contrib/libg++/libg++/tests/tRational.inp +++ /dev/null @@ -1 +0,0 @@ -123455678/98765432 diff --git a/contrib/libg++/libg++/tests/tSet.cc b/contrib/libg++/libg++/tests/tSet.cc deleted file mode 100644 index f05ca34086a70..0000000000000 --- a/contrib/libg++/libg++/tests/tSet.cc +++ /dev/null @@ -1,744 +0,0 @@ -/* - a test file for sets -*/ - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> -#include <builtin.h> - -#define tassert(ex) { cerr << #ex; \ - if ((ex)) cerr << " OK\n"; \ - else cerr << " Fail\n"; } - -unsigned int hash(int x) { return multiplicativehash(x) ; } - -#include "iSet.h" - -int SIZE; - -int *nums; -int *odds; -int *dups; - -void printset(intSet& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - Pix i; - for (i = a.first(); i != 0 && k < maxprint; a.next(i),++k) - cout << a(i) << " "; - if (i != 0) cout << "...]\n"; - else cout << "]\n"; -} - -void add(int x[], intSet& a) -{ - for (int i = 0; i < SIZE; ++i) a.add(x[i]); -} - -#include <MLCG.h> - -MLCG randgen; - -void permute(int x[]) -{ - for (int i = 1; i < SIZE; ++i) - { - int j = randgen.asLong() % (i + 1); - int tmp = x[i]; x[i] = x[j]; x[j] = tmp; - } -} - - -void makenums() -{ - for (int i = 0; i < SIZE; ++i) nums[i] = i + 1; -} - -void makeodds() -{ - for (int i = 0; i < SIZE; ++i) odds[i] = 2 * i + 1; - permute(odds); -} - -void makedups() -{ - for (int i = 0; i < SIZE; i += 2) dups[i] = dups[i+1] = i/2 + 1; - permute(dups); -} - - -void generictest(intSet& a, intSet& b, intSet& c) -{ - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); -} - -#include "iXPSet.h" - -void XPtest() -{ - intXPSet a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intXPSet b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intXPSet c(SIZE); - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intXPSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -#include "iSLSet.h" - -void SLtest() -{ - intSLSet a; - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intSLSet b; - add(odds, b); - assert(b.length() == SIZE); - intSLSet c; - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intSLSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -#include "iVHSet.h" - -void VHtest() -{ - intVHSet a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intVHSet b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intVHSet c(SIZE); - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intVHSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iVOHSet.h" - -void VOHtest() -{ - intVOHSet a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intVOHSet b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intVOHSet c(SIZE); - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intVOHSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iCHSet.h" - -void CHtest() -{ - intCHSet a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intCHSet b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intCHSet c(SIZE); - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intCHSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iOXPSet.h" - -void OXPtest() -{ - intOXPSet a(SIZE); - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intOXPSet b(SIZE); - add(odds, b); - assert(b.length() == SIZE); - intOXPSet c(SIZE); - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intOXPSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - - -#include "iOSLSet.h" - -void OSLtest() -{ - intOSLSet a; - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intOSLSet b; - add(odds, b); - assert(b.length() == SIZE); - intOSLSet c; - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intOSLSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iBSTSet.h" - -void BSTtest() -{ - intBSTSet a; - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - a.balance(); - assert(a.OK()); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intBSTSet b; - add(odds, b); - assert(b.length() == SIZE); - intBSTSet c; - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intBSTSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iAVLSet.h" - -void AVLtest() -{ - intAVLSet a; - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intAVLSet b; - add(odds, b); - assert(b.length() == SIZE); - intAVLSet c; - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intAVLSet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - -#include "iSplaySet.h" - -void Splaytest() -{ - intSplaySet a; - add(nums, a); - assert(a.length() == SIZE); - for (int j = 1; j <= SIZE; ++j) assert(a.contains(j)); - intSplaySet b; - add(odds, b); - assert(b.length() == SIZE); - intSplaySet c; - add(dups, c); - assert(c.length() == SIZE/2); - assert(c <= a); - intSplaySet d(a); - d &= b; - cout << "a: "; printset(a); - cout << "b: "; printset(b); - cout << "c: "; printset(c); - cout << "d: "; printset(d); - assert(d.length() == SIZE/2); - for (Pix p = d.first(); p; d.next(p)) assert((d(p) & 1) != 0); - a.del(1); - assert(a.length() == SIZE-1); - assert(!a.contains(1)); - - c.clear(); - assert(c.empty()); - c |= a; - assert(c == a); - assert(c <= a); - c.del(a(a.first())); - assert(c <= a); - assert(c != a); - Pix i = a.first(); - assert(!c.contains(a(i))); - for (a.next(i); i != 0; a.next(i)) assert(c.contains(a(i))); - c.add(a(a.first())); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c |= b; - assert(b <= c); - for (i = b.first(); i != 0; b.next(i)) assert(c.contains(b(i))); - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c &= a; - for (i = a.first(); i != 0; a.next(i)) assert(c.contains(a(i))); - c -= a; - assert(!(a <= c)); - for (i = a.first(); i != 0; a.next(i)) assert(!c.contains(a(i))); - for (i = b.first(); i != 0; b.next(i)) c.del(b(i)); - assert(c.empty()); - assert(a.OK()); - assert(b.OK()); - assert(c.OK()); - - generictest(a, b, c); -} - - -int main(int argc, char** argv) -{ - if (argc > 1) - { - SIZE = abs(atoi(argv[1])); - SIZE &= ~1; - } - else - SIZE = 100; - nums = new int[SIZE]; - odds = new int[SIZE]; - dups = new int[SIZE]; - makenums(); - makeodds(); - makedups(); - start_timer(); - cout << "VHtest\n"; VHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "VOHtest\n"; VOHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "CHtest\n"; CHtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "SLtest\n"; SLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "XPtest\n"; XPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "OXPtest\n"; OXPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "OSLtest\n"; OSLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "BSTtest\n"; BSTtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "AVLtest\n"; AVLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "Splaytest\n"; Splaytest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - - return 0; -} diff --git a/contrib/libg++/libg++/tests/tSet.exp b/contrib/libg++/libg++/tests/tSet.exp deleted file mode 100644 index f014df48ec6ed..0000000000000 --- a/contrib/libg++/libg++/tests/tSet.exp +++ /dev/null @@ -1,50 +0,0 @@ -VHtest -a: [72 77 13 3 26 16 39 29 52 42 65 55 78 91 9 22 35 48 61 74 ...] -b: [167 77 13 3 193 39 139 29 93 47 65 55 155 109 91 9 117 171 35 143 ...] -c: [36 49 46 3 26 16 39 29 12 42 19 32 9 1 22 35 48 25 2 15 ...] -d: [13 3 39 29 65 55 91 9 35 61 15 41 67 25 93 11 47 87 37 73 ...] -VOHtest -a: [7 14 21 28 35 42 49 56 63 70 77 84 91 98 5 12 19 26 33 40 ...] -b: [7 163 21 133 35 49 63 199 77 129 91 181 105 119 5 155 19 187 33 193 ...] -c: [7 14 21 28 35 42 49 5 12 19 26 33 40 47 3 10 17 24 31 38 ...] -d: [7 21 35 49 63 77 91 5 19 33 47 61 75 89 3 17 31 45 59 73 ...] -CHtest -a: [72 36 85 49 13 3 98 62 26 16 75 39 29 88 52 42 6 65 55 19 ...] -b: [167 49 85 121 13 3 157 193 111 39 75 147 29 183 137 65 101 173 55 19 ...] -c: [36 13 49 3 26 16 39 29 6 42 19 32 45 9 22 35 12 48 25 38 ...] -d: [13 49 85 3 39 75 29 65 19 55 91 9 45 81 35 71 25 61 97 15 ...] -SLtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [3 197 151 161 81 69 27 37 189 147 13 75 181 117 173 11 191 185 101 105 ...] -c: [33 2 48 18 37 5 35 49 1 12 50 9 31 26 10 42 17 13 11 21 ...] -d: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -XPtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [3 197 151 161 81 69 27 37 189 147 13 75 181 117 173 11 191 185 101 105 ...] -c: [33 2 48 18 37 5 35 49 1 12 50 9 31 26 10 42 17 13 11 21 ...] -d: [51 13 53 27 55 7 57 29 59 15 61 31 63 1 65 33 67 17 69 35 ...] -OXPtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -d: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -OSLtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -d: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -BSTtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -d: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -AVLtest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -d: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -Splaytest -a: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -b: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] -c: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -d: [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 ...] diff --git a/contrib/libg++/libg++/tests/tSet.inp b/contrib/libg++/libg++/tests/tSet.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tSet.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tStack.cc b/contrib/libg++/libg++/tests/tStack.cc deleted file mode 100644 index 7435ec1d0ff68..0000000000000 --- a/contrib/libg++/libg++/tests/tStack.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* - test of stacks -*/ - -#ifdef PTIMES -const int ptimes = 1; -#else -const int ptimes = 0; -#endif - -#include <stream.h> -#include <assert.h> -#include "iStack.h" - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - - -int SIZE; - -void print(intStack& a) -{ - int maxprint = 20; - cout << "["; - int k = 0; - while (!a.empty() && k++ < maxprint) - cout << a.pop() << " "; - if (k == maxprint) - cout << "]\n"; - else - { - while (!a.empty()) a.del_top(); - cout << "...]\n"; - } - assert(a.empty()); -} - -#include "iXPStack.h" - -void XPtest () -{ - intXPStack s(SIZE/2); - assert(s.OK()); - for (int i = 0; i < SIZE; ++i) - s.push(i); - assert(s.length() == SIZE); - assert(s.top() == (SIZE-1)); - assert(!s.full()); - intXPStack s1(SIZE*2); - for (int i = 0; i < SIZE; ++i) - { - int x = s.pop(); - assert(x == (SIZE-1) - i); - s1.push(x); - } - assert(s.empty()); - assert(s1.length() == SIZE); - assert(s1.top() == 0); - assert(s.OK()); - assert(s1.OK()); - intXPStack s2 (s1); - assert(s2.length() == SIZE); - assert(s2.top() == 0); - assert(s2.OK()); - s1.clear(); - assert(s1.empty()); - s1 = s2; - assert(s1.length() == SIZE); - assert(s1.top() == 0); - assert(s1.OK()); - s1.del_top(); - assert(s1.length() == (SIZE-1)); - assert(s1.top() == 1); - cout << "s1:"; print(s1); - assert(s.OK()); - assert(s1.OK()); - assert(s2.OK()); -} - -#include "iVStack.h" - - -void Vtest () -{ - intVStack s(SIZE); - assert(s.OK()); - for (int i = 0; i < SIZE; ++i) - s.push(i); - assert(s.length() == SIZE); - assert(s.top() == (SIZE-1)); - assert(s.full()); - intVStack s1(SIZE); - for (int i = 0; i < SIZE; ++i) - { - int x = s.pop(); - assert(x == (SIZE-1) - i); - s1.push(x); - } - assert(s.empty()); - assert(s1.length() == SIZE); - assert(s1.top() == 0); - assert(s.OK()); - assert(s1.OK()); - intVStack s2 (s1); - assert(s2.length() == SIZE); - assert(s2.top() == 0); - assert(s2.OK()); - s1.clear(); - assert(s1.empty()); - s1 = s2; - assert(s1.length() == SIZE); - assert(s1.top() == 0); - assert(s1.OK()); - s1.del_top(); - assert(s1.length() == (SIZE-1)); - assert(s1.top() == 1); - cout << "s1:"; print(s1); - - assert(s.OK()); - assert(s1.OK()); - assert(s2.OK()); -} - -#include "iSLStack.h" - -void SLtest () -{ - intSLStack s; - assert(s.OK()); - for (int i = 0; i < SIZE; ++i) - s.push(i); - assert(s.length() == SIZE); - assert(s.top() == (SIZE-1)); - assert(!s.full()); - intSLStack s1; - for (int i = 0; i < SIZE; ++i) - { - int x = s.pop(); - assert(x == (SIZE-1) - i); - s1.push(x); - } - assert(s.empty()); - assert(s1.length() == SIZE); - assert(s1.top() == 0); - assert(s.OK()); - assert(s1.OK()); - intSLStack s2 (s1); - assert(s2.length() == SIZE); - assert(s2.top() == 0); - assert(s2.OK()); - s1.clear(); - assert(s1.empty()); - s1 = s2; - assert(s1.length() == SIZE); - assert(s1.top() == 0); - assert(s1.OK()); - s1.del_top(); - assert(s1.length() == (SIZE-1)); - assert(s1.top() == 1); - - cout << "s1:"; print(s1); - assert(s.OK()); - assert(s1.OK()); - assert(s2.OK()); -} - - -int main(int argv, char** argc) -{ - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - start_timer(); - cout << "XP stacks:\n"; XPtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "V stacks:\n"; Vtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - start_timer(); - cout << "SL stacks:\n"; SLtest(); - if (ptimes) cout << "\ntime = " << return_elapsed_time(0.0) << "\n"; - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tStack.exp b/contrib/libg++/libg++/tests/tStack.exp deleted file mode 100644 index a7a937abe8507..0000000000000 --- a/contrib/libg++/libg++/tests/tStack.exp +++ /dev/null @@ -1,8 +0,0 @@ -XP stacks: -s1:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -V stacks: -s1:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] -SL stacks: -s1:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...] - -End of test diff --git a/contrib/libg++/libg++/tests/tStack.inp b/contrib/libg++/libg++/tests/tStack.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tStack.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/tString.cc b/contrib/libg++/libg++/tests/tString.cc deleted file mode 100644 index e3499bf39c7bb..0000000000000 --- a/contrib/libg++/libg++/tests/tString.cc +++ /dev/null @@ -1,416 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* - A test file for Strings -*/ - -#include <String.h> -#include <stream.h> // see note below on `dec(20)' about why this will go away -#include <std.h> -#include <assert.h> - -// can't nicely echo assertions because they contain quotes - -#define tassert(ex) {if (!(ex)) \ - { cerr << "failed assertion at " << __LINE__ << "\n"; \ - abort(); } } - - String X = "Hello"; - String Y = "world"; - String N = "123"; - String c; - char* s = ","; - Regex r = "e[a-z]*o"; - -void decltest() -{ - String x; - cout << "an empty String:" << x << "\n"; - assert(x.OK()); - assert(x == ""); - - String y = "Hello"; - cout << "A string initialized to Hello:" << y << "\n"; - assert(y.OK()); - assert(y == "Hello"); - - if (y[y.length()-1] == 'o') - y = y + '\n'; - assert(y == "Hello\n"); - y = "Hello"; - - String a = y; - cout << "A string initialized to previous string:" << a << "\n"; - assert(a.OK()); - assert(a == "Hello"); - assert(a == y); - - String b (a.at(1, 2)); - cout << "A string initialized to previous string.at(1, 2):" << b << "\n"; - assert(b.OK()); - assert(b == "el"); - - char ch = '@'; - String z(ch); - cout << "A string initialized to @:" << z << "\n"; - assert(z.OK()); - assert(z == "@"); - - // XXX: `dec' is obsolete. Since String.h includes iostream.h, and not - // stream.h, we include stream.h in this file for the time being. This - // test will be rewritten to be done the "right" way, but for now, let's - // save some time and go the easy route. - String n = dec(20); - cout << "A string initialized to dec(20):" << n << "\n"; - assert(n.OK()); - assert(n == "20"); - - int i = atoi(n); - double f = atof(n); - cout << "n = " << n << " atoi(n) = " << i << " atof(n) = " << f << "\n"; - assert(i == 20); - assert(f == 20); - - assert(X.OK()); - assert(Y.OK()); - assert(x.OK()); - assert(y.OK()); - assert(z.OK()); - assert(n.OK()); - assert(r.OK()); -} - -void cattest() -{ - String x = X; - String y = Y; - String z = x + y; - cout << "z = x + y = " << z << "\n"; - assert(x.OK()); - assert(y.OK()); - assert(z.OK()); - assert(z == "Helloworld"); - - x += y; - cout << "x += y; x = " << x << "\n"; - assert(x.OK()); - assert(y.OK()); - assert(x == "Helloworld"); - - y = Y; - x = X; - y.prepend(x); - cout << "y.prepend(x); y = " << y << "\n"; - assert(y == "Helloworld"); - - y = Y; - x = X; - cat(x, y, x, x); - cout << "cat(x, y, x, x); x = " << x << "\n"; - assert(x == "HelloworldHello"); - - y = Y; - x = X; - cat(y, x, x, x); - cout << "cat(y, x, x, x); x = " << x << "\n"; - assert(x == "worldHelloHello"); - - x = X; - y = Y; - z = x + s + ' ' + y.at("w") + y.after("w") + "."; - cout << "z = x + s + + y.at(w) + y.after(w) + . = " << z << "\n"; - assert(z.OK()); - assert(z == "Hello, world."); - -} - -void comparetest() -{ - String x = X; - String y = Y; - String n = N; - String z = x + y; - - assert(x != y); - assert(x == "Hello"); - assert(x != z.at(0, 4)); - assert (x < y); - assert(!(x >= z.at(0, 6))); - assert(x.contains("He")); - assert (z.contains(x)); - assert(x.contains(r)); - - assert(!(x.matches(r))); - assert(x.matches(RXalpha)); - assert(!(n.matches(RXalpha))); - assert(n.matches(RXint)); - assert(n.matches(RXdouble)); - - assert(x.index("lo") == 3); - assert(x.index("l", 2) == 2); - assert(x.index("l", -1) == 3); - assert(x.index(r) == 1); - assert(x.index(r, -2) == 1); - - assert(x.contains("el", 1)); - assert(x.contains("el")); - - assert(common_prefix(x, "Help") == "Hel"); - assert(common_suffix(x, "to") == "o"); - - assert(fcompare(x, "hELlo") == 0); - assert(fcompare(x, "hElp") < 0); -} - -void substrtest() -{ - String x = X; - - char ch = x[0]; - cout << "ch = x[0] = " << ch << "\n"; - assert(ch == 'H'); - - String z = x.at(2, 3); - cout << "z = x.at(2, 3) = " << z << "\n"; - assert(z.OK()); - assert(z == "llo"); - - x.at(2, 2) = "r"; - cout << "x.at(2, 2) = r; x = " << x << "\n"; - assert(x.OK()); - assert(x.at(2,2).OK()); - assert(x == "Hero"); - - x = X; - x.at(0, 1) = "j"; - cout << "x.at(0, 1) = j; x = " << x << "\n"; - assert(x.OK()); - assert(x == "jello"); - - x = X; - x.at("He") = "je"; - cout << "x.at(He) = je; x = " << x << "\n"; - assert(x.OK()); - assert(x == "jello"); - - x = X; - x.at("l", -1) = "i"; - cout << "x.at(l, -1) = i; x = " << x << "\n"; - assert(x.OK()); - assert(x == "Helio"); - - x = X; - z = x.at(r); - cout << "z = x.at(r) = " << z << "\n"; - assert(z.OK()); - assert(z == "ello"); - - z = x.before("o"); - cout << "z = x.before(o) = " << z << "\n"; - assert(z.OK()); - assert(z == "Hell"); - - x.before("ll") = "Bri"; - cout << "x.before(ll) = Bri; x = " << x << "\n"; - assert(x.OK()); - assert(x == "Brillo"); - - x = X; - z = x.before(2); - cout << "z = x.before(2) = " << z << "\n"; - assert(z.OK()); - assert(z == "He"); - - z = x.after("Hel"); - cout << "z = x.after(Hel) = " << z << "\n"; - assert(z.OK()); - assert(z == "lo"); - - x.after("Hel") = "p"; - cout << "x.after(Hel) = p; x = " << x << "\n"; - assert(x.OK()); - assert(x == "Help"); - - x = X; - z = x.after(3); - cout << "z = x.after(3) = " << z << "\n"; - assert(z.OK()); - assert(z == "o"); - - z = " a bc"; - z = z.after(RXwhite); - cout << "z = a bc; z = z.after(RXwhite); z =" << z << "\n"; - assert(z.OK()); - assert(z == "a bc"); -} - - -void utiltest() -{ - String x = X; - int matches = x.gsub("l", "ll"); - cout << "x.gsub(l, ll); x = " << x << "\n"; - assert(x.OK()); - assert(matches == 2); - assert(x == "Hellllo"); - - x = X; - assert(x.OK()); - matches = x.gsub(r, "ello should have been replaced by this string"); - assert(x.OK()); - cout << "x.gsub(r, ...); x = " << x << "\n"; - assert(x.OK()); - assert(matches == 1); - assert(x == "Hello should have been replaced by this string"); - - matches = x.gsub(RXwhite, "#"); - cout << "x.gsub(RXwhite, #); x = " << x << "\n"; - assert(matches == 7); - assert(x.OK()); - - String z = X + Y; - z.del("loworl"); - cout << "z = x+y; z.del(loworl); z = " << z << "\n"; - assert(z.OK()); - assert(z == "Held"); - - x = X; - z = reverse(x); - cout << "reverse(x) = " << z << "\n"; - assert(z.OK()); - assert(z == "olleH"); - - x.reverse(); - cout << "x.reverse() = " << x << "\n"; - assert(x.OK()); - assert(x == z); - - x = X; - z = upcase(x); - cout << "upcase(x) = " << z << "\n"; - assert(z.OK()); - assert(z == "HELLO"); - - z = downcase(x); - cout << "downcase(x) = " << z << "\n"; - assert(z.OK()); - assert(z == "hello"); - - z = capitalize(x); - cout << "capitalize(x) = " << z << "\n"; - assert(z.OK()); - assert(z == "Hello"); - - /* Let's see how apostrophe is handled. */ - z = "he asked:'this is nathan's book?'. 'no, it's not',i said."; - cout << "capitalize(z) = " << capitalize (z) << "\n"; - - z = replicate('*', 10); - cout << "z = replicate(*, 10) = " << z << "\n"; - assert(z.OK()); - assert(z == "**********"); - assert(z.length() == 10); -} - -void splittest() -{ - String z = "This string\thas\nfive words"; - cout << "z = " << z << "\n"; - String w[10]; - int nw = split(z, w, 10, RXwhite); - assert(nw == 5); - cout << "from split(z, RXwhite, w, 10), n words = " << nw << ":\n"; - for (int i = 0; i < nw; ++i) - { - assert(w[i].OK()); - cout << w[i] << "\n"; - } - assert(w[0] == "This"); - assert(w[1] == "string"); - assert(w[2] == "has"); - assert(w[3] == "five"); - assert(w[4] == "words"); - assert(w[5] == (char*)0); - - z = join(w, nw, "/"); - cout << "z = join(w, nw, /); z =" << z << "\n"; - assert(z.OK()); - assert(z == "This/string/has/five/words"); -} - - -void iotest() -{ - String z; - cout << "enter a word:"; - cin >> z; - cout << "word =" << z << " "; - cout << "length = " << z.length() << "\n"; -} - -void identitytest(String a, String b) -{ - String x = a; - String y = b; - x += b; - y.prepend(a); - assert((a + b) == x); - assert((a + b) == y); - assert(x == y); - assert(x.after(a) == b); - assert(x.before(b, -1) == a); - assert(x.from(a) == x); - assert(x.through(b, -1) == x); - assert(x.at(a) == a); - assert(x.at(b) == b); - - assert(reverse(x) == reverse(b) + reverse(a)); - - assert((a + b + a) == (a + (b + a))); - - x.del(b, -1); - assert(x == a); - - y.before(b, -1) = b; - assert(y == (b + b)); - y.at(b) = a; - assert(y == (a + b)); - - x = a + reverse(a); - for (int i = 0; i < 7; ++i) - { - y = x; - x += x; - assert(x.OK()); - assert(x == reverse(x)); - assert(x.index(y) == 0); - assert(x.index(y, -1) == x.length() / 2); - } -} - -void freqtest() -{ - String x = "Hello World"; - SubString y = x.at(0,5); - assert(x.freq('l') == 3); // char - assert(x.freq("lo") == 1); // char* - assert(x.freq(x) == 1); // String - assert(x.freq(y) == 1); // SubString -} - -int main() -{ - decltest(); - cattest(); - comparetest(); - substrtest(); - utiltest(); - splittest(); - freqtest(); - identitytest(X, X); - identitytest(X, Y); - identitytest(X+Y+N+X+Y+N, "A string that will be used in identitytest but is otherwise just another useless string."); - iotest(); - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tString.exp b/contrib/libg++/libg++/tests/tString.exp deleted file mode 100644 index 4f06ffacb6674..0000000000000 --- a/contrib/libg++/libg++/tests/tString.exp +++ /dev/null @@ -1,50 +0,0 @@ -an empty String: -A string initialized to Hello:Hello -A string initialized to previous string:Hello -A string initialized to previous string.at(1, 2):el -A string initialized to @:@ -A string initialized to dec(20):20 -n = 20 atoi(n) = 20 atof(n) = 20 -z = x + y = Helloworld -x += y; x = Helloworld -y.prepend(x); y = Helloworld -cat(x, y, x, x); x = HelloworldHello -cat(y, x, x, x); x = worldHelloHello -z = x + s + + y.at(w) + y.after(w) + . = Hello, world. -ch = x[0] = H -z = x.at(2, 3) = llo -x.at(2, 2) = r; x = Hero -x.at(0, 1) = j; x = jello -x.at(He) = je; x = jello -x.at(l, -1) = i; x = Helio -z = x.at(r) = ello -z = x.before(o) = Hell -x.before(ll) = Bri; x = Brillo -z = x.before(2) = He -z = x.after(Hel) = lo -x.after(Hel) = p; x = Help -z = x.after(3) = o -z = a bc; z = z.after(RXwhite); z =a bc -x.gsub(l, ll); x = Hellllo -x.gsub(r, ...); x = Hello should have been replaced by this string -x.gsub(RXwhite, #); x = Hello#should#have#been#replaced#by#this#string -z = x+y; z.del(loworl); z = Held -reverse(x) = olleH -x.reverse() = olleH -upcase(x) = HELLO -downcase(x) = hello -capitalize(x) = Hello -capitalize(z) = He Asked:'This Is Nathan's Book?'. 'No, It's Not',I Said. -z = replicate(*, 10) = ********** -z = This string has -five words -from split(z, RXwhite, w, 10), n words = 5: -This -string -has -five -words -z = join(w, nw, /); z =This/string/has/five/words -enter a word:word =abcdefghijklmnopqrstuvwxyz length = 26 - -End of test diff --git a/contrib/libg++/libg++/tests/tString.inp b/contrib/libg++/libg++/tests/tString.inp deleted file mode 100644 index b0883f382e1a8..0000000000000 --- a/contrib/libg++/libg++/tests/tString.inp +++ /dev/null @@ -1 +0,0 @@ -abcdefghijklmnopqrstuvwxyz diff --git a/contrib/libg++/libg++/tests/tVec.cc b/contrib/libg++/libg++/tests/tVec.cc deleted file mode 100644 index 54b27564a91bf..0000000000000 --- a/contrib/libg++/libg++/tests/tVec.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - test/demo of Vecs, AVecs -*/ - -#include <stream.h> -#include "iVec.h" -#include "iAVec.h" - -int int_compare(int a, int b) -{ - return a - b; -} - -int plus(int a, int b) -{ - return a + b; -} - -int inc(int a) -{ - return a + 1; -} - -void printint(int a) -{ - cout << a << " "; -} - -void print(intVec a) -{ - a.apply(printint); - cout << "\n"; -} - -#include <MLCG.h> - -MLCG randgen; - -int main() -{ - intVec a(20); - int i; - for (i = 0; i < a.capacity(); ++i) a[i] = randgen.asLong() % 100; - cout << "a: "; print(a); - a.sort(int_compare); - cout << "a.sort():"; print(a); - intVec b = map(inc, a); - cout << "b = map(inc, a): "; print(b); - intVec c = merge(a, b, int_compare); - cout << "c = merge(a, b): "; print(c); - intVec d = concat(a, b); - cout << "d = concat(a, b): "; print(d); - d.resize(10); - cout << "d.resize(10): "; print(d); - d.reverse(); - cout << "d.reverse(): "; print(d); - d.fill(0, 4, 4); - cout << "d.fill(0, 4, 4): "; print(d); - cout << "d.reduce(plus, 0) = " << d.reduce(plus, 0) << "\n"; - intVec e = d.at(2, 5); - cout << "e = d.at(2, 5): "; print(e); - - intAVec x(20); - for (i = 0; i < x.capacity(); ++i) x[i] = i; - cout << "x: "; print(x); - intAVec y(20); - for (i = 0; i < y.capacity(); ++i) y[i] = randgen.asLong() % 100 + 1; - cout << "y: "; print(y); - - cout << "x + y: "; print(x + y); - cout << "x - y: "; print(x - y); - cout << "product(x, y): "; print(product(x,y)); - cout << "quotient(x, y): "; print(quotient(x,y)); - cout << "x * y: " << (x * y) << "\n"; - - cout << "x + 2: "; print(x + 2); - cout << "x - 2: "; print(x - 2); - cout << "x * 2: "; print(x * 2); - cout << "x / 2: "; print(x / 2); - - intAVec z(20, 1); - cout << "z(20, 1): "; print(z); - cout << "z = -z: "; print(z = -z); - cout << "z += x: "; print(z += x); - cout << "z -= x: "; print(z -= x); - - cout << "x.sum(): " << x.sum() << "\n"; - cout << "x.sumsq(): " << x.sumsq() << "\n"; - cout << "x.min(): " << x.min() << "\n"; - cout << "x.max(): " << x.max() << "\n"; - cout << "x.min_index(): " << x.min_index() << "\n"; - cout << "x.max_index(): " << x.max_index() << "\n"; - - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libg++/tests/tVec.exp b/contrib/libg++/libg++/tests/tVec.exp deleted file mode 100644 index 9a65566e95371..0000000000000 --- a/contrib/libg++/libg++/tests/tVec.exp +++ /dev/null @@ -1,33 +0,0 @@ -a: 72 14 71 72 81 29 86 49 59 84 69 10 94 41 69 95 57 78 62 82 -a.sort():10 14 29 41 49 57 59 62 69 69 71 72 72 78 81 82 84 86 94 95 -b = map(inc, a): 11 15 30 42 50 58 60 63 70 70 72 73 73 79 82 83 85 87 95 96 -c = merge(a, b): 10 11 14 15 29 30 41 42 49 50 57 58 59 60 62 63 69 69 70 70 71 72 72 72 73 73 78 79 81 82 82 83 84 85 86 87 94 95 95 96 -d = concat(a, b): 10 14 29 41 49 57 59 62 69 69 71 72 72 78 81 82 84 86 94 95 11 15 30 42 50 58 60 63 70 70 72 73 73 79 82 83 85 87 95 96 -d.resize(10): 10 14 29 41 49 57 59 62 69 69 -d.reverse(): 69 69 62 59 57 49 41 29 14 10 -d.fill(0, 4, 4): 69 69 62 59 0 0 0 0 14 10 -d.reduce(plus, 0) = 283 -e = d.at(2, 5): 62 59 0 0 0 -x: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -y: 93 96 14 74 87 41 65 6 38 17 63 37 73 46 34 50 38 55 15 76 -x + y: 93 97 16 77 91 46 71 13 46 26 73 48 85 59 48 65 54 72 33 95 -x - y: -93 -95 -12 -71 -83 -36 -59 1 -30 -8 -53 -26 -61 -33 -20 -35 -22 -38 3 -57 -product(x, y): 0 96 28 222 348 205 390 42 304 153 630 407 876 598 476 750 608 935 270 1444 -quotient(x, y): 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 -x * y: 8782 -x + 2: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 -x - 2: -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 -x * 2: 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 -x / 2: 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 -z(20, 1): 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -z = -z: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -z += x: -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 -z -= x: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -x.sum(): 190 -x.sumsq(): 2470 -x.min(): 0 -x.max(): 19 -x.min_index(): 0 -x.max_index(): 19 - -End of test diff --git a/contrib/libg++/libg++/tests/tVec.inp b/contrib/libg++/libg++/tests/tVec.inp deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/libg++/libg++/tests/tVec.inp +++ /dev/null diff --git a/contrib/libg++/libg++/tests/test_h.cc b/contrib/libg++/libg++/tests/test_h.cc deleted file mode 100644 index 10cac9b909002..0000000000000 --- a/contrib/libg++/libg++/tests/test_h.cc +++ /dev/null @@ -1,102 +0,0 @@ -// Use all the g++ headerfiles - -// $Author: jason $ -// $Revision: 1.17 $ -// $Date: 1995/06/11 19:23:13 $ - -#include <_G_config.h> -// If we have the old iostream library, it defines _OLD_STREAMS -#include <stream.h> - -#include <std.h> - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/file.h> -#if _G_HAVE_SYS_WAIT -#include <sys/wait.h> -#endif -#include <sys/signal.h> -#include <sys/stat.h> -#include <sys/times.h> - -#ifdef _OLD_STREAMS -#include <PlotFile.h> -#include <File.h> -#include <Filebuf.h> -#include <Fmodes.h> -#include <filebuf.h> -#include <SFile.h> -#endif - -#include <ACG.h> -#include <Fix.h> -#include <MLCG.h> -#include <AllocRing.h> -#include <Binomial.h> -#include <BitSet.h> -#include <BitString.h> -#include <Complex.h> -#include <DiscUnif.h> -#include <Erlang.h> -#include <GetOpt.h> -#include <Fix16.h> -#include <Fix24.h> -#include <Geom.h> -#include <Rational.h> -#include <HypGeom.h> -#include <Integer.h> -#include <Incremental.h> -#include <LogNorm.h> -#include <NegExp.h> -#include <Normal.h> -#include <Obstack.h> -#include <Pix.h> -#include <SmplHist.h> -#include <Poisson.h> -#include <RNG.h> -#include <Random.h> -#include <SmplStat.h> -#include <Regex.h> -#include <RndInt.h> -#include <builtin.h> -#include <String.h> -#include <Uniform.h> -#include <Weibull.h> - -#include <assert.h> -#include <libc.h> -#include <compare.h> -#include <ctype.h> -#include <errno.h> -#include <generic.h> -#include <grp.h> -#include <getpagesize.h> -#include <time.h> -#include <math.h> -#include <minmax.h> -#include <new.h> -#include <osfcn.h> -#include <pwd.h> -#include <setjmp.h> -#include <signal.h> -#include <stdarg.h> -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <strclass.h> -#include <string.h> -#include <swap.h> -#include <unistd.h> -#include <limits.h> -#ifdef _IO_MAGIC -#include <istream.h> -#include <streambuf.h> -#include <ostream.h> -#endif - -main() -{ - cout << "Could include all g++-include files\n"; - exit (0); -} diff --git a/contrib/libg++/libg++/tests/tiLList.cc b/contrib/libg++/libg++/tests/tiLList.cc deleted file mode 100644 index d9f43ca7e81df..0000000000000 --- a/contrib/libg++/libg++/tests/tiLList.cc +++ /dev/null @@ -1,271 +0,0 @@ -#include <_G_config.h> - -#ifdef _G_NO_TEMPLATESS - -main() -{ - fprintf(stderr, "(template-based classes not available)\n"); - return 0; -} -#else - -/* - test/demo of linked structures -*/ - - -#include <assert.h> - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - -#include <iostream.h> -#include "SLList.h" -#include "DLList.h" - -void printlist(SLList<int>& l) -{ - for (Pix p = l.first(); p != 0; l.next(p)) cout << l(p) << " "; - cout << "\n"; -} - - -void SLtest() -{ - int i; - SLList<int> a; - assert(a.OK()); - assert(a.empty()); - cout << "prepending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == i); - a.prepend(i); - assert(a.front() == i); - } - cout << "a: "; printlist(a); - cout << "appending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == 10 + i); - a.append(i); - assert(a.rear() == i); - } - cout << "a: "; printlist(a); - SLList<int> b = a; - cout << "b = a: " << "\n"; printlist(b); - assert(b.OK()); - assert(b.length() == a.length()); - assert(b.front() == a.front()); - assert(b.rear() == a.rear()); - cout << "remove_front of first 10 elements:\n"; - for (i = 0; i < 10; ++i) - { - assert(b.length() == 20 - i); - assert(b.front() == 9 - i); - b.remove_front(); - } - assert(b.length() == 10); - cout << "b: "; printlist(b); - - cout << "inserting 100 after sixth element...\n"; - Pix bp = b.first(); - for (i = 0; i < 5; ++i) b.next(bp); - b.ins_after(bp, 100); - assert(b.length() == 11); - cout << "b: "; printlist(b); - a.join(b); - cout << "after a.join(b)\n"; printlist(a); - assert(b.empty()); - assert(a.length() == 31); - cout << "b: " << "\n"; printlist(b); - b.prepend(999); - cout << "b: " << "\n"; printlist(b); - assert(b.length() == 1); - assert(b.front() == 999); - assert(b.rear() == 999); - assert(b.OK()); - SLList<int> bb = b; - cout << "bb: " << "\n"; printlist(bb); - assert(bb.OK()); - assert(bb.length() == 1); - assert(bb.front() == 999); - assert(bb.rear() == 999); - assert(bb.remove_front() == 999); - b.prepend(1234); - assert(b.length() == 2); - b.del_after(b.first()); - assert(b.rear() == 1234); - assert(b.length() == 1); - b.del_after(0); - assert(b.length() == 0); - - assert(a.OK()); - assert(b.OK()); - assert(bb.OK()); -} - -void printDlist(DLList<int>& l) -{ - for (Pix p = l.first(); p != 0; l.next(p)) cout << l(p) << " "; - cout << "\n"; -} - -void DLtest() -{ - int i; - DLList<int> a; - assert(a.OK()); - assert(a.empty()); - assert(a.length() == 0); - cout << "prepending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == i); - a.prepend(i); - assert(a.front() == i); - } - cout << "a: " << "\n"; printDlist(a); - cout << "appending...\n"; - for (i = 0; i < 10; ++i) - { - assert(a.length() == 10 + i); - a.append(i); - assert(a.rear() == i); - } - cout << "a: "; printDlist(a); - DLList<int> b = a; - assert(b.OK()); - assert(b.length() == a.length()); - assert(b.front() == a.front()); - assert(b.rear() == a.rear()); - cout << "b = a: "; printDlist(b); - cout << "remove_front of first 10 elements:\n"; - for (i = 0; i < 10; ++i) - { - assert(b.length() == 20 - i); - assert(b.front() == 9 - i); - b.remove_front(); - } - assert(b.length() == 10); - cout << "b: "; printDlist(b); - - cout << "inserting 100 after sixth element...\n"; - Pix bp = b.first(); - for (i = 0; i < 5; ++i) b.next(bp); - b.ins_after(bp, 100); - assert(b.length() == 11); - cout << "b: "; printDlist(b); - DLList<int> aa = a; - aa.join(b); - cout << "after aa = a; aa.join(b)\n"; printDlist(aa); - assert(aa.length() == 31); - assert(b.empty()); - cout << "b: " << "\n"; printDlist(b); - b.prepend(999); - cout << "b: " << "\n"; printDlist(b); - assert(b.length() == 1); - assert(b.front() == 999); - assert(b.rear() == 999); - assert(b.OK()); - DLList<int> bb = b; - cout << "bb: " << "\n"; printDlist(bb); - assert(bb.OK()); - assert(bb.length() == 1); - assert(bb.front() == 999); - assert(bb.rear() == 999); - assert(bb.remove_front() == 999); - assert(bb.OK()); - b.prepend(1234); - assert(b.length() == 2); - bp = b.first(); - b.next(bp); - b.del(bp, -1); - assert(b.rear() == 1234); - assert(b.length() == 1); - b.del(bp); - assert(b.length() == 0); - - DLList<int> z = a; - cout << "z = a: "; printDlist(z); - assert(z.OK()); - assert(z.length() == 20); - cout << "remove_rear of last 10 elements:\n"; - for (i = 0; i < 10; ++i) - { - assert(z.length() == 20 - i); - assert(z.rear() == 9 - i); - z.remove_rear(); - } - assert(z.length() == 10); - - cout << "z: "; printDlist(z); - - cout << "inserting 100 before alternate elements...\n"; - Pix zp; - for (zp = z.first(); zp; z.next(zp)) - { - z.ins_before(zp, 100); - } - assert(z.length() == 20); - cout << "z: "; printDlist(z); - - cout << "inserting 200 after sixth element...\n"; - zp = z.first(); - for (i = 0; i < 5; ++i) z.next(zp); - z.ins_after(zp, 200); - assert(z.length() == 21); - cout << "z: "; printDlist(z); - - cout << "deleting alternate elements of z..."; - for (zp = z.first(); zp; z.next(zp)) - { - cout << z(zp) << " "; - z.del(zp); - } - cout << "\n"; - assert(z.length() == 10); - cout << "z: "; printDlist(z); - - cout << "z in reverse order:\n"; - for (zp = z.last(); zp; z.prev(zp)) cout << z(zp) << " "; - cout << "\n"; - z.clear(); - assert(z.OK()); - assert(z.empty()); - assert(a.OK()); - assert(b.OK()); -} - -class X -{ -public: - X() { cout << "default ctor called\n"; } - X(const X&) { cout << "copy ctor called\n"; } - ~X() { cout << "dtor called\n"; } -}; - -main() -{ - SLtest(); - DLtest(); - - cout << "\n"; - /* Test case from Magnus Nordborg <magnus@mimer.cap.ed.ac.uk> */ - DLList<X> l; - l.append(X()); - Pix f = l.first(); - l.del(f); - - cout << "\nEnd of test\n"; - return 0; -} - -template class SLNode<int>; -template class SLList<int>; -template class DLNode<int>; -template class DLList<int>; - -template class DLNode<X>; -template class DLList<X>; -#endif diff --git a/contrib/libg++/libg++/tests/tiLList.exp b/contrib/libg++/libg++/tests/tiLList.exp deleted file mode 100644 index 2e7646e5c04b9..0000000000000 --- a/contrib/libg++/libg++/tests/tiLList.exp +++ /dev/null @@ -1,54 +0,0 @@ -prepending... -a: 9 8 7 6 5 4 3 2 1 0 -appending... -a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -b = a: -9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -remove_front of first 10 elements: -b: 0 1 2 3 4 5 6 7 8 9 -inserting 100 after sixth element... -b: 0 1 2 3 4 5 100 6 7 8 9 -after a.join(b) -9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 100 6 7 8 9 -b: - -b: -999 -bb: -999 -prepending... -a: -9 8 7 6 5 4 3 2 1 0 -appending... -a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -b = a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -remove_front of first 10 elements: -b: 0 1 2 3 4 5 6 7 8 9 -inserting 100 after sixth element... -b: 0 1 2 3 4 5 100 6 7 8 9 -after aa = a; aa.join(b) -9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 100 6 7 8 9 -b: - -b: -999 -bb: -999 -z = a: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 -remove_rear of last 10 elements: -z: 9 8 7 6 5 4 3 2 1 0 -inserting 100 before alternate elements... -z: 100 9 100 8 100 7 100 6 100 5 100 4 100 3 100 2 100 1 100 0 -inserting 200 after sixth element... -z: 100 9 100 8 100 7 200 100 6 100 5 100 4 100 3 100 2 100 1 100 0 -deleting alternate elements of z...100 100 100 200 6 5 4 3 2 1 0 -z: 9 8 7 100 100 100 100 100 100 100 -z in reverse order: -100 100 100 100 100 100 100 7 8 9 - -default ctor called -copy ctor called -dtor called -dtor called - -End of test |