summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am54
-rw-r--r--tests/Makefile.in609
-rw-r--r--tests/casttest.cpp15
-rw-r--r--tests/complzss.cpp109
-rw-r--r--tests/compnone.cpp109
-rw-r--r--tests/compzip.cpp107
-rw-r--r--tests/configtest.cpp13
-rw-r--r--tests/filtertest.cpp18
-rw-r--r--tests/genbooktest.cpp174
-rw-r--r--tests/icutest.cpp34
-rw-r--r--tests/indextest.cpp19
-rw-r--r--tests/introtest.cpp22
-rw-r--r--tests/keycast.cpp29
-rw-r--r--tests/keytest.cpp169
-rw-r--r--tests/listtest.cpp59
-rw-r--r--tests/localetest.cpp29
-rw-r--r--tests/mgrtest.cpp29
-rw-r--r--tests/modtest.cpp28
-rw-r--r--tests/parsekey.cpp31
-rw-r--r--tests/romantest.cpp24
-rw-r--r--tests/swaptest.cpp9
-rw-r--r--tests/testblocks.cpp85
-rw-r--r--tests/treeidxtest.cpp132
23 files changed, 1907 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..6d61354
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,54 @@
+AUTOMAKE_OPTIONS = 1.5
+INCLUDES = -I $(top_srcdir)/include
+LDADD = -L$(top_builddir)/lib -lsword
+
+
+noinst_PROGRAMS = keytest mgrtest parsekey listtest casttest modtest \
+compnone complzss localetest keycast introtest indextest configtest \
+romantest testblocks filtertest swaptest genbooktest treeidxtest
+
+if ICU
+ICUPROG = icutest
+else
+ICUPROG =
+endif
+
+noinst_PROGRAMS += $(ICUPROG)
+
+if ICU
+icutest_SOURCES = icutest.cpp
+icutest_LDADD = -licui18n -licuuc
+endif
+
+if ZLIB
+ZLIBPROG = compzip
+else
+ZLIBPROG =
+endif
+
+noinst_PROGRAMS += $(ZLIBPROG)
+
+if ZLIB
+compzip_SOURCES = compzip.cpp
+endif
+
+
+keytest_SOURCES = keytest.cpp
+mgrtest_SOURCES = mgrtest.cpp
+parsekey_SOURCES = parsekey.cpp
+listtest_SOURCES = listtest.cpp
+casttest_SOURCES = casttest.cpp
+modtest_SOURCES = modtest.cpp
+compnone_SOURCES = compnone.cpp
+complzss_SOURCES = complzss.cpp
+localetest_SOURCES = localetest.cpp
+keycast_SOURCES = keycast.cpp
+introtest_SOURCES = introtest.cpp
+indextest_SOURCES = indextest.cpp
+configtest_SOURCES = configtest.cpp
+romantest_SOURCES = romantest.cpp
+testblocks_SOURCES = testblocks.cpp
+filtertest_SOURCES = filtertest.cpp
+swaptest_SOURCES = swaptest.cpp
+treeidxtest_SOURCES = treeidxtest.cpp
+genbooktest_SOURCES = genbooktest.cpp
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..d8fc2b5
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,609 @@
+# Makefile.in generated by automake 1.6 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+AMTAR = @AMTAR@
+AS = @AS@
+AWK = @AWK@
+CC = @CC@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+OBJDUMP = @OBJDUMP@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+dir_confdef = @dir_confdef@
+enable_debug = @enable_debug@
+enable_profile = @enable_profile@
+enable_vcl = @enable_vcl@
+install_sh = @install_sh@
+target_cpu = @target_cpu@
+target_mingw32 = @target_mingw32@
+target_os = @target_os@
+target_system = @target_system@
+target_vendor = @target_vendor@
+with_conf = @with_conf@
+with_icu = @with_icu@
+with_zlib = @with_zlib@
+AUTOMAKE_OPTIONS = 1.5
+INCLUDES = -I $(top_srcdir)/include
+LDADD = -L$(top_builddir)/lib -lsword
+
+noinst_PROGRAMS = keytest mgrtest parsekey listtest casttest modtest \
+compnone complzss localetest keycast introtest indextest configtest \
+romantest testblocks filtertest swaptest genbooktest treeidxtest\
+$(ICUPROG) $(ZLIBPROG)
+
+@ICU_TRUE@ICUPROG = icutest
+@ICU_FALSE@ICUPROG =
+
+@ICU_TRUE@icutest_SOURCES = icutest.cpp
+@ICU_TRUE@icutest_LDADD = -licui18n -licuuc
+
+@ZLIB_TRUE@ZLIBPROG = compzip
+@ZLIB_FALSE@ZLIBPROG =
+
+@ZLIB_TRUE@compzip_SOURCES = compzip.cpp
+
+keytest_SOURCES = keytest.cpp
+mgrtest_SOURCES = mgrtest.cpp
+parsekey_SOURCES = parsekey.cpp
+listtest_SOURCES = listtest.cpp
+casttest_SOURCES = casttest.cpp
+modtest_SOURCES = modtest.cpp
+compnone_SOURCES = compnone.cpp
+complzss_SOURCES = complzss.cpp
+localetest_SOURCES = localetest.cpp
+keycast_SOURCES = keycast.cpp
+introtest_SOURCES = introtest.cpp
+indextest_SOURCES = indextest.cpp
+configtest_SOURCES = configtest.cpp
+romantest_SOURCES = romantest.cpp
+testblocks_SOURCES = testblocks.cpp
+filtertest_SOURCES = filtertest.cpp
+swaptest_SOURCES = swaptest.cpp
+treeidxtest_SOURCES = treeidxtest.cpp
+genbooktest_SOURCES = genbooktest.cpp
+subdir = tests
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+@ICU_FALSE@@ZLIB_TRUE@noinst_PROGRAMS = keytest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ mgrtest$(EXEEXT) parsekey$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ listtest$(EXEEXT) casttest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ modtest$(EXEEXT) compnone$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ complzss$(EXEEXT) localetest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ keycast$(EXEEXT) introtest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ indextest$(EXEEXT) configtest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ romantest$(EXEEXT) testblocks$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ filtertest$(EXEEXT) swaptest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ genbooktest$(EXEEXT) treeidxtest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_TRUE@ compzip$(EXEEXT)
+@ICU_FALSE@@ZLIB_FALSE@noinst_PROGRAMS = keytest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ mgrtest$(EXEEXT) parsekey$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ listtest$(EXEEXT) casttest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ modtest$(EXEEXT) compnone$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ complzss$(EXEEXT) localetest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ keycast$(EXEEXT) introtest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ indextest$(EXEEXT) configtest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ romantest$(EXEEXT) testblocks$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ filtertest$(EXEEXT) swaptest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ genbooktest$(EXEEXT) \
+@ICU_FALSE@@ZLIB_FALSE@ treeidxtest$(EXEEXT)
+@ICU_TRUE@@ZLIB_TRUE@noinst_PROGRAMS = keytest$(EXEEXT) mgrtest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ parsekey$(EXEEXT) listtest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ casttest$(EXEEXT) modtest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ compnone$(EXEEXT) complzss$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ localetest$(EXEEXT) keycast$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ introtest$(EXEEXT) indextest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ configtest$(EXEEXT) romantest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ testblocks$(EXEEXT) filtertest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ swaptest$(EXEEXT) genbooktest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ treeidxtest$(EXEEXT) icutest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_TRUE@ compzip$(EXEEXT)
+@ICU_TRUE@@ZLIB_FALSE@noinst_PROGRAMS = keytest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ mgrtest$(EXEEXT) parsekey$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ listtest$(EXEEXT) casttest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ modtest$(EXEEXT) compnone$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ complzss$(EXEEXT) localetest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ keycast$(EXEEXT) introtest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ indextest$(EXEEXT) configtest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ romantest$(EXEEXT) testblocks$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ filtertest$(EXEEXT) swaptest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ genbooktest$(EXEEXT) treeidxtest$(EXEEXT) \
+@ICU_TRUE@@ZLIB_FALSE@ icutest$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+
+am_casttest_OBJECTS = casttest.$(OBJEXT)
+casttest_OBJECTS = $(am_casttest_OBJECTS)
+casttest_LDADD = $(LDADD)
+casttest_DEPENDENCIES =
+casttest_LDFLAGS =
+am_complzss_OBJECTS = complzss.$(OBJEXT)
+complzss_OBJECTS = $(am_complzss_OBJECTS)
+complzss_LDADD = $(LDADD)
+complzss_DEPENDENCIES =
+complzss_LDFLAGS =
+am_compnone_OBJECTS = compnone.$(OBJEXT)
+compnone_OBJECTS = $(am_compnone_OBJECTS)
+compnone_LDADD = $(LDADD)
+compnone_DEPENDENCIES =
+compnone_LDFLAGS =
+@ZLIB_TRUE@am_compzip_OBJECTS = compzip.$(OBJEXT)
+compzip_OBJECTS = $(am_compzip_OBJECTS)
+compzip_LDADD = $(LDADD)
+compzip_DEPENDENCIES =
+compzip_LDFLAGS =
+am_configtest_OBJECTS = configtest.$(OBJEXT)
+configtest_OBJECTS = $(am_configtest_OBJECTS)
+configtest_LDADD = $(LDADD)
+configtest_DEPENDENCIES =
+configtest_LDFLAGS =
+am_filtertest_OBJECTS = filtertest.$(OBJEXT)
+filtertest_OBJECTS = $(am_filtertest_OBJECTS)
+filtertest_LDADD = $(LDADD)
+filtertest_DEPENDENCIES =
+filtertest_LDFLAGS =
+am_genbooktest_OBJECTS = genbooktest.$(OBJEXT)
+genbooktest_OBJECTS = $(am_genbooktest_OBJECTS)
+genbooktest_LDADD = $(LDADD)
+genbooktest_DEPENDENCIES =
+genbooktest_LDFLAGS =
+@ICU_TRUE@am_icutest_OBJECTS = icutest.$(OBJEXT)
+icutest_OBJECTS = $(am_icutest_OBJECTS)
+@ICU_TRUE@icutest_DEPENDENCIES =
+@ICU_FALSE@icutest_DEPENDENCIES =
+icutest_LDFLAGS =
+am_indextest_OBJECTS = indextest.$(OBJEXT)
+indextest_OBJECTS = $(am_indextest_OBJECTS)
+indextest_LDADD = $(LDADD)
+indextest_DEPENDENCIES =
+indextest_LDFLAGS =
+am_introtest_OBJECTS = introtest.$(OBJEXT)
+introtest_OBJECTS = $(am_introtest_OBJECTS)
+introtest_LDADD = $(LDADD)
+introtest_DEPENDENCIES =
+introtest_LDFLAGS =
+am_keycast_OBJECTS = keycast.$(OBJEXT)
+keycast_OBJECTS = $(am_keycast_OBJECTS)
+keycast_LDADD = $(LDADD)
+keycast_DEPENDENCIES =
+keycast_LDFLAGS =
+am_keytest_OBJECTS = keytest.$(OBJEXT)
+keytest_OBJECTS = $(am_keytest_OBJECTS)
+keytest_LDADD = $(LDADD)
+keytest_DEPENDENCIES =
+keytest_LDFLAGS =
+am_listtest_OBJECTS = listtest.$(OBJEXT)
+listtest_OBJECTS = $(am_listtest_OBJECTS)
+listtest_LDADD = $(LDADD)
+listtest_DEPENDENCIES =
+listtest_LDFLAGS =
+am_localetest_OBJECTS = localetest.$(OBJEXT)
+localetest_OBJECTS = $(am_localetest_OBJECTS)
+localetest_LDADD = $(LDADD)
+localetest_DEPENDENCIES =
+localetest_LDFLAGS =
+am_mgrtest_OBJECTS = mgrtest.$(OBJEXT)
+mgrtest_OBJECTS = $(am_mgrtest_OBJECTS)
+mgrtest_LDADD = $(LDADD)
+mgrtest_DEPENDENCIES =
+mgrtest_LDFLAGS =
+am_modtest_OBJECTS = modtest.$(OBJEXT)
+modtest_OBJECTS = $(am_modtest_OBJECTS)
+modtest_LDADD = $(LDADD)
+modtest_DEPENDENCIES =
+modtest_LDFLAGS =
+am_parsekey_OBJECTS = parsekey.$(OBJEXT)
+parsekey_OBJECTS = $(am_parsekey_OBJECTS)
+parsekey_LDADD = $(LDADD)
+parsekey_DEPENDENCIES =
+parsekey_LDFLAGS =
+am_romantest_OBJECTS = romantest.$(OBJEXT)
+romantest_OBJECTS = $(am_romantest_OBJECTS)
+romantest_LDADD = $(LDADD)
+romantest_DEPENDENCIES =
+romantest_LDFLAGS =
+am_swaptest_OBJECTS = swaptest.$(OBJEXT)
+swaptest_OBJECTS = $(am_swaptest_OBJECTS)
+swaptest_LDADD = $(LDADD)
+swaptest_DEPENDENCIES =
+swaptest_LDFLAGS =
+am_testblocks_OBJECTS = testblocks.$(OBJEXT)
+testblocks_OBJECTS = $(am_testblocks_OBJECTS)
+testblocks_LDADD = $(LDADD)
+testblocks_DEPENDENCIES =
+testblocks_LDFLAGS =
+am_treeidxtest_OBJECTS = treeidxtest.$(OBJEXT)
+treeidxtest_OBJECTS = $(am_treeidxtest_OBJECTS)
+treeidxtest_LDADD = $(LDADD)
+treeidxtest_DEPENDENCIES =
+treeidxtest_LDFLAGS =
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/casttest.Po ./$(DEPDIR)/complzss.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/compnone.Po ./$(DEPDIR)/compzip.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/configtest.Po ./$(DEPDIR)/filtertest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/genbooktest.Po ./$(DEPDIR)/icutest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/indextest.Po ./$(DEPDIR)/introtest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/keycast.Po ./$(DEPDIR)/keytest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/listtest.Po ./$(DEPDIR)/localetest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/mgrtest.Po ./$(DEPDIR)/modtest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/parsekey.Po ./$(DEPDIR)/romantest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/swaptest.Po ./$(DEPDIR)/testblocks.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/treeidxtest.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXFLAGS = @CXXFLAGS@
+DIST_SOURCES = $(casttest_SOURCES) $(complzss_SOURCES) \
+ $(compnone_SOURCES) $(compzip_SOURCES) $(configtest_SOURCES) \
+ $(filtertest_SOURCES) $(genbooktest_SOURCES) $(icutest_SOURCES) \
+ $(indextest_SOURCES) $(introtest_SOURCES) $(keycast_SOURCES) \
+ $(keytest_SOURCES) $(listtest_SOURCES) $(localetest_SOURCES) \
+ $(mgrtest_SOURCES) $(modtest_SOURCES) $(parsekey_SOURCES) \
+ $(romantest_SOURCES) $(swaptest_SOURCES) $(testblocks_SOURCES) \
+ $(treeidxtest_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(casttest_SOURCES) $(complzss_SOURCES) $(compnone_SOURCES) $(compzip_SOURCES) $(configtest_SOURCES) $(filtertest_SOURCES) $(genbooktest_SOURCES) $(icutest_SOURCES) $(indextest_SOURCES) $(introtest_SOURCES) $(keycast_SOURCES) $(keytest_SOURCES) $(listtest_SOURCES) $(localetest_SOURCES) $(mgrtest_SOURCES) $(modtest_SOURCES) $(parsekey_SOURCES) $(romantest_SOURCES) $(swaptest_SOURCES) $(testblocks_SOURCES) $(treeidxtest_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu tests/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+casttest$(EXEEXT): $(casttest_OBJECTS) $(casttest_DEPENDENCIES)
+ @rm -f casttest$(EXEEXT)
+ $(CXXLINK) $(casttest_LDFLAGS) $(casttest_OBJECTS) $(casttest_LDADD) $(LIBS)
+complzss$(EXEEXT): $(complzss_OBJECTS) $(complzss_DEPENDENCIES)
+ @rm -f complzss$(EXEEXT)
+ $(CXXLINK) $(complzss_LDFLAGS) $(complzss_OBJECTS) $(complzss_LDADD) $(LIBS)
+compnone$(EXEEXT): $(compnone_OBJECTS) $(compnone_DEPENDENCIES)
+ @rm -f compnone$(EXEEXT)
+ $(CXXLINK) $(compnone_LDFLAGS) $(compnone_OBJECTS) $(compnone_LDADD) $(LIBS)
+compzip$(EXEEXT): $(compzip_OBJECTS) $(compzip_DEPENDENCIES)
+ @rm -f compzip$(EXEEXT)
+ $(CXXLINK) $(compzip_LDFLAGS) $(compzip_OBJECTS) $(compzip_LDADD) $(LIBS)
+configtest$(EXEEXT): $(configtest_OBJECTS) $(configtest_DEPENDENCIES)
+ @rm -f configtest$(EXEEXT)
+ $(CXXLINK) $(configtest_LDFLAGS) $(configtest_OBJECTS) $(configtest_LDADD) $(LIBS)
+filtertest$(EXEEXT): $(filtertest_OBJECTS) $(filtertest_DEPENDENCIES)
+ @rm -f filtertest$(EXEEXT)
+ $(CXXLINK) $(filtertest_LDFLAGS) $(filtertest_OBJECTS) $(filtertest_LDADD) $(LIBS)
+genbooktest$(EXEEXT): $(genbooktest_OBJECTS) $(genbooktest_DEPENDENCIES)
+ @rm -f genbooktest$(EXEEXT)
+ $(CXXLINK) $(genbooktest_LDFLAGS) $(genbooktest_OBJECTS) $(genbooktest_LDADD) $(LIBS)
+icutest$(EXEEXT): $(icutest_OBJECTS) $(icutest_DEPENDENCIES)
+ @rm -f icutest$(EXEEXT)
+ $(CXXLINK) $(icutest_LDFLAGS) $(icutest_OBJECTS) $(icutest_LDADD) $(LIBS)
+indextest$(EXEEXT): $(indextest_OBJECTS) $(indextest_DEPENDENCIES)
+ @rm -f indextest$(EXEEXT)
+ $(CXXLINK) $(indextest_LDFLAGS) $(indextest_OBJECTS) $(indextest_LDADD) $(LIBS)
+introtest$(EXEEXT): $(introtest_OBJECTS) $(introtest_DEPENDENCIES)
+ @rm -f introtest$(EXEEXT)
+ $(CXXLINK) $(introtest_LDFLAGS) $(introtest_OBJECTS) $(introtest_LDADD) $(LIBS)
+keycast$(EXEEXT): $(keycast_OBJECTS) $(keycast_DEPENDENCIES)
+ @rm -f keycast$(EXEEXT)
+ $(CXXLINK) $(keycast_LDFLAGS) $(keycast_OBJECTS) $(keycast_LDADD) $(LIBS)
+keytest$(EXEEXT): $(keytest_OBJECTS) $(keytest_DEPENDENCIES)
+ @rm -f keytest$(EXEEXT)
+ $(CXXLINK) $(keytest_LDFLAGS) $(keytest_OBJECTS) $(keytest_LDADD) $(LIBS)
+listtest$(EXEEXT): $(listtest_OBJECTS) $(listtest_DEPENDENCIES)
+ @rm -f listtest$(EXEEXT)
+ $(CXXLINK) $(listtest_LDFLAGS) $(listtest_OBJECTS) $(listtest_LDADD) $(LIBS)
+localetest$(EXEEXT): $(localetest_OBJECTS) $(localetest_DEPENDENCIES)
+ @rm -f localetest$(EXEEXT)
+ $(CXXLINK) $(localetest_LDFLAGS) $(localetest_OBJECTS) $(localetest_LDADD) $(LIBS)
+mgrtest$(EXEEXT): $(mgrtest_OBJECTS) $(mgrtest_DEPENDENCIES)
+ @rm -f mgrtest$(EXEEXT)
+ $(CXXLINK) $(mgrtest_LDFLAGS) $(mgrtest_OBJECTS) $(mgrtest_LDADD) $(LIBS)
+modtest$(EXEEXT): $(modtest_OBJECTS) $(modtest_DEPENDENCIES)
+ @rm -f modtest$(EXEEXT)
+ $(CXXLINK) $(modtest_LDFLAGS) $(modtest_OBJECTS) $(modtest_LDADD) $(LIBS)
+parsekey$(EXEEXT): $(parsekey_OBJECTS) $(parsekey_DEPENDENCIES)
+ @rm -f parsekey$(EXEEXT)
+ $(CXXLINK) $(parsekey_LDFLAGS) $(parsekey_OBJECTS) $(parsekey_LDADD) $(LIBS)
+romantest$(EXEEXT): $(romantest_OBJECTS) $(romantest_DEPENDENCIES)
+ @rm -f romantest$(EXEEXT)
+ $(CXXLINK) $(romantest_LDFLAGS) $(romantest_OBJECTS) $(romantest_LDADD) $(LIBS)
+swaptest$(EXEEXT): $(swaptest_OBJECTS) $(swaptest_DEPENDENCIES)
+ @rm -f swaptest$(EXEEXT)
+ $(CXXLINK) $(swaptest_LDFLAGS) $(swaptest_OBJECTS) $(swaptest_LDADD) $(LIBS)
+testblocks$(EXEEXT): $(testblocks_OBJECTS) $(testblocks_DEPENDENCIES)
+ @rm -f testblocks$(EXEEXT)
+ $(CXXLINK) $(testblocks_LDFLAGS) $(testblocks_OBJECTS) $(testblocks_LDADD) $(LIBS)
+treeidxtest$(EXEEXT): $(treeidxtest_OBJECTS) $(treeidxtest_DEPENDENCIES)
+ @rm -f treeidxtest$(EXEEXT)
+ $(CXXLINK) $(treeidxtest_LDFLAGS) $(treeidxtest_OBJECTS) $(treeidxtest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/casttest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complzss.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compnone.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compzip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/configtest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtertest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genbooktest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icutest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indextest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/introtest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keycast.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keytest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listtest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localetest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgrtest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modtest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsekey.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/romantest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swaptest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testblocks.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treeidxtest.Po@am__quote@
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.cpp.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+
+.cpp.lo:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(LTCXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+CXXDEPMODE = @CXXDEPMODE@
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir)$$dir \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS distclean distclean-compile \
+ distclean-depend distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ tags uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/casttest.cpp b/tests/casttest.cpp
new file mode 100644
index 0000000..5652e0a
--- /dev/null
+++ b/tests/casttest.cpp
@@ -0,0 +1,15 @@
+#include <iostream.h>
+#include <versekey.h>
+int main(int argc, char **argv) {
+ VerseKey x("jas");
+ SWKey *y = &x;
+ VerseKey *v = &x;
+
+ v = SWDYNAMIC_CAST(VerseKey, y);
+ if (v)
+ cout << (const char *)(*v);
+ else
+ cout << "cast failed\n";
+
+ return 0;
+}
diff --git a/tests/complzss.cpp b/tests/complzss.cpp
new file mode 100644
index 0000000..ed1cacb
--- /dev/null
+++ b/tests/complzss.cpp
@@ -0,0 +1,109 @@
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <lzsscomprs.h>
+
+class FileCompress: public LZSSCompress {
+ int ifd;
+ int ofd;
+ int ufd;
+ int zfd;
+public:
+ FileCompress(char *);
+ ~FileCompress();
+ unsigned long GetChars(char *, unsigned long len);
+ unsigned long SendChars(char *, unsigned long len);
+ void Encode();
+ void Decode();
+};
+
+
+FileCompress::FileCompress(char *fname)
+{
+ char buf[256];
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+ ufd = open(fname, O_RDWR|O_CREAT|O_BINARY, 00644);
+
+ sprintf(buf, "%s.lzs", fname);
+ zfd = open(buf, O_RDWR|O_CREAT|O_BINARY, 00644);
+}
+
+
+FileCompress::~FileCompress()
+{
+ close(ufd);
+ close(zfd);
+}
+
+
+unsigned long FileCompress::GetChars(char *buf, unsigned long len)
+{
+ return read(ifd, buf, len);
+}
+
+
+unsigned long FileCompress::SendChars(char *buf, unsigned long len)
+{
+ return write(ofd, buf, len);
+}
+
+
+void FileCompress::Encode()
+{
+ ifd = ufd;
+ ofd = zfd;
+
+ LZSSCompress::Encode();
+}
+
+
+void FileCompress::Decode()
+{
+ ifd = zfd;
+ ofd = ufd;
+
+ LZSSCompress::Decode();
+}
+
+
+int main(int argc, char **argv)
+{
+ int decomp = 0;
+ SWCompress *fobj;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <filename|filename.lzs>\n", argv[0]);
+ exit(1);
+ }
+
+ if (strlen(argv[1]) > 4) {
+ if (!strcmp(&argv[1][strlen(argv[1])-4], ".lzs")) {
+ argv[1][strlen(argv[1])-4] = 0;
+ decomp = 1;
+ }
+ }
+
+ fobj = new FileCompress(argv[1]);
+
+ if (decomp)
+ fobj->Decode();
+ else fobj->Encode();
+
+ delete fobj;
+}
diff --git a/tests/compnone.cpp b/tests/compnone.cpp
new file mode 100644
index 0000000..a08c10e
--- /dev/null
+++ b/tests/compnone.cpp
@@ -0,0 +1,109 @@
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swcomprs.h>
+
+class FileCompress: public SWCompress {
+ int ifd;
+ int ofd;
+ int ufd;
+ int zfd;
+public:
+ FileCompress(char *);
+ ~FileCompress();
+ unsigned long GetChars(char *, unsigned long len);
+ unsigned long SendChars(char *, unsigned long len);
+ void Encode();
+ void Decode();
+};
+
+
+FileCompress::FileCompress(char *fname)
+{
+ char buf[256];
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+ ufd = open(fname, O_RDWR|O_CREAT|O_BINARY, 00644);
+
+ sprintf(buf, "%s.zzz", fname);
+ zfd = open(buf, O_RDWR|O_CREAT|O_BINARY, 00644);
+}
+
+
+FileCompress::~FileCompress()
+{
+ close(ufd);
+ close(zfd);
+}
+
+
+unsigned long FileCompress::GetChars(char *buf, unsigned long len)
+{
+ return read(ifd, buf, len);
+}
+
+
+unsigned long FileCompress::SendChars(char *buf, unsigned long len)
+{
+ return write(ofd, buf, len);
+}
+
+
+void FileCompress::Encode()
+{
+ ifd = ufd;
+ ofd = zfd;
+
+ SWCompress::Encode();
+}
+
+
+void FileCompress::Decode()
+{
+ ifd = zfd;
+ ofd = ufd;
+
+ SWCompress::Decode();
+}
+
+
+int main(int argc, char **argv)
+{
+ int decomp = 0;
+ SWCompress *fobj;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <filename|filename.zzz>\n", argv[0]);
+ exit(1);
+ }
+
+ if (strlen(argv[1]) > 4) {
+ if (!strcmp(&argv[1][strlen(argv[1])-4], ".zzz")) {
+ argv[1][strlen(argv[1])-4] = 0;
+ decomp = 1;
+ }
+ }
+
+ fobj = new FileCompress(argv[1]);
+
+ if (decomp)
+ fobj->Decode();
+ else fobj->Encode();
+
+ delete fobj;
+}
diff --git a/tests/compzip.cpp b/tests/compzip.cpp
new file mode 100644
index 0000000..cbc5c5c
--- /dev/null
+++ b/tests/compzip.cpp
@@ -0,0 +1,107 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <zipcomprs.h>
+
+class FileCompress: public ZipCompress {
+ int ifd;
+ int ofd;
+ int ufd;
+ int zfd;
+public:
+ FileCompress(char *);
+ ~FileCompress();
+ unsigned long GetChars(char *, unsigned long len);
+ unsigned long SendChars(char *, unsigned long len);
+ void Encode();
+ void Decode();
+};
+
+
+FileCompress::FileCompress(char *fname)
+{
+ char buf[256];
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+ ufd = open(fname, O_RDWR|O_CREAT|O_BINARY, 00644);
+
+ sprintf(buf, "%s.zip", fname);
+ zfd = open(buf, O_RDWR|O_CREAT|O_BINARY, 00644);
+}
+
+
+FileCompress::~FileCompress()
+{
+ close(ufd);
+ close(zfd);
+}
+
+
+unsigned long FileCompress::GetChars(char *buf, unsigned long len)
+{
+ return read(ifd, buf, len);
+}
+
+
+unsigned long FileCompress::SendChars(char *buf, unsigned long len)
+{
+ return write(ofd, buf, len);
+}
+
+
+void FileCompress::Encode()
+{
+ ifd = ufd;
+ ofd = zfd;
+
+ ZipCompress::Encode();
+}
+
+
+void FileCompress::Decode()
+{
+ ifd = zfd;
+ ofd = ufd;
+
+ ZipCompress::Decode();
+}
+
+
+main(int argc, char **argv)
+{
+ int decomp = 0;
+ SWCompress *fobj;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <filename|filename.zip>\n", argv[0]);
+ exit(1);
+ }
+
+ if (strlen(argv[1]) > 4) {
+ if (!strcmp(&argv[1][strlen(argv[1])-4], ".zip")) {
+ argv[1][strlen(argv[1])-4] = 0;
+ decomp = 1;
+ }
+ }
+
+ fobj = new FileCompress(argv[1]);
+
+ if (decomp)
+ fobj->Decode();
+ else fobj->Encode();
+
+ delete fobj;
+}
diff --git a/tests/configtest.cpp b/tests/configtest.cpp
new file mode 100644
index 0000000..82510aa
--- /dev/null
+++ b/tests/configtest.cpp
@@ -0,0 +1,13 @@
+#include <iostream.h>
+#include <swconfig.h>
+
+int main(int argc, char **argv) {
+ SWConfig config("./test1.conf");
+ config["Section1"]["Entry1"] = "Value1";
+ config["Section1"]["Entry2"] = "oops";
+ config["Section1"]["Entry2"] = "Value2";
+ config.Save();
+ SWConfig config2("./test1.conf");
+ cout << "Should be Value2: " << config2["Section1"]["Entry2"] << "\n";
+ return 0;
+}
diff --git a/tests/filtertest.cpp b/tests/filtertest.cpp
new file mode 100644
index 0000000..8834176
--- /dev/null
+++ b/tests/filtertest.cpp
@@ -0,0 +1,18 @@
+#include <iostream.h>
+#include <thmlhtmlhref.h>
+#include <swmgr.h>
+
+#define MAXBUF 30000
+int main(int argc, char **argv) {
+ SWMgr mgr;
+ SWModule *module = mgr.Modules.begin()->second;
+ ThMLHTMLHREF filter;
+ char *buf = new char [ MAXBUF ];
+ memset(buf, 0, MAXBUF);
+ strcpy(buf, "This is a verse reference: <scripRef>James 1:19</scripRef> with an <img src=\"/images/yoyo.jpg\">");
+ filter.ProcessText(buf, MAXBUF - 1, *module, module);
+
+ cout << buf << "\n";
+
+ return 0;
+}
diff --git a/tests/genbooktest.cpp b/tests/genbooktest.cpp
new file mode 100644
index 0000000..a068643
--- /dev/null
+++ b/tests/genbooktest.cpp
@@ -0,0 +1,174 @@
+#include <entriesblk.h>
+#include <iostream.h>
+#include <string>
+#include <stdio.h>
+#include <treekeyidx.h>
+#include <rawgenbook.h>
+
+
+void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
+ if (!target)
+ target = &treeKey;
+
+ unsigned long currentOffset = target->getOffset();
+ cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
+ for (int i = 0; i < level; i++) cout << "\t";
+ cout << treeKey.getLocalName() << "/\n";
+ if (treeKey.firstChild()) {
+ printTree(treeKey, target, level+1);
+ treeKey.parent();
+ }
+ if (treeKey.nextSibling())
+ printTree(treeKey, target, level);
+
+}
+
+
+void printLocalName(TreeKeyIdx *treeKey) {
+ cout << "locaName: " << treeKey->getLocalName() << "\n";
+}
+
+
+void setLocalName(TreeKeyIdx *treeKey) {
+ char buf[1023];
+ cout << "Enter New Node Name: ";
+ gets(buf);
+ treeKey->setLocalName(buf);
+ treeKey->save();
+}
+
+
+void gotoPath(TreeKeyIdx *treeKey) {
+ char buf[1023];
+ cout << "Enter Path: ";
+ gets(buf);
+ (*treeKey) = buf;
+}
+
+
+void viewEntryText(RawGenBook *book) {
+ cout << "\n";
+ cout << book->RenderText();
+ cout << "\n";
+}
+
+
+void setEntryText(RawGenBook *book) {
+ string body;
+ TreeKeyIdx *treeKey = (TreeKeyIdx *)(SWKey *)(*book);
+ if (treeKey->getOffset()) {
+ char buf[1023];
+ cout << "Enter New Entry Text ('.' on a line by itself to end): \n";
+ do {
+ gets(buf);
+ if ((buf[0] == '.') && (buf[1] == 0))
+ break;
+ body += buf;
+ body += "\n";
+ } while (true);
+
+ (*book) << body.c_str();
+ }
+ else cout << "Can't add entry text to root node\n";
+}
+
+
+void appendSibbling(TreeKeyIdx *treeKey) {
+ if (treeKey->getOffset()) {
+ char buf[1023];
+ cout << "Enter New Sibbling Name: ";
+ gets(buf);
+ treeKey->append();
+ treeKey->setLocalName(buf);
+ treeKey->save();
+ }
+ else cout << "Can't add sibling to root node\n";
+}
+
+
+void appendChild(TreeKeyIdx *treeKey) {
+ char buf[1023];
+ cout << "Enter New Child Name: ";
+ gets(buf);
+ treeKey->appendChild();
+ treeKey->setLocalName(buf);
+ treeKey->save();
+}
+
+
+void removeEntry(EntriesBlock *eb, int index) {
+ if (index < eb->getCount()) {
+ cout << "Removing entry [" << index << "]\n";
+ eb->removeEntry(index);
+ }
+ else cout << "Invalid entry number\n\n";
+}
+
+
+int main(int argc, char **argv) {
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <tree/key/data/path>\n", *argv);
+ exit(-1);
+ }
+
+ TreeKeyIdx *treeKey = new TreeKeyIdx(argv[1]);
+
+ if (treeKey->Error()) {
+ RawGenBook::createModule(argv[1]);
+ }
+ delete treeKey;
+
+ RawGenBook *book = new RawGenBook(argv[1]);
+ TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
+ treeKey = (TreeKeyIdx *)(SWKey *)(*book);
+
+ string input;
+ char line[1024];
+
+ do {
+ cout << "[" << treeKey->getFullName() << "] > ";
+ gets(line);
+ input = line;
+ if (input.length() > 0) {
+ switch (input[0]) {
+ case 'n': printLocalName(treeKey); break;
+ case 's': setLocalName(treeKey); break;
+ case 'g': gotoPath(treeKey); break;
+ case 'p': root.root(); printTree(root, treeKey); break;
+ case 'a': appendSibbling(treeKey); break;
+ case 'c': appendChild(treeKey); break;
+ case 'j': treeKey->nextSibling(); break;
+ case 'k': treeKey->previousSibling(); break;
+ case 'h': treeKey->parent(); break;
+ case 'l': treeKey->firstChild(); break;
+ case 'r': treeKey->root(); break;
+ case 't': setEntryText(book); break;
+ case 'v': viewEntryText(book); break;
+ case 'q': break;
+ case '?':
+ default:
+ cout << "\n p - print tree\n";
+ cout << " n - get local name\n";
+ cout << " s - set local name\n";
+ cout << " j - next sibbling\n";
+ cout << " k - previous sibbling\n";
+ cout << " h - parent\n";
+ cout << " l - first child\n";
+ cout << " r - root\n";
+ cout << " g - goto path\n";
+ cout << " a - append sibbling\n";
+ cout << " c - append child\n";
+ cout << " v - view entry text\n";
+ cout << " t - set entry text\n";
+ cout << " q - quit\n\n";
+ break;
+ }
+ }
+ }
+ while (input.compare("q"));
+
+ delete treeKey;
+
+ return 0;
+}
diff --git a/tests/icutest.cpp b/tests/icutest.cpp
new file mode 100644
index 0000000..fa3cf3d
--- /dev/null
+++ b/tests/icutest.cpp
@@ -0,0 +1,34 @@
+#include <iostream>
+#include <string>
+
+#include "unicode/utypes.h" /* Basic ICU data types */
+#include "unicode/ucnv.h" /* C Converter API */
+#include "unicode/convert.h" /* C++ Converter API */
+#include "unicode/ustring.h" /* some more string fcns*/
+
+#include "unicode/translit.h"
+
+int main() {
+
+ UChar * uBuf;
+ UChar * target;
+ UConverter *conv;
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t uBufSize = 0, uLength = 0;
+
+ char * samplestring = "If this compiles and runs without errors, apparently ICU is working.";
+
+ uLength = strlen(samplestring);
+ conv = ucnv_open("utf-8", &status);
+ uBufSize = (uLength/ucnv_getMinCharSize(conv));
+ uBuf = (UChar*)malloc(uBufSize * sizeof(UChar));
+
+ target = uBuf;
+
+ ucnv_toUChars(conv, target, uLength,
+ samplestring, uLength, &status);
+
+ cout << samplestring << endl;
+
+ return 0;
+}
diff --git a/tests/indextest.cpp b/tests/indextest.cpp
new file mode 100644
index 0000000..0fe66d4
--- /dev/null
+++ b/tests/indextest.cpp
@@ -0,0 +1,19 @@
+#include <swmgr.h>
+#include <iostream.h>
+#include <versekey.h>
+
+int main(int argc, char **argv) {
+ SWMgr mymgr;
+
+ SWModule *bbe = mymgr.Modules["BBE"];
+
+ if (bbe) {
+ VerseKey vk;
+ vk.Persist(1);
+ bbe->SetKey(vk);
+ for (; !bbe->Error(); (*bbe)++ ) {
+ cout << vk.NewIndex() << endl;
+ }
+ }
+ return 0;
+}
diff --git a/tests/introtest.cpp b/tests/introtest.cpp
new file mode 100644
index 0000000..6fad777
--- /dev/null
+++ b/tests/introtest.cpp
@@ -0,0 +1,22 @@
+#include <swmgr.h>
+#include <iostream.h>
+#include <versekey.h>
+
+int main(int argc, char **argv) {
+ SWMgr mymgr;
+
+ SWModule *mhc = mymgr.Modules["MHC"];
+
+ if (mhc) {
+ VerseKey vk;
+ vk.Headings(1);
+ vk.AutoNormalize(0);
+ vk.Persist(1);
+ vk = "jas 0:0";
+ cout << vk << ":\n";
+ mhc->SetKey(vk);
+ cout << (const char *) mhc->Key() << ":\n";
+ cout << (const char *) *mhc << "\n";
+ }
+ return 0;
+}
diff --git a/tests/keycast.cpp b/tests/keycast.cpp
new file mode 100644
index 0000000..064dabf
--- /dev/null
+++ b/tests/keycast.cpp
@@ -0,0 +1,29 @@
+#include <swmgr.h>
+
+int main (int argc, char* argv[]) {
+ SWMgr mgr;
+
+//the commented out code works
+/*
+ OptionsList globalOptions = mgr.getGlobalOptions();
+ for (OptionsList::iterator it = globalOptions.begin(); it != globalOptions.end(); it++) {
+ cout << *it << endl;
+
+ OptionsList values = mgr.getGlobalOptionValues((*it).c_str());
+ for (OptionsList::iterator it2 = values.begin(); it2 != values.end(); it2++) {
+ cout << "\t"<< *it2 << endl;
+ }
+ }
+*/
+
+//crashes
+ OptionsList values = mgr.getGlobalOptionValues("Footnotes");
+ for (OptionsList::iterator it2 = values.begin(); it2 != values.end(); it2++) {
+ cout << "\t"<< *it2 << endl;
+ }
+};
+
+
+
+
+
diff --git a/tests/keytest.cpp b/tests/keytest.cpp
new file mode 100644
index 0000000..0a6d3ab
--- /dev/null
+++ b/tests/keytest.cpp
@@ -0,0 +1,169 @@
+#include <stdio.h>
+#include <iostream.h>
+#include <versekey.h>
+#include <rawtext.h>
+#include <rawcom.h>
+#include <echomod.h>
+#include <stdlib.h>
+
+#include <localemgr.h>
+
+int main(int argc, char **argv)
+{
+ int loop;
+ int max;
+
+ if (argc > 1)
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName(argv[1]);
+
+ VerseKey bla;
+ long index;
+
+
+ if (argc < 2)
+ bla = "James 1:19";
+ else bla = argv[1];
+
+ cout << "\n loop++; (.Index(Index()+1))\n";
+
+ max = (argc < 3) ? 10 : atoi(argv[2]);
+
+ for (loop = 0; loop < max; loop++, bla++) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")";
+ bla.Index(index+1);
+ cout << "-> " << (const char *)bla << "\n";
+ }
+
+ cout << "-----------------\n";
+ cout << "\n loop--; (.Index(Index()-1))\n";
+ if (argc < 2)
+ bla = "James 1:19";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla--) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")";
+ bla.Index(index-1);
+ cout << "-> " << (const char *)bla << "\n";
+ }
+
+ cout << "-----------------\n";
+ cout << "--------- No Headings --------\n";
+
+ if (argc < 2)
+ bla = "Matthew 1:5";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla--) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "-----------------\n";
+
+ if (argc < 2)
+ bla = "Genesis 1:5";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla--) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "-----------------\n";
+
+ if (argc < 2)
+ bla = "Malachi 4:2";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla++) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "-----------------\n";
+
+ if (argc < 2)
+ bla = "Revelation of John 22:17";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla++) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+
+ cout << "-----------------\n";
+ cout << "-------- Headings ---------\n";
+
+ bla.Headings(1);
+
+ if (argc < 2)
+ bla = "Matthew 1:5";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla--) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "-----------------\n";
+
+ if (argc < 2)
+ bla = "Genesis 1:5";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla--) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "-----------------\n";
+
+ if (argc < 2)
+ bla = "Malachi 4:2";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla++) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "-----------------\n";
+
+ if (argc < 2)
+ bla = "Revelation of John 22:17";
+ else bla = argv[1];
+
+ for (loop = max; loop; loop--, bla++) {
+ index = bla.Index();
+ cout << (const char *)bla << "(" << index << ")\n";
+ }
+
+ cout << "\n\n";
+
+ cout << "-------- Error Check ------------\n\n";
+ bla = "Revelation of John 23:19";
+ cout << "bla = \"Revelation of John 23:19\"\n";
+ cout << "(const char *)bla = " << (const char *)bla << "\n";
+ cout << "bla.Error() = " << (int)bla.Error() << " \n";
+ cout << "bla++ \n";
+ bla++;
+ cout << "bla.Error() = " << (int)bla.Error() << " \n";
+
+ bla.Headings(0);
+ for (bla = BOTTOM; !bla.Error(); bla.Book(bla.Book()-1))
+ cout << (const char *)bla << "\n";
+ bla.Testament(1);
+ bla = BOTTOM;
+ cout << bla.Index() << "\n";
+ cout << bla.NewIndex() << "\n";
+ cout << bla << "\n";
+ bla.Testament(2);
+ bla = BOTTOM;
+ cout << bla.Index() << "\n";
+ cout << bla.NewIndex() << "\n";
+ cout << bla << "\n";
+ return 0;
+}
diff --git a/tests/listtest.cpp b/tests/listtest.cpp
new file mode 100644
index 0000000..f6a7546
--- /dev/null
+++ b/tests/listtest.cpp
@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include <iostream.h>
+#include <stdlib.h>
+#include <listkey.h>
+#include <versekey.h>
+
+
+int main(int argc, char **argv)
+{
+ ListKey lk, lk2;
+ VerseKey vk("jn 1:1", "jn 1:12");
+ VerseKey vk2("jude", "jude");
+ SWKey text;
+
+ vk = "jas 1:19";
+ text = (const char *)vk;
+ lk << text;
+ lk << text;
+ lk << text;
+ lk << "James 1:19";
+ lk << "yoyo";
+ lk << vk;
+ lk2 << "test1";
+ lk2 << lk;
+ lk2 << vk2;
+ lk2 << "test2";
+ for (lk2 = TOP; !lk2.Error(); lk2++)
+ cout << (const char *) lk2 << "\n";
+
+
+ lk2 = VerseKey().ParseVerseList("mat-john", 0, true);
+
+ VerseKey yoyo("john");
+ yoyo = MAXCHAPTER;
+ cout << yoyo;
+/*
+
+ for (int i = 0; i < 2; i++) {
+ VerseKey x, y;
+ ListKey lk3;
+ x = "rev";
+ y = x;
+ x = "mat";
+ VerseKey newElement;
+ newElement.LowerBound(x);
+ newElement.UpperBound(y);
+ lk3 << newElement;
+
+ lk2 << lk3;
+ }
+
+*/
+ cout << "---------\n";
+
+ for (lk2 = TOP; !lk2.Error(); lk2++)
+ cout << (const char *) lk2 << "\n";
+
+ return 0;
+}
diff --git a/tests/localetest.cpp b/tests/localetest.cpp
new file mode 100644
index 0000000..bb43479
--- /dev/null
+++ b/tests/localetest.cpp
@@ -0,0 +1,29 @@
+#include <localemgr.h>
+#include <versekey.h>
+
+int main(int argc, char **argv) {
+ if (argc != 3) {
+ fprintf(stderr, "usage: %s <locale_name> <text>\n", *argv);
+ exit(-1);
+ }
+
+ LocaleMgr lm;
+
+ printf("%s\n", lm.translate(argv[1], argv[2]));
+
+ VerseKey bla;
+ bla = "James 1:19";
+
+ bla.setLocale("de");
+ cout << bla << endl;
+ bla = "Johannes 1:1";
+ cout << bla << endl;
+
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName("de");
+ VerseKey key2;
+ key2.setLocale("en");
+ ListKey list = key2.ParseVerseList("Luke 3:23-28",key2, true);
+ cout << list << endl;
+
+
+}
diff --git a/tests/mgrtest.cpp b/tests/mgrtest.cpp
new file mode 100644
index 0000000..602a322
--- /dev/null
+++ b/tests/mgrtest.cpp
@@ -0,0 +1,29 @@
+#include <swmgr.h>
+#include <iostream.h>
+#include <versekey.h>
+
+int main(int argc, char **argv) {
+ SWMgr::debug = true;
+ SWMgr mymgr;
+ cerr << "\n\nprefixPath: " << mymgr.prefixPath;
+ cerr << "\nconfigPath: " << mymgr.configPath << "\n\n";
+
+
+ ModMap::iterator it;
+
+ for (it = mymgr.Modules.begin(); it != mymgr.Modules.end(); it++) {
+ cout << "[" << (*it).second->Name() << "] (Writable: " << (it->second->isWritable()?"Yes":"No") << ") [" << (*it).second->Description() << "]\n";
+ cout << "AbsoluteDataPath = " << it->second->getConfigEntry("AbsoluteDataPath") << "\n";
+ cout << "Has Feature HebrewDef = " << it->second->getConfig().has("Feature", "HebrewDef") << "\n";
+ if ((!strcmp((*it).second->Type(), "Biblical Texts")) || (!strcmp((*it).second->Type(), "Commentaries"))) {
+ (*it).second->SetKey("James 1:19");
+ cout << (const char *) *(*it).second << "\n\n";
+ }
+ }
+ SWModule *mhc = mymgr.Modules["MHC"];
+ if (mhc) {
+ for (mhc->Key("Gen 1:1"); mhc->Key() < (VerseKey) "Gen 1:10"; (*mhc)++)
+ cout << (const char *) *mhc << "\n";
+ }
+ return 0;
+}
diff --git a/tests/modtest.cpp b/tests/modtest.cpp
new file mode 100644
index 0000000..8ad1132
--- /dev/null
+++ b/tests/modtest.cpp
@@ -0,0 +1,28 @@
+#include <swmgr.h>
+#include <swtext.h>
+#include <iostream.h>
+
+int main(int argc, char **argv) {
+ SWMgr mymgr;
+ ModMap::iterator it;
+ SWModule *module;
+
+ for (it = mymgr.Modules.begin(); it != mymgr.Modules.end(); it++) {
+ module = it->second;
+ if (!strcmp(module->Type(), "Biblical Texts")) {
+ cout << module->Name() << "\n";
+ for (*module = TOP; (!module->Key().Error()); ((VerseKey *)&module->Key())->Book(((VerseKey *)&module->Key())->Book()+1)) {
+ cout << module->KeyText() << "\n";
+ }
+ }
+
+ if (!strcmp(module->Type(), "Commentaries")) {
+ cout << module->Name() << "\n";
+ for (*module = TOP; (!module->Error()); (*module)--) {
+ cout << module->KeyText() << "\n";
+ }
+
+ }
+ }
+ return 0;
+}
diff --git a/tests/parsekey.cpp b/tests/parsekey.cpp
new file mode 100644
index 0000000..5a37b8e
--- /dev/null
+++ b/tests/parsekey.cpp
@@ -0,0 +1,31 @@
+#include <iostream.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <versekey.h>
+#include <localemgr.h>
+
+int main(int argc, char **argv) {
+ if ((argc != 2) && (argc != 3)) {
+ fprintf(stderr, "usage: %s <\"string to parse\"> [locale name]\n", *argv);
+ exit(-1);
+ }
+
+ if (argc == 3)
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName(argv[2]);
+
+ VerseKey DefaultVSKey;
+
+ DefaultVSKey = "jas3:1";
+
+ ListKey verses = DefaultVSKey.ParseVerseList(argv[1], DefaultVSKey, true);
+
+ for (int i = 0; i < verses.Count(); i++) {
+ VerseKey *element = dynamic_cast<VerseKey *>(verses.GetElement(i));
+ if (element) {
+ cout << (string(element->LowerBound()) + " - " + string(element->UpperBound())).c_str() << "\n";
+ }
+ else cout << (const char *)*verses.GetElement(i) << "\n";
+ }
+ return 0;
+}
diff --git a/tests/romantest.cpp b/tests/romantest.cpp
new file mode 100644
index 0000000..ce5359a
--- /dev/null
+++ b/tests/romantest.cpp
@@ -0,0 +1,24 @@
+#include <iostream.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+extern "C" {
+#include <roman.h>
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <roman_numeral>\n", *argv);
+ exit(-1);
+ }
+ /* I don't think we need to_rom, do we? anyway, it isn't written
+ char buf[127];
+ if (isdigit(argv[1][0])) {
+ to_rom(atoi(argv[1]), buf);
+ cout << buf << "\n";
+ }
+ */
+ else cout << from_rom(argv[1]) << "\n";
+ return 0;
+}
+
diff --git a/tests/swaptest.cpp b/tests/swaptest.cpp
new file mode 100644
index 0000000..2dc8daa
--- /dev/null
+++ b/tests/swaptest.cpp
@@ -0,0 +1,9 @@
+#include <sysdata.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+ printf("0x%.4x 0x%.4x\n", 255, __swap16(255));
+ printf("0x%.8x 0x%.8x\n", 255, __swap32(255));
+// printf("0x%.16x 0x%.16llx\n", 255, __swap64(255));
+ return 0;
+}
diff --git a/tests/testblocks.cpp b/tests/testblocks.cpp
new file mode 100644
index 0000000..49a44c0
--- /dev/null
+++ b/tests/testblocks.cpp
@@ -0,0 +1,85 @@
+#include <entriesblk.h>
+#include <iostream.h>
+#include <string>
+#include <stdio.h>
+
+using namespace std;
+
+void addEntry(EntriesBlock *eb) {
+ string input;
+ string body;
+ char line[1024];
+ cout << "\nEnter new Entry's text. '.' on an empty line to finish:\n";
+ do {
+ cout << "> ";
+ gets(line);
+ input = line;
+ if (input.compare("."))
+ body.append(input);
+ }
+ while (input.compare("."));
+ cout << "Adding new entry. Index is: " << eb->addEntry(body.c_str()) << "\n\n";
+}
+
+
+void printEntry(EntriesBlock *eb, int index) {
+ if (index < eb->getCount()) {
+ cout << "Contents of entry [" << index << "]:\n";
+ cout << eb->getEntry(index) << "\n";
+ }
+ else cout << "Invalid entry number\n\n";
+}
+
+
+void printSize(EntriesBlock *eb) {
+ unsigned long size;
+ eb->getRawData(&size);
+ cout << "Size of raw data: " << size << "\n\n";
+}
+
+
+void removeEntry(EntriesBlock *eb, int index) {
+ if (index < eb->getCount()) {
+ cout << "Removing entry [" << index << "]\n";
+ eb->removeEntry(index);
+ }
+ else cout << "Invalid entry number\n\n";
+}
+
+
+int main(int argc, char **argv) {
+
+ EntriesBlock *eb = new EntriesBlock();
+ string input;
+ char line[1024];
+
+ cout << "Initial entry count should be 0: " << eb->getCount() << "\n";
+
+ do {
+ cout << "[" << eb->getCount() << "] > ";
+ gets(line);
+ input = line;
+ if (input.length() > 0) {
+ switch (input[0]) {
+ case 'a': addEntry(eb); break;
+ case 'p': printEntry(eb, atoi(input.c_str()+1)); break;
+ case 'r': removeEntry(eb, atoi(input.c_str()+1)); break;
+ case 's': printSize(eb); break;
+ case 'q': break;
+ case '?':
+ default:
+ cout << "\n a - add a new entry\n";
+ cout << " p <entry_index> - print entry\n";
+ cout << " r <entry_index> - remove entry\n";
+ cout << " s - print size of raw data\n";
+ cout << " q - quit\n\n";
+ break;
+ }
+ }
+ }
+ while (input.compare("q"));
+
+ delete eb;
+
+ return 0;
+}
diff --git a/tests/treeidxtest.cpp b/tests/treeidxtest.cpp
new file mode 100644
index 0000000..f017658
--- /dev/null
+++ b/tests/treeidxtest.cpp
@@ -0,0 +1,132 @@
+#include <entriesblk.h>
+#include <iostream.h>
+#include <string>
+#include <stdio.h>
+#include <treekeyidx.h>
+
+
+void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
+ if (!target)
+ target = &treeKey;
+
+ unsigned long currentOffset = target->getOffset();
+ cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
+ for (int i = 0; i < level; i++) cout << "\t";
+ cout << treeKey.getLocalName() << "\n";
+ if (treeKey.firstChild()) {
+ printTree(treeKey, target, level+1);
+ treeKey.parent();
+ }
+ if (treeKey.nextSibling())
+ printTree(treeKey, target, level);
+
+}
+
+
+void printLocalName(TreeKeyIdx *treeKey) {
+ cout << "locaName: " << treeKey->getLocalName() << "\n";
+}
+
+
+void setLocalName(TreeKeyIdx *treeKey) {
+ char buf[1023];
+ cout << "Enter New Node Name: ";
+ gets(buf);
+ treeKey->setLocalName(buf);
+ treeKey->save();
+}
+
+
+void appendSibbling(TreeKeyIdx *treeKey) {
+ if (treeKey->getOffset()) {
+ char buf[1023];
+ cout << "Enter New Sibbling Name: ";
+ gets(buf);
+ treeKey->append();
+ treeKey->setLocalName(buf);
+ treeKey->save();
+ }
+ else cout << "Can't add sibling to root node\n";
+}
+
+
+void appendChild(TreeKeyIdx *treeKey) {
+ char buf[1023];
+ cout << "Enter New Child Name: ";
+ gets(buf);
+ treeKey->appendChild();
+ treeKey->setLocalName(buf);
+ treeKey->save();
+}
+
+
+void removeEntry(EntriesBlock *eb, int index) {
+ if (index < eb->getCount()) {
+ cout << "Removing entry [" << index << "]\n";
+ eb->removeEntry(index);
+ }
+ else cout << "Invalid entry number\n\n";
+}
+
+
+int main(int argc, char **argv) {
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <tree/key/data/path>\n", *argv);
+ exit(-1);
+ }
+
+ TreeKeyIdx *treeKey = new TreeKeyIdx(argv[1]);
+
+ if (treeKey->Error()) {
+ treeKey->create(argv[1]);
+ delete treeKey;
+ treeKey = new TreeKeyIdx(argv[1]);
+ }
+ TreeKeyIdx root = *treeKey;
+
+ string input;
+ char line[1024];
+
+ do {
+ cout << "[" << treeKey->getFullName() << "] > ";
+ gets(line);
+ input = line;
+ if (input.length() > 0) {
+ switch (input[0]) {
+ case 'n': printLocalName(treeKey); break;
+ case 's': setLocalName(treeKey); break;
+ case 'p': root.root(); printTree(root, treeKey); break;
+ case 'a': appendSibbling(treeKey); break;
+ case 'c': appendChild(treeKey); break;
+ case 'j': treeKey->nextSibling(); break;
+ case 'k': treeKey->previousSibling(); break;
+ case 'h': treeKey->parent(); break;
+ case 'l': treeKey->firstChild(); break;
+ case 'r': treeKey->root(); break;
+ case 'q': break;
+ case '?':
+ default:
+ cout << "\n p - print tree\n";
+ cout << " n - get local name\n";
+ cout << " s - set local name\n";
+ cout << " j - next sibbling\n";
+ cout << " k - previous sibbling\n";
+ cout << " h - parent\n";
+ cout << " l - first child\n";
+ cout << " r - root\n";
+ cout << " a - append sibbling\n";
+ cout << " c - append child\n";
+ cout << " u - get user data\n";
+ cout << " d - set user data\n";
+ cout << " q - quit\n\n";
+ break;
+ }
+ }
+ }
+ while (input.compare("q"));
+
+ delete treeKey;
+
+ return 0;
+}