diff options
Diffstat (limited to 'src/tests/xb_test_xbase.cpp')
-rwxr-xr-x | src/tests/xb_test_xbase.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/tests/xb_test_xbase.cpp b/src/tests/xb_test_xbase.cpp index 9d523c5..4751c25 100755 --- a/src/tests/xb_test_xbase.cpp +++ b/src/tests/xb_test_xbase.cpp @@ -2,7 +2,7 @@ XBase64 Software Library -Copyright (c) 1997,2003,2014, 2022 Gary A Kunkel +Copyright (c) 1997,2003,2014,2022,2023 Gary A Kunkel The xb64 software library is covered under the terms of the GPL Version 3, 2007 license. @@ -27,26 +27,34 @@ using namespace xb; int main( int argCnt, char **av ) { int iRc = 0; - int po = 1; /* print option */ + int iPo = 1; /* print option */ /* 0 - QUIET */ /* 1 - NORMAL */ /* 2 - VERBOSE */ if( argCnt > 1 ) { if( av[1][0] == 'Q' ) - po = 0; + iPo = 0; else if( av[1][0] == 'V' ) - po = 2; + iPo = 2; } xbXBase x; xbString sMsg; #ifdef XB_LOGGING_SUPPORT + + + xbString sLogDir = PROJECT_LOG_DIR; +// x.SetLogDirectory( sLogDir ); + x.SetLogDirectory( PROJECT_LOG_DIR ); + + x.EnableMsgLogging(); - if( po ){ + if( iPo ){ std::cout << "Logfile is [" << x.GetLogFqFileName().Str() << "]" << std::endl; } + sMsg.Sprintf( "Program [%s] initializing...", av[0] ); x.WriteLogMessage( sMsg ); #endif @@ -54,8 +62,8 @@ int main( int argCnt, char **av ) x.SetDefaultDateFormat( "YY-MM-DD" ); - iRc += TestMethod( po, "SetDefaultDateFormat", x.GetDefaultDateFormat(), "YY-MM-DD", 8 ); - if( po == 2 ){ + iRc += TestMethod( iPo, "SetDefaultDateFormat", x.GetDefaultDateFormat(), "YY-MM-DD", 8 ); + if( iPo == 2 ){ if( x.GetEndianType() == 'L' ) std::cout << "Little Endian Architecture" << std::endl; else if( x.GetEndianType() == 'B' ) @@ -64,38 +72,32 @@ int main( int argCnt, char **av ) std::cout << "Undefine Endian Architecture" << std::endl; } - iRc += TestMethod( po, "GetErrorMessage", x.GetErrorMessage( XB_DBF_FILE_NOT_OPEN ), "DBF File Not Open", 17 ); + iRc += TestMethod( iPo, "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()); - + iRc += TestMethod( iPo, "GetLogDirectory()", x.GetLogDirectory(), 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" ); + iRc += TestMethod( iPo, "GetLogFileName()", x.GetLogFileName(), sLogName, sLogName.Len()); + x.WriteLogMessage( "Program xb_test_xbase - test logfile message" ); #endif x.xbSleep( 250 ); - - - if( po == 2 ){ + if( iPo == 2 ){ std::cout << "DisplayError Test ==> "; x.DisplayError( 0 ); } - - if( po > 0 || iRc < 0 ) + if( iPo > 0 || iRc < 0 ) fprintf( stdout, "Total Errors = %d\n", iRc * -1 ); -#ifdef XB_LOGGING_SUPPORT + #ifdef XB_LOGGING_SUPPORT sMsg.Sprintf( "Program [%s] terminating with [%d] errors...", av[0], iRc * -1 ); x.WriteLogMessage( sMsg ); -#endif + #endif return iRc; } |