diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-12-07 13:17:14 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-12-07 13:17:14 +0100 |
commit | 4875a3dd9b183dcd2256e2abfc4ccf7484c233b4 (patch) | |
tree | 0abbea881ded030851014ffdd60fbf71fead8f65 /libtest | |
parent | daf17154bf13139d9375f48525d19d6aaba08155 (diff) |
New upstream version 4.0.2upstream/4.0.2
Diffstat (limited to 'libtest')
-rwxr-xr-x | libtest/Makefile.am | 19 | ||||
-rwxr-xr-x | libtest/Makefile.in | 391 | ||||
-rwxr-xr-x | libtest/exptest.cpp | 277 | ||||
-rwxr-xr-x | libtest/indextst.cpp | 297 | ||||
-rwxr-xr-x | libtest/lfiletst.cpp | 138 | ||||
-rwxr-xr-x | libtest/locktest.cpp | 77 | ||||
-rwxr-xr-x | libtest/makebcc.bat | 16 | ||||
-rwxr-xr-x | libtest/readme | 10 | ||||
-rwxr-xr-x | libtest/testdate.cpp | 213 |
9 files changed, 0 insertions, 1438 deletions
diff --git a/libtest/Makefile.am b/libtest/Makefile.am deleted file mode 100755 index 9e84830..0000000 --- a/libtest/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -INCLUDES= -I$(topdir) -LDADD = -L$(topdir)/xbase64 -lxbase64 - -INSTALL_PROGRAM = @INSTALL@ - -noinst_PROGRAMS = indextst exptest locktest testdate lfiletst - -indextst_SOURCES = indextst.cpp -exptest_SOURCES = exptest.cpp -locktest_SOURCES = locktest.cpp -testdate_SOURCES = testdate.cpp -lfiletst_SOURCES = lfiletst.cpp - -noinst_HEADERS = - -EXTRA_DIST = readme makebcc.bat - -CLEANFILES = Makefile.in *.exe compout *.tds *.dbf *.dbt *.ndx *.ntx *.obj diff --git a/libtest/Makefile.in b/libtest/Makefile.in deleted file mode 100755 index 372dd58..0000000 --- a/libtest/Makefile.in +++ /dev/null @@ -1,391 +0,0 @@ -# Makefile.in generated by automake 1.6.3 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_DATA = @INSTALL_DATA@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(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@ - -INSTALL_PROGRAM = @INSTALL@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -GXXVER = @GXXVER@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -RELEASE = @RELEASE@ -RHREL = @RHREL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XSUBDIRS = @XSUBDIRS@ -am__include = @am__include@ -am__quote = @am__quote@ -doxygen = @doxygen@ -install_sh = @install_sh@ -topdir = @topdir@ - -INCLUDES = -I$(topdir) -LDADD = -L$(topdir)/xbase64 -lxbase64 - -noinst_PROGRAMS = indextst exptest locktest testdate lfiletst - -indextst_SOURCES = indextst.cpp -exptest_SOURCES = exptest.cpp -locktest_SOURCES = locktest.cpp -testdate_SOURCES = testdate.cpp -lfiletst_SOURCES = lfiletst.cpp - -noinst_HEADERS = - -EXTRA_DIST = readme makebcc.bat - -CLEANFILES = Makefile.in *.exe compout *.tds *.dbf *.dbt *.ndx *.ntx *.obj -subdir = libtest -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = indextst$(EXEEXT) exptest$(EXEEXT) locktest$(EXEEXT) \ - testdate$(EXEEXT) lfiletst$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_exptest_OBJECTS = exptest.$(OBJEXT) -exptest_OBJECTS = $(am_exptest_OBJECTS) -exptest_LDADD = $(LDADD) -exptest_DEPENDENCIES = -exptest_LDFLAGS = -am_indextst_OBJECTS = indextst.$(OBJEXT) -indextst_OBJECTS = $(am_indextst_OBJECTS) -indextst_LDADD = $(LDADD) -indextst_DEPENDENCIES = -indextst_LDFLAGS = -am_lfiletst_OBJECTS = lfiletst.$(OBJEXT) -lfiletst_OBJECTS = $(am_lfiletst_OBJECTS) -lfiletst_LDADD = $(LDADD) -lfiletst_DEPENDENCIES = -lfiletst_LDFLAGS = -am_locktest_OBJECTS = locktest.$(OBJEXT) -locktest_OBJECTS = $(am_locktest_OBJECTS) -locktest_LDADD = $(LDADD) -locktest_DEPENDENCIES = -locktest_LDFLAGS = -am_testdate_OBJECTS = testdate.$(OBJEXT) -testdate_OBJECTS = $(am_testdate_OBJECTS) -testdate_LDADD = $(LDADD) -testdate_DEPENDENCIES = -testdate_LDFLAGS = - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/xbase64 -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/exptest.Po ./$(DEPDIR)/indextst.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/lfiletst.Po ./$(DEPDIR)/locktest.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/testdate.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 = $(exptest_SOURCES) $(indextst_SOURCES) \ - $(lfiletst_SOURCES) $(locktest_SOURCES) $(testdate_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in -SOURCES = $(exptest_SOURCES) $(indextst_SOURCES) $(lfiletst_SOURCES) $(locktest_SOURCES) $(testdate_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libtest/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -exptest$(EXEEXT): $(exptest_OBJECTS) $(exptest_DEPENDENCIES) - @rm -f exptest$(EXEEXT) - $(CXXLINK) $(exptest_LDFLAGS) $(exptest_OBJECTS) $(exptest_LDADD) $(LIBS) -indextst$(EXEEXT): $(indextst_OBJECTS) $(indextst_DEPENDENCIES) - @rm -f indextst$(EXEEXT) - $(CXXLINK) $(indextst_LDFLAGS) $(indextst_OBJECTS) $(indextst_LDADD) $(LIBS) -lfiletst$(EXEEXT): $(lfiletst_OBJECTS) $(lfiletst_DEPENDENCIES) - @rm -f lfiletst$(EXEEXT) - $(CXXLINK) $(lfiletst_LDFLAGS) $(lfiletst_OBJECTS) $(lfiletst_LDADD) $(LIBS) -locktest$(EXEEXT): $(locktest_OBJECTS) $(locktest_DEPENDENCIES) - @rm -f locktest$(EXEEXT) - $(CXXLINK) $(locktest_LDFLAGS) $(locktest_OBJECTS) $(locktest_LDADD) $(LIBS) -testdate$(EXEEXT): $(testdate_OBJECTS) $(testdate_DEPENDENCIES) - @rm -f testdate$(EXEEXT) - $(CXXLINK) $(testdate_LDFLAGS) $(testdate_OBJECTS) $(testdate_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exptest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indextst.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lfiletst.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locktest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdate.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@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -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) - @list='$(DISTFILES)'; for file in $$list; 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 \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - 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) $(HEADERS) - -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: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -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/libtest/exptest.cpp b/libtest/exptest.cpp deleted file mode 100755 index d5330c6..0000000 --- a/libtest/exptest.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* exptest.cpp - - Xbase project source code - - This program tests the Xbase expression logic - - Copyright (C) 1997,2003 Gary A Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - - Contact: - - Email: - - xbase64-devel@lists.sourceforge.net - xbase64-users@lists.sourceforge.net - - - Regular Mail: - - XBase Support - 149C South Main St - Keller Texas, 76248 - USA - - -*/ - -#include "xbase64/xbase64.h" - -class ExpTestor{ - public:ExpTestor( xbXBase *, xbDbf * ); - xbShort TestExpression( const char * TestExpression, - const char * ExpectedResult ); - xbShort TestExpression( const char * TestExpression, - const xbDouble ExpectedResult ); - private: - xbXBase *xbptr; - xbDbf *dbfPtr; -}; -/**************************************************************************/ -ExpTestor::ExpTestor( xbXBase *xp, xbDbf *dp ) -{ - xbptr = xp; - dbfPtr = dp; -} -/**************************************************************************/ -xbShort ExpTestor::TestExpression( const char * Expression, - const xbDouble ExpectedResult ) -{ -// xbExpNode * e; - xbExpn * exp; - xbShort rc; - - exp = new xbExpn( xbptr ); - if(( rc = exp->ParseExpression( Expression, dbfPtr )) != 0 ){ - std::cout << "Parse Error " << rc << " in expression " << Expression - << std::endl; - if( exp ) - delete exp; - return 1; - } - - if(( rc = exp->ProcessExpression()) != 0 ){ - std::cout << "Error " << rc << " processing expression " << Expression - << std::endl; - if( exp ) - delete exp; - return 1; - } - char type = exp->GetExpressionResultType(); - if( type != 'N' && type != 'L' ){ - std::cout << "Expression " << Expression; - std::cout << " Expected result type Numeric or Logical, actual was "; - std::cout << type << std::endl; - delete exp; - return 1; - } - - if( type == 'N' ){ - xbString d1; - xbString d2; - d1.setNum( "2.4", ExpectedResult ); - d2.setNum( "2.4", exp->GetDoubleResult()); - if( d1 != d2 ){ - std::cout << "Expression " << Expression; - std::cout << " Actual result of " << d2 << " does not match"; - std::cout << " expected result of " << d1 << std::endl; - delete exp; - return 1; - } - } - if( type == 'L' && ExpectedResult != (xbDouble) exp->GetIntResult()){ - std::cout << "Expression " << Expression; - std::cout << " Actual result of " << exp->GetIntResult() - << " does not match "; - std::cout << " expected result of " << ExpectedResult << std::endl; - delete exp; - return 1; - } - - std::cout << "Expression " << Expression << " returned " << ExpectedResult; - std::cout << " OK" << std::endl; - delete exp; - return 0; -} -/**************************************************************************/ -xbShort ExpTestor::TestExpression( const char * Expression, - const char * ExpectedResult ) -{ -// xbExpNode * e; - xbExpn * exp; - xbShort rc; - - exp = new xbExpn( xbptr ); - if(( rc = exp->ParseExpression( Expression, dbfPtr )) != 0 ){ - std::cout << "Parse Error " << rc << " in expression " << Expression - << std::endl; - if( exp ) - delete exp; - return 1; - } - - if(( rc = exp->ProcessExpression()) != 0 ){ - std::cout << "Error " << rc << " processing expression " << Expression - << std::endl; - delete exp; - return 1; - } - char type = exp->GetExpressionResultType(); - if( type != 'C' ){ - std::cout << "Expression " << Expression; - std::cout << " Expected result type Character, actual was " << type - << std::endl; - delete exp; - return 1; - } - - if( strlen( ExpectedResult ) != strlen( exp->GetStringResult())){ - std::cout << "Expression " << Expression; - std::cout << " result length of " - << strlen( exp->GetStringResult()) - << " different than expected of " << strlen( ExpectedResult ) - << std::endl; - std::cout << "Calculated result =" << exp->GetStringResult() - << "<" << std::endl; - delete exp; - return 1; - } - - if( strcmp( ExpectedResult, exp->GetStringResult())){ - std::cout << "Expression " << Expression; - std::cout << " Actual result of " << exp->GetStringResult() - << " does not match "; - std::cout << " expected result of " << ExpectedResult << std::endl; - delete exp; - return 1; - } - - std::cout << "Expression " << Expression << " returned " << ExpectedResult; - std::cout << " OK" << std::endl; - return 0; -} -/*************************************************************************/ -int main() -{ - xbSchema MyRecord[] = - { - { "FLOAT1", XB_FLOAT_FLD, 9, 2 }, - { "DATE1", XB_DATE_FLD, 8, 0 }, - { "DATE2", XB_DATE_FLD, 8, 0 }, - { "", 0, 0, 0 }, - }; - - xbXBase x; - xbDbf d( &x ); - xbExpn exp( &x ); - - d.CreateDatabase( "TEST", MyRecord, XB_OVERLAY ); - d.PutFloatField( "FLOAT1", 5 ); - d.PutField( "DATE1", "19990110" ); - d.PutField( "DATE2", "19990120" ); - d.AppendRecord(); - - std::cout << "XBase Expression testing program.." << std::endl; - std::cout << "This program tests the XBase expression logic." << std::endl; - ExpTestor * e = new ExpTestor( &x, &d ); - -/* test functions which return a character value result */ - e->TestExpression( "CDOW( \"20000101\" )", "Saturday " ); - e->TestExpression( "CHR( 101 )", "e" ); - e->TestExpression( "CMONTH( \"20000101\" )", "January " ); - e->TestExpression( "DATE()", exp.DATE() ); - e->TestExpression( "DTOC( \"20000101\" )", "01/01/00" ); - e->TestExpression( "DTOS( \"20000101\" )", "20000101" ); - e->TestExpression( "LEFT( \"STRING\", 3 )", "STR" ); - e->TestExpression( "LTRIM( \" xxxxxx\" )", "xxxxxx" ); - e->TestExpression( "LOWER( \"AAAA\" )", "aaaa" ); - - e->TestExpression( "REPLICATE( \"abc\", 3 )", "abcabcabc" ); - e->TestExpression( "RTRIM( \"zzz \" )", "zzz" ); - e->TestExpression( "RTRIM( \"zzz \" )+\"qqq\"", "zzzqqq" ); - e->TestExpression( "SPACE( 3 )", " " ); - - e->TestExpression( "STR( -52.345 )", " -52" ); - e->TestExpression( "STR( -52.345, 3 )", "-52" ); - e->TestExpression( "STR( 52.34, 4, 1 )", "52.3" ); - -// not sure what the STRZERO function is supposed to do -/* - e->TestExpression( "STRZERO( \"aaa\" )", "not sure" ); - e->TestExpression( "STRZERO( \"aaa\", 3, 3, )", "??" ); - e->TestExpression( "STRZERO( 22 )", "not sure" ); - e->TestExpression( "STRZERO( 22, 3 )", "not sure" ); - e->TestExpression( "STRZERO( 2, 3, 3 )", "not sure" ); - e->TestExpression( "STRZERO( \"ddd\", 4, 6 ), "not sure" ); -*/ - e->TestExpression( "TRIM( \"aaa \" )", "aaa" ); - e->TestExpression( "UPPER( \"abcde\" )", "ABCDE" ); - -/* functions returning double values */ - e->TestExpression( "ABS( -222 )", 222 ); - e->TestExpression( "EXP( 1 )", (xbDouble) 2.7182800 ); - e->TestExpression( "LOG( 2 )", (xbDouble) 0.69314700 ); - e->TestExpression( "MAX( 10, 27 )", 27 ); - e->TestExpression( "MIN( 10, 5 )", 5 ); - e->TestExpression( "SQRT( 9 )", 3 ); - -/* functions returning long values */ - e->TestExpression( "ASC( \"A\" )", 'A' ); - e->TestExpression( "AT( \"BC\", \"ABCD\" )", 2 ); - e->TestExpression( "DAY( 20000101 )", 1 ); - - e->TestExpression( "DESCEND( 1500 )", -1500 ); - - e->TestExpression( "DOW( 20000101 )", 6 ); - e->TestExpression( "INT( 621.5 )", 621 ); - e->TestExpression( "ISALPHA( \"A\" )", 1 ); - e->TestExpression( "ISLOWER( \"a\" )", 1 ); - e->TestExpression( "ISUPPER( \"A\" )", 1 ); - e->TestExpression( "LEN( \"AAAAA\" )", 5 ); - e->TestExpression( "MONTH( 20000101 )", 1 ); - e->TestExpression( "RECNO()", (xbDouble) 0 ); - e->TestExpression( "VAL( \"ABC\" )", 65 ); - e->TestExpression( "YEAR( \"20000101\" )", 2000 ); - - e->TestExpression( "(25-3+2)*2", 48 ); - e->TestExpression( "(25+3+2)*2", 60 ); - e->TestExpression( "TEST->FLOAT1+1", 6 ); - e->TestExpression( "TEST->FLOAT1 + 1", 6 ); - e->TestExpression( "FLOAT1+1", 6 ); - e->TestExpression( "FLOAT1 + 1", 6 ); - - e->TestExpression( "TEST->FLOAT1 < 1", (xbDouble) 0 ); - e->TestExpression( "TEST->FLOAT1 > 1", (xbDouble) 1 ); - e->TestExpression( "TEST->DATE2 - TEST->DATE1", (xbDouble) 10 ); - - e->TestExpression( "IIF( \"TEST->FLOAT1>0\", \"T\", \"F\" )", "F" ); - e->TestExpression( "IIF( \"TEST->FLOAT1<=0\", \"T\", \"F\" )", "T" ); - - - delete e; - return 0; -} diff --git a/libtest/indextst.cpp b/libtest/indextst.cpp deleted file mode 100755 index c3a74be..0000000 --- a/libtest/indextst.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* indextst.cpp - - Xbase project source code - - This program creates a sample database and multiple indices. - It tests the index logic. - - Copyright (C) 1997,2003 Gary A Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - - Contact: - - Email: - - xbase64-devel@lists.sourceforge.net - xbase64-users@lists.sourceforge.net - - - Regular Mail: - - XBase Support - 149C South Main St - Keller Texas, 76248 - USA -*/ - -#include "xbase64/xbase64.h" - -int CheckIndex( -#ifdef XB_INDEX_NDX - xbNdx *indx1, xbNdx *indx2, xbNdx *indx3 -#endif -#if defined( XB_INDEX_NDX ) && defined ( XB_INDEX_NTX ) - , -#endif -#ifdef XB_INDEX_NTX - xbNtx *intx1, xbNtx *intx2, xbNtx *intx3 -#endif - ); - -int main() -{ - xbShort f1, f2, f3, rc, sts = 0; - char charbuf[10]; - - xbSchema MyRecord[] = - { - { "CHARFLD1", XB_CHAR_FLD, 6, 0 }, - { "CHARFLD2", XB_CHAR_FLD, 6, 0 }, - { "NUMFLD1", XB_NUMERIC_FLD, 6, 0 }, - { "",0,0,0 } - }; - - /* define the classes */ - xbXBase x; /* initialize xbase */ - xbDbf MyFile( &x ); /* class for table */ - -#ifdef XB_INDEX_NDX - xbNdx indx1( &MyFile ); /* class for ndx index 1 */ - xbNdx indx2( &MyFile ); /* class for ndx index 2 */ - xbNdx indx3( &MyFile ); /* class for ndx index 3 */ -#endif - -#ifdef XB_INDEX_NTX - xbNtx intx1( &MyFile ); /* class for ntx index 1 */ - xbNtx intx2( &MyFile ); /* class for ntx index 2 */ - xbNtx intx3( &MyFile ); /* class for ntx index 3 */ -#endif - -#ifndef XBASE_DEBUG - std::cout << "XBASE_DEBUG support option not compiled into library"; - return 1; -#endif - - - std::cout << "Creating test database and indices" << std::endl; - if(( rc = MyFile.CreateDatabase( "IXTEST.DBF", MyRecord, XB_OVERLAY )) - != XB_NO_ERROR ) - std::cout << "Error creating database = " << rc << "\n"; - else - { -#ifdef XB_INDEX_NDX - if(( rc = indx1.CreateIndex( - "IXNDX1.NDX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) - { - std::cout << "Error creating index 1 = " << rc << std::endl; - exit( 1 ); - } - - if(( rc = indx2.CreateIndex( - "IXNDX2.NDX", "CHARFLD1+CHARFLD2", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) - { - std::cout << "Error creating index 2 = " << rc << std::endl; - exit( 1 ); - } - - if(( rc = indx3.CreateIndex( - "IXNDX3.NDX", "NUMFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) - { - std::cout << "Error creating index 3 = " << rc << std::endl; - exit( 1 ); - } -#endif - - -#ifdef XB_INDEX_NTX - if(( rc = intx1.CreateIndex( - "IXNTX1.NTX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) - { - std::cout << "Error creating index 4 = " << rc << std::endl; - exit( 1 ); - } - - if(( rc = intx2.CreateIndex( - "IXNTX2.NTX", "CHARFLD1+CHARFLD2", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) - { - std::cout << "Error creating index 5 = " << rc << std::endl; - exit( 1 ); - } - - if(( rc = intx3.CreateIndex( - "IXNTX3.NTX", "NUMFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) - { - std::cout << "Error creating index 6 = " << rc << std::endl; - exit( 1 ); - } -#endif - } - - f1 = MyFile.GetFieldNo( "CHARFLD1" ); - f2 = MyFile.GetFieldNo( "CHARFLD2" ); - f3 = MyFile.GetFieldNo( "NUMFLD1" ); - - std::cout << "Populating database and indices with data" << std::endl; - std::cout << "."; - std::cout.flush(); - for( int i = 0; i < 10000; i++ ){ - if( i % 100 == 0){ - std::cout << "."; - std::cout.flush(); - } - memset( charbuf, 0x00, 10 ); - sprintf( charbuf, "%d", i ); - MyFile.BlankRecord(); - MyFile.PutField( f1, charbuf ); - MyFile.PutField( f2, charbuf ); - MyFile.PutLongField( f3, i ); - MyFile.AppendRecord(); - - - } - std::cout << " Done." << std::endl; - - // Check all indices. - sts += CheckIndex( -#ifdef XB_INDEX_NDX - &indx1, &indx2, &indx3 -#endif -#if defined( XB_INDEX_NDX ) && defined( XB_INDEX_NTX ) - , -#endif -#ifdef XB_INDEX_NTX - &intx1, &intx2, &intx3 -#endif - ); - // - // Appending a "Z" to the records will cause the index delete - // functions to be used. - // - // - Bob Cotton <bob@synxis.com> - // - std::cout << "Reversing records." << std::endl; - std::cout << "."; - std::cout.flush(); - for( xbLong j = 1; j < MyFile.NoOfRecords(); j++ ){ - if (j % 1000 == 0) - { - std::cout << "."; - std::cout.flush(); - } - MyFile.GetRecord(j); - memset( charbuf, 0x00, 10 ); - sprintf( charbuf, "Z%d", (int)j-1 ); - MyFile.PutField( f1, charbuf ); - MyFile.PutField( f2, charbuf ); - MyFile.PutLongField( f3, j-1 ); - MyFile.PutRecord(); - } - std::cout << " Done." << std::endl; - // Check all indices - sts += CheckIndex( -#ifdef XB_INDEX_NDX - &indx1, &indx2, &indx3 -#endif -#if defined( XB_INDEX_NDX ) && defined( XB_INDEX_NTX ) - , -#endif -#ifdef XB_INDEX_NTX - &intx1, &intx2, &intx3 -#endif - ); - - - std::cout << "Index testing completed" << std::endl;std::cout.flush(); - MyFile.CloseDatabase(); /* Close database and associated indexes */ - return sts; -} - - -int CheckIndex( -#ifdef XB_INDEX_NDX - xbNdx *indx1, - xbNdx *indx2, - xbNdx *indx3 -#endif -#if defined( XB_INDEX_NDX ) && defined( XB_INDEX_NTX ) - , -#endif -#ifdef XB_INDEX_NTX - xbNtx *intx1, - xbNtx *intx2, - xbNtx *intx3 -#endif - ) -{ - int rc; - int sts = 0; - -#if defined( XB_INDEX_NDX ) && defined( XBASE_DEBUG ) - std::cout << "Testing NDX index 1 "; std::cout.flush(); - if(( rc = indx1->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ - std::cout << "Error " << rc << " with index indx1" << std::endl; - sts++; - } - else - std::cout << "OK" << std::endl; - - std::cout << "Testing NDX index 2 ";std::cout.flush(); - if(( rc = indx2->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ - std::cout << "Error " << rc << " with index indx2" << std::endl; - sts++; - } - else - std::cout << "OK" << std::endl; - - - std::cout << "Testing NDX index 3 ";std::cout.flush(); - if(( rc = indx3->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ - std::cout << "Error " << rc << " with index indx3" << std::endl; - sts++; - } - else - std::cout << "OK" << std::endl; -#endif -#if defined( XB_INDEX_NTX ) && defined( XBASE_DEBUG ) - std::cout << "Testing NTX index 1 ";std::cout.flush(); - if(( rc = intx1->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ - std::cout << "Error " << rc << " with index intx1" << std::endl; - sts++; - } - else - std::cout << "OK" << std::endl; - - std::cout << "Testing NTX index 2 ";std::cout.flush(); - if(( rc = intx2->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ - std::cout << "Error " << rc << " with index intx2" << std::endl; - sts++; - } - else - std::cout << "OK" << std::endl; - - std::cout << "Testing NTX index 3 ";std::cout.flush(); - if(( rc = intx3->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ - std::cout << "Error " << rc << " with index intx3" << std::endl; - sts++; - } - else - std::cout << "OK" << std::endl; -#endif - return sts; - -} - diff --git a/libtest/lfiletst.cpp b/libtest/lfiletst.cpp deleted file mode 100755 index 7e50c8f..0000000 --- a/libtest/lfiletst.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* lfiletst.cpp - - Xbase project source code - - This program creates a sample database and multiple indices. - It tests the 64 bit file support logic. - - Copyright (C) 1997,2003 Gary A Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - - Contact: - - Email: - - xbase64-devel@lists.sourceforge.net - xbase64-users@lists.sourceforge.net - - - Regular Mail: - - XBase Support - 149C South Main St - Keller Texas, 76248 - USA -*/ - -#include "xbase64/xbase64.h" - -int main() -{ - xbShort f1, f2, f3, f4, rc; -#ifdef XB_MEMO_FIELDS - xbShort f5; -#endif - char charbuf[10]; - - xbSchema MyRecord[] = - { - { "CHARFLD1", XB_CHAR_FLD, 10, 0 }, - { "NUMFLD1", XB_NUMERIC_FLD, 10, 0 }, - { "BIGFIELD1", XB_CHAR_FLD, 255, 0 }, - { "BIGFIELD2", XB_CHAR_FLD, 255, 0 }, - { "BIGFIELD3", XB_CHAR_FLD, 255, 0 }, - { "BIGFIELD4", XB_CHAR_FLD, 255, 0 }, -#ifdef XB_MEMO_FIELDS - { "MEMOFLD", XB_MEMO_FLD, 10, 0 }, -#endif - { "",0,0,0 } - }; - - /* define the classes */ - xbXBase x; /* initialize xbase */ - xbDbf MyFile( &x ); /* class for table */ - -#ifdef XB_INDEX_NDX - xbNdx indx1( &MyFile ); /* class for ndx index 1 */ -#endif - -#ifdef XB_INDEX_NTX - xbNtx intx1( &MyFile ); /* class for ntx index 1 */ -#endif - -#ifndef XBASE_64_BIT - std::cout << "XBASE_64_BIT support option not compiled into library"; - return 1; -#endif - - std::cout << "Creating test database and indices" << std::endl; - if(( rc = MyFile.CreateDatabase( "LFTEST.DBF", MyRecord, XB_OVERLAY )) - != XB_NO_ERROR ) - std::cout << "Error creating database = " << rc << "\n"; - else - { -#ifdef XB_INDEX_NDX - if(( rc = indx1.CreateIndex( - "LFNDX1.NDX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ){ - std::cout << "Error creating index 1 = " << rc << std::endl; - exit( 1 ); - } -#endif - -#ifdef XB_INDEX_NTX - if(( rc = intx1.CreateIndex( - "LFNTX1.NTX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ){ - std::cout << "Error creating index 2 = " << rc << std::endl; - exit( 1 ); - } -#endif - } - - f1 = MyFile.GetFieldNo( "CHARFLD1" ); - f2 = MyFile.GetFieldNo( "NUMFLD1" ); - f3 = MyFile.GetFieldNo( "BIGFIELD1" ); - f4 = MyFile.GetFieldNo( "BIGFIELD2" ); -#ifdef XB_MEMO_FIELDS - f5 = MyFile.GetFieldNo( "MEMOFLD" ); -#endif - - std::cout << "sizeof( XbOffT ) = " << sizeof( xbOffT ) << std::endl; - std::cout << "sizeof( xbLong ) = " << sizeof( xbLong ) << std::endl; - std::cout << "Populating database and indices with data" << std::endl; - std::cout << "This will take a while and consume some 20G of disk space" << std::endl; - std::cout << "<ctrl><C> to kill this program" << std::endl; - std::cout << "."; - std::cout.flush(); - for( long i = 0; i < 20000000; i++ ){ - if( i % 5000 == 0){ - std::cout << "."; - std::cout.flush(); - } - memset( charbuf, 0x00, 10 ); - sprintf( charbuf, "%d", i ); - MyFile.BlankRecord(); - MyFile.PutField( f1, charbuf ); - MyFile.PutLongField( f2, i ); - MyFile.PutField( f3, charbuf ); - MyFile.PutField( f4, charbuf ); -#ifdef XB_MEMO_FIELDS - MyFile.UpdateMemoData( f5, strlen( charbuf ), charbuf, 0 ); -#endif - MyFile.AppendRecord(); - } - std::cout << " Done." << std::endl; -} diff --git a/libtest/locktest.cpp b/libtest/locktest.cpp deleted file mode 100755 index 01f75de..0000000 --- a/libtest/locktest.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - This debugging program tests Xbase locking functions - - Copyright (C) 1997,2003 Gary A Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - - Contact: - - Email: - - xbase64-devel@lists.sourceforge.net - xbase64-users@lists.sourceforge.net - - - Regular Mail: - - XBase Support - 149C South Main St - Keller Texas, 76248 - USA - - -*/ - -#include "xbase64/xbase64.h" - -int main(int, char**) -{ -#if 0 // FIXME - seriously -#ifdef XB_LOCKING_ON - xbShort rc; - - if(2!=ac){ - cout << "\nUsage: locktest filename\n"; - return 1; - } - - if(( rc = d.OpenDatabase( av[1] )) != XB_NO_ERROR ) { - cout << "\nError " << rc << " opening file " << av[1] << endl; - exit(0); - } - xbXBase x; - xbDbf d( &x ); - - cout << "\nGoing to lock database..." << endl; - rc = d.LockDatabase( F_SETLKW, F_WRLCK, 1L ); - if ( rc == -1 ){ - perror("Lock Error"); - return 2; - } - cout << "Database locked\n\nEnter a keystroke to release lock\n"; - char xx[4]; - cin >> xx; - - rc = d.LockDatabase( F_SETLK, F_UNLCK, 1L ); - cout << "Unlock database rc = " << rc << "\n"; - d.CloseDatabase(); -#else - cout << "\nXB_LOCKING_ON is not compiled in\n"; -#endif -#endif - return 0; -} diff --git a/libtest/makebcc.bat b/libtest/makebcc.bat deleted file mode 100755 index bc38b05..0000000 --- a/libtest/makebcc.bat +++ /dev/null @@ -1,16 +0,0 @@ -
-rem This batch file builds the xbase sample programs
-rem using the borland 5.5 compiler
-
-del *.bak
-del *.tds
-del *.exe
-del *.obj
-del compout
-
-
-bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 indextst.cpp xbase64.lib >> compout
-bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 exptest.cpp xbase64.lib >> compout
-bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 locktest.cpp xbase64.lib >> compout
-bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 testdate.cpp xbase64.lib >> compout
-
diff --git a/libtest/readme b/libtest/readme deleted file mode 100755 index 64f6b52..0000000 --- a/libtest/readme +++ /dev/null @@ -1,10 +0,0 @@ -The libtest directory includes programs which are designed for -testing the basic functionality of the library. These programs -are intended to be used to find bugs in the basic library functions -after enhancements/updates or fixes have been applied to the library. - -testdate - used for testing date logic -indextst - used for testing indices -exptest - used for testing the expression logic -locktest - used for the debugging of the record and file locking logic -lfiletst - used for testing 64 bit file support
\ No newline at end of file diff --git a/libtest/testdate.cpp b/libtest/testdate.cpp deleted file mode 100755 index 1049049..0000000 --- a/libtest/testdate.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - Xbase project source code - - This program tests the xdate routines - - This program tests and demonstrates usage of the various xbDate methods - - Several of the tests pass either StringDate or Chardate to the method - being tested - this is done to test the class methods. In actual usage, - this may not be necessary due to the instance of the class already - containing a date value. - - Copyright (C) 1997,2003 Gary A Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - - Contact: - - Email: - - xbase64-devel@lists.sourceforge.net - xbase64-users@lists.sourceforge.net - - - Regular Mail: - - XBase Support - 149C South Main St - Keller Texas, 76248 - USA - -*/ - -#include "xbase64/xbase64.h" - -int main() -{ - xbString StringDate( "19701007" ); /* oct 7 1960 */ - char CharDate[9] = "19611109"; /* nov 9 1961 */ - - xbDate d1; /* today is default */ - xbDate d2( StringDate ); /* from string data */ - xbDate d3( CharDate ); /* from char data */ - xbDate d4; /* another date class */ - - std::cout << "This program tests the XDATE routines" << std::endl; - std::cout << "Date 1 (Sysdate) is " << d1.GetDate() << std::endl; - std::cout << "Date 2 (StringDate) is " << d2.GetDate() << std::endl; - std::cout << "Date 3 (CharDate) is " << d3.GetDate() << std::endl; - - std::cout << "This year is " << d1.YearOf() << std::endl; - std::cout << "Year of xbString Date is " << d2.YearOf( StringDate ) - << std::endl; - std::cout << "Year of char Date is " << d3.YearOf( CharDate ) - << std::endl; - - std::cout << "This Month is " << d1.MonthOf() << std::endl; - std::cout << "Month of xbString Date is " << d2.MonthOf( StringDate ) - << std::endl; - std::cout << "Month of char Date is " << d3.MonthOf( CharDate ) - << std::endl; - - std::cout << "Today is day " << d1.DayOf( XB_FMT_WEEK ) << " of the week" - << std::endl; - std::cout << "StringDate is day " << d2.DayOf( XB_FMT_MONTH, StringDate ) - << " of the month" << std::endl; - std::cout << "CharDate is day " << d3.DayOf( XB_FMT_YEAR, CharDate ) - << " of the year" << std::endl; - - if( d1.IsLeapYear()) - std::cout << "This is a leapyear" << std::endl; - else - std::cout << "This is not a leap year." << std::endl; - - if( d2.IsLeapYear( StringDate )) - std::cout << "StringDate is a leapyear" << std::endl; - else - std::cout << "StringDate is not a leap year." << std::endl; - - if( d3.IsLeapYear( CharDate )) - std::cout << "CharDate is a leapyear" << std::endl; - else - std::cout << "CharDate is not a leap year." << std::endl; - - std::cout << "Today is " << d1.Sysdate() << std::endl; - - if( d1.DateIsValid( "19951301" )) - std::cout << "19951301 is a valid date" << std::endl; - else - std::cout << "19951301 is not a valid date" << std::endl; - - if( d1.DateIsValid( "19920229" )) - std::cout << "19920229 is a valid date" << std::endl; - else - std::cout << "19920229 is not a valid date" << std::endl; - - if( d2.DateIsValid( StringDate )) - std::cout << StringDate << " is a valid date" << std::endl; - else - std::cout << StringDate << " is not a valid date" << std::endl; - - std::cout << "Today's Julian date " << d1.JulianDays() << std::endl; - std::cout << "Julian date of Jan 01, 1970 " << d2.JulianDays( "19700101" ) - << std::endl; - std::cout << "StringDate Julian date " << d2.JulianDays( StringDate ) - << std::endl; - - std::cout << "There are " - << ( d1.JulianDays( "19951101" ) - d1.JulianDays( "19951001" )) - << " days between 10/1/95 and 11/1/95." << std::endl; - - std::cout << "Todays Julian date (Number of days since Jan 1 0100):" - << d1.JulianDays() << std::endl; - - d4 = d1; // set d4 class = to sysdate - std::cout << "Object d4 initialized to " << d4.GetDate() << std::endl; - std::cout << "This should be todays date: " - << d4.JulToDate8(d4.JulianDays()) << std::endl; - std::cout << "In 7 days it will be " - << d4.JulToDate8(d4.JulianDays() + 7L ) << std::endl; - - std::cout << "Today is " << d1.CharDayOf() << std::endl; - std::cout << "StringDate day is " << d2.CharDayOf( StringDate ) - << std::endl; - std::cout << "This month is " << d1.CharMonthOf() << std::endl; - std::cout << "StringDate month is " << d2.CharMonthOf() << std::endl; - - - /* various format routines using different formats, strings and chars */ - xbString xbStFmt( "MM/DD/YY" ); - std::cout << "Format (YYDDD) " << d1.FormatDate( "YYDDD" ) << std::endl; - std::cout << "Format (MM/DD/YY) " << d1.FormatDate( xbStFmt ) << std::endl; - xbStFmt = "DD/MM/YY"; - std::cout << "Format (DD/MM/YY) " << d1.FormatDate(xbStFmt, "19730110") - << std::endl; - std::cout << "Format (MMMM DD,YYYY) " - << d1.FormatDate( "MMMM DD,YYYY", d1.GetDate()) << std::endl; - xbStFmt = "DDDD, MMMM DD YYYY"; - std::cout << "Format (DDDD, MMMM DD YYYY) " - << d2.FormatDate( xbStFmt, d2.GetDate()) << std::endl; - - std::cout << "Last day this month " << d1.LastDayOfMonth() << std::endl; - std::cout << "Last day of month for StringDate is " - << d2.LastDayOfMonth( d2.GetDate()) << std::endl; - - std::cout << "Overloaded operators test..." << std::endl; - - if( d1 == d2 ) - std::cout << d1.GetDate() << " is equal to " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not equal to " << d2.GetDate() - << std::endl; - - if( d1 != d3 ) - std::cout << d1.GetDate() << " is not equal to " << d3.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is equal to " << d3.GetDate() - << std::endl; - - if( d1 < d2 ) - std::cout << d1.GetDate() << " is less than " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not less than " << d2.GetDate() - << std::endl; - - if( d1 > d2 ) - std::cout << d1.GetDate() << " is greater than " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not greater than " << d2.GetDate() - << std::endl; - - if( d1 <= d2 ) - std::cout << d1.GetDate() << " is less than or equal to " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not less than or equal to " - << d2.GetDate() << std::endl; - - if( d1 >= d2 ) - std::cout << d1.GetDate() << " is greater than or equal to " - << d2.GetDate() << std::endl; - else - std::cout << d1.GetDate() << " is not greater than or equal to " - << d2.GetDate() << std::endl; - - d1.Sysdate(); - d1++; - std::cout << "Tomorrow is " << d1.GetDate() << std::endl; - d1-=2; - std::cout << "Yesterday was " << d1.GetDate() << std::endl; - std::cout << "There are " << d1 - d2 << " days between " << d1.GetDate() - << " and " << d2.GetDate() << std::endl; - - return 0; -} - |