summaryrefslogtreecommitdiff
path: root/src/tests/xb_test_xbase.cpp
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-12-07 13:17:14 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-12-07 13:17:14 +0100
commit4875a3dd9b183dcd2256e2abfc4ccf7484c233b4 (patch)
tree0abbea881ded030851014ffdd60fbf71fead8f65 /src/tests/xb_test_xbase.cpp
parentdaf17154bf13139d9375f48525d19d6aaba08155 (diff)
New upstream version 4.0.2upstream/4.0.2
Diffstat (limited to 'src/tests/xb_test_xbase.cpp')
-rwxr-xr-xsrc/tests/xb_test_xbase.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/tests/xb_test_xbase.cpp b/src/tests/xb_test_xbase.cpp
new file mode 100755
index 0000000..6dad3f7
--- /dev/null
+++ b/src/tests/xb_test_xbase.cpp
@@ -0,0 +1,106 @@
+/* xb_test_xbase.cpp
+
+XBase64 Software Library
+
+Copyright (c) 1997,2003,2014, 2022 Gary A Kunkel
+
+The xb64 software library is covered under the terms of the GPL Version 3, 2007 license.
+
+Email Contact:
+
+ XDB-devel@lists.sourceforge.net
+ XDB-users@lists.sourceforge.net
+
+*/
+
+// This program tests the class xbXBase
+
+// usage: xb_test_xbase QUITE|NORMAL|VERBOSE
+
+
+#include "xbase.h"
+
+using namespace xb;
+
+#include "tstfuncs.cpp"
+
+int main( int argCnt, char **av )
+{
+ int iRc = 0;
+ int po = 1; /* print option */
+ /* 0 - QUIET */
+ /* 1 - NORMAL */
+ /* 2 - VERBOSE */
+
+ if( argCnt > 1 ) {
+ if( av[1][0] == 'Q' )
+ po = 0;
+ else if( av[1][0] == 'V' )
+ po = 2;
+ }
+
+
+ xbXBase x;
+
+
+#ifdef XB_LOGGING_SUPPORT
+ x.EnableMsgLogging();
+ if( po ){
+ std::cout << "Logfile is [" << x.GetLogFqFileName().Str() << "]" << std::endl;
+ }
+ xbString sMsg;
+ sMsg.Sprintf( "Program [%s] initializing...", av[0] );
+ x.WriteLogMessage( sMsg );
+#endif
+ InitTime();
+
+
+ x.SetDefaultDateFormat( "YY-MM-DD" );
+ iRc += TestMethod( po, "SetDefaultDateFormat", x.GetDefaultDateFormat(), "YY-MM-DD", 8 );
+
+ if( po == 2 ){
+ if( x.GetEndianType() == 'L' )
+ std::cout << "Little Endian Architecture" << std::endl;
+ else if( x.GetEndianType() == 'B' )
+ std::cout << "Big Endian Architecture" << std::endl;
+ else
+ std::cout << "Undefine Endian Architecture" << std::endl;
+ }
+
+ iRc += TestMethod( po, "GetErrorMessage", x.GetErrorMessage( XB_DBF_FILE_NOT_OPEN ), "DBF File Not Open", 17 );
+
+
+#ifdef XB_LOGGING_SUPPORT
+ xbString sLogDir = PROJECT_LOG_DIR;
+ iRc += TestMethod( po, "GetDefaultLogDirectory()", x.GetDefaultLogDirectory(), sLogDir, sLogDir.Len());
+
+ xbString sLogName = CMAKE_SYSTEM_NAME;
+ sLogName += "_";
+ sLogName += XB_PLATFORM;
+ sLogName += ".xbLog.txt";
+ iRc += TestMethod( po, "GetDefaultLogFileName()", x.GetDefaultLogFileName(), sLogName, sLogName.Len());
+
+ x.WriteLogMessage( "test" );
+#endif
+
+ x.xbSleep( 250 );
+
+
+
+ if( po == 2 ){
+ std::cout << "DisplayError Test ==> ";
+ x.DisplayError( 0 );
+ }
+
+ if( po > 0 || iRc < 0 )
+ fprintf( stdout, "Total Errors = %d\n", iRc * -1 );
+
+
+#ifdef XB_LOGGING_SUPPORT
+ sMsg.Sprintf( "Program [%s] terminating with [%d] errors...", av[0], iRc * -1 );
+ x.WriteLogMessage( sMsg );
+#endif
+
+ return iRc;
+}
+