diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-08-14 21:07:48 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-08-14 21:07:48 +0200 |
commit | d850e78baf62d1f472a3a296f407c127c64cec88 (patch) | |
tree | 39725643b44c91ea25809766cf95cd0b1173e880 /src/tests/xb_test_file.cpp | |
parent | 15f88452d39eee5a89551a89ef2b93df5168ba2f (diff) | |
parent | c894a7cdd8686ea695602a23a511a3f1b0d047be (diff) |
Update upstream source from tag 'upstream/4.1.4'
Update to upstream version '4.1.4'
with Debian dir 403f575aa88344456029245280a05149f0173f2e
Diffstat (limited to 'src/tests/xb_test_file.cpp')
-rwxr-xr-x | src/tests/xb_test_file.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/src/tests/xb_test_file.cpp b/src/tests/xb_test_file.cpp index cf835c2..0db6eca 100755 --- a/src/tests/xb_test_file.cpp +++ b/src/tests/xb_test_file.cpp @@ -27,24 +27,24 @@ using namespace xb; int main( int argCnt, char **av ) { - int rc = 0; - int po = 1; /* print option */ + int iRc = 0; + 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; #ifdef XB_LOGGING_SUPPORT x.SetLogDirectory( PROJECT_LOG_DIR ); x.EnableMsgLogging(); - if( po ){ + if( iPo ){ std::cout << "Logfile is [" << x.GetLogFqFileName().Str() << "]" << std::endl; } xbString sMsg; @@ -65,14 +65,14 @@ int main( int argCnt, char **av ) sWrkStr.SwapChars( '\\', '/' ); #endif - rc += TestMethod( po, "Set/GetDataDirectory()", f.GetDataDirectory(), sWrkStr, sWrkStr.Len()); + iRc += TestMethod( iPo, "Set/GetDataDirectory()", f.GetDataDirectory(), sWrkStr, sWrkStr.Len()); f.SetFileName( "TestFile.txt" ); sWrkStr = "TestFile.txt"; - rc += TestMethod( po, "Set/GetFileName()", f.GetFileName(), sWrkStr, sWrkStr.Len()); + iRc += TestMethod( iPo, "Set/GetFileName()", f.GetFileName(), sWrkStr, sWrkStr.Len()); f.GetFileType( sWrkStr ); - rc += TestMethod( po, "GetFileType()", sWrkStr, "TXT", 3 ); + iRc += TestMethod( iPo, "GetFileType()", sWrkStr, "TXT", 3 ); #ifdef WIN32 sWrkStr = "\\my\\directory\\"; @@ -81,10 +81,10 @@ int main( int argCnt, char **av ) #endif f.SetDirectory( sWrkStr ); - rc += TestMethod( po, "Set/GetDirectory()", f.GetDirectory(), sWrkStr, sWrkStr.Len()); + iRc += TestMethod( iPo, "Set/GetDirectory()", f.GetDirectory(), sWrkStr, sWrkStr.Len()); sWrkStr += "TestFile.txt"; - rc += TestMethod( po, "GetFqFileName()", f.GetFqFileName(), sWrkStr, 26 ); + iRc += TestMethod( iPo, "GetFqFileName()", f.GetFqFileName(), sWrkStr, 26 ); #ifdef WIN32 sWrkStr = "\\some\\directory\\myfile.dat"; @@ -95,115 +95,115 @@ int main( int argCnt, char **av ) #endif f.SetFqFileName( sWrkStr ); - rc += TestMethod( po, "GetDirectory()", f.GetDirectory(), sWrkStr2, 16 ); - rc += TestMethod( po, "GetFileName()", f.GetFileName(), "myfile.dat", 10 ); + iRc += TestMethod( iPo, "GetDirectory()", f.GetDirectory(), sWrkStr2, 16 ); + iRc += TestMethod( iPo, "GetFileName()", f.GetFileName(), "myfile.dat", 10 ); - rc += TestMethod( po, "NameSuffixMissing()", f.NameSuffixMissing( "myfile.dbf", 1 ), 0 ); - rc += TestMethod( po, "NameSuffixMissing()", f.NameSuffixMissing( "myfile", 1 ), 1 ); - rc += TestMethod( po, "NameSuffixMissing()", f.NameSuffixMissing( "MYFILE", 1 ), 2 ); + iRc += TestMethod( iPo, "NameSuffixMissing()", f.NameSuffixMissing( "myfile.dbf", 1 ), 0 ); + iRc += TestMethod( iPo, "NameSuffixMissing()", f.NameSuffixMissing( "myfile", 1 ), 1 ); + iRc += TestMethod( iPo, "NameSuffixMissing()", f.NameSuffixMissing( "MYFILE", 1 ), 2 ); f.SetDirectory( PROJECT_DATA_DIR ); f.SetFileName( "xbfile.txt" ); - rc += TestMethod( po, "xbFopen()", f.xbFopen( "w+b", XB_MULTI_USER ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFopen()", f.xbFopen( "w+b", XB_MULTI_USER ), XB_NO_ERROR ); xbString sTest; sTest = "Test Data"; - rc += TestMethod( po, "xbWrite()", f.xbFwrite( sTest.Str(), 9, 1 ), XB_NO_ERROR ); - rc += TestMethod( po, "xbFclose()", f.xbFclose(), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbWrite()", f.xbFwrite( sTest.Str(), 9, 1 ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFclose()", f.xbFclose(), XB_NO_ERROR ); - rc += TestMethod( po, "xbFopen()", f.xbFopen( "r+b", XB_MULTI_USER ), XB_NO_ERROR ); - rc += TestMethod( po, "xbFseek()", f.xbFseek( 0, SEEK_SET ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFopen()", f.xbFopen( "r+b", XB_MULTI_USER ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFseek()", f.xbFseek( 0, SEEK_SET ), XB_NO_ERROR ); char buf[10]; for( int i = 0; i < 10; i++ ) buf[i] = 0x00; - rc += TestMethod( po, "xbFread()", f.xbFread( buf, 5, 1 ), XB_NO_ERROR ); - rc += TestMethod( po, "xbFread()", buf, "Test ", 5 ); + iRc += TestMethod( iPo, "xbFread()", f.xbFread( buf, 5, 1 ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFread()", buf, "Test ", 5 ); - rc += TestMethod( po, "xbFclose()", f.xbFclose(), XB_NO_ERROR ); - rc += TestMethod( po, "xbRemove()", f.xbRemove(), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFclose()", f.xbFclose(), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbRemove()", f.xbRemove(), XB_NO_ERROR ); xbInt16 iWork = 100; char cBuf[9]; char *p = cBuf; f.ePutInt16( cBuf, iWork ); - rc += TestMethod( po, "Put/GetShort()", f.eGetInt16( p ), 100 ); + iRc += TestMethod( iPo, "Put/GetShort()", f.eGetInt16( p ), 100 ); xbInt32 lWork = 10101; f.ePutInt32( p, lWork ); - rc += TestMethod( po, "Put/GetLong()", f.eGetInt32( p ), 10101 ); + iRc += TestMethod( iPo, "Put/GetLong()", f.eGetInt32( p ), 10101 ); lWork = 2147483647; f.ePutInt32( p, lWork ); - rc += TestMethod( po, "Put/GetLong()", f.eGetInt32( p ), 2147483647 ); - rc += TestMethod( po, "Put/GetLong()", (xbInt32) f.eGetUInt32( p ), 2147483647 ); + iRc += TestMethod( iPo, "Put/GetLong()", f.eGetInt32( p ), 2147483647 ); + iRc += TestMethod( iPo, "Put/GetLong()", (xbInt32) f.eGetUInt32( p ), 2147483647 ); xbDouble d = 123456.789; f.ePutDouble( p, d ); - rc += TestMethod( po, "Put/GetDouble()", f.eGetDouble( p ), 123456.789 ); + iRc += TestMethod( iPo, "Put/GetDouble()", f.eGetDouble( p ), 123456.789 ); xbString sFqnS; xbString sFqnT; xbFile f2( &x ); - rc += TestMethod( po, "CreateUniqueFileName()", f2.CreateUniqueFileName( PROJECT_DATA_DIR, "dbf", sFqnS ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "CreateUniqueFileName()", f2.CreateUniqueFileName( PROJECT_DATA_DIR, "dbf", sFqnS ), XB_NO_ERROR ); - rc += TestMethod( po, "FileExists()", f2.FileExists( sFqnS ), xbFalse ); - rc += TestMethod( po, "xbFopen()", f2.xbFopen( "w+b", sFqnS, XB_SINGLE_USER ), XB_NO_ERROR ); - rc += TestMethod( po, "xbFclose()", f2.xbFclose(), XB_NO_ERROR ); - rc += TestMethod( po, "FileExists()", f2.FileExists( sFqnS ), xbTrue ); + iRc += TestMethod( iPo, "FileExists()", f2.FileExists( sFqnS ), xbFalse ); + iRc += TestMethod( iPo, "xbFopen()", f2.xbFopen( "w+b", sFqnS, XB_SINGLE_USER ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFclose()", f2.xbFclose(), XB_NO_ERROR ); + iRc += TestMethod( iPo, "FileExists()", f2.FileExists( sFqnS ), xbTrue ); - rc += TestMethod( po, "CreateUniqueFileName()", f2.CreateUniqueFileName( PROJECT_DATA_DIR, "dbf", sFqnT ), XB_NO_ERROR ); - rc += TestMethod( po, "xbRename()", f2.xbRename( sFqnS, sFqnT ), XB_NO_ERROR ); - rc += TestMethod( po, "xbRemove()", f.xbRemove( sFqnT ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "CreateUniqueFileName()", f2.CreateUniqueFileName( PROJECT_DATA_DIR, "dbf", sFqnT ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbRename()", f2.xbRename( sFqnS, sFqnT ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbRemove()", f.xbRemove( sFqnT ), XB_NO_ERROR ); xbString sFn; - rc += TestMethod( po, "GetFileNamePart()", f2.GetFileNamePart( sFqnS , sFn ), XB_NO_ERROR ); - rc += TestMethod( po, "GetFileExtPart()", f2.GetFileExtPart( sFqnS , sFn ), XB_NO_ERROR ); - rc += TestMethod( po, "GetFileExtPart()", f2.GetFileDirPart( sFqnS , sFn ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "GetFileNamePart()", f2.GetFileNamePart( sFqnS , sFn ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "GetFileExtPart()", f2.GetFileExtPart( sFqnS , sFn ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "GetFileExtPart()", f2.GetFileDirPart( sFqnS , sFn ), XB_NO_ERROR ); - rc += TestMethod( po, "SetBlockSize()", f.SetBlockSize( 100 ), XB_INVALID_BLOCK_SIZE ); - rc += TestMethod( po, "SetBlockSize()", f.SetBlockSize( 512 ), XB_NO_ERROR ); - rc += TestMethod( po, "GetBlockSize()", (xbInt32) f.GetBlockSize(), 512 ); + iRc += TestMethod( iPo, "SetBlockSize()", f.SetBlockSize( 100 ), XB_INVALID_BLOCK_SIZE ); + iRc += TestMethod( iPo, "SetBlockSize()", f.SetBlockSize( 512 ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "GetBlockSize()", (xbInt32) f.GetBlockSize(), 512 ); char BlockBuf[513]; memset( BlockBuf, 0x00, 513 ); - rc += TestMethod( po, "xbFopen()", f.xbFopen( "w+b", XB_SINGLE_USER ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbFopen()", f.xbFopen( "w+b", XB_SINGLE_USER ), XB_NO_ERROR ); for( int i = 0; i < 512; i++ ) BlockBuf[i] = 'A'; - rc += TestMethod( po, "WriteBlock()", f.WriteBlock( 0L, 512, BlockBuf ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "WriteBlock()", f.WriteBlock( 0L, 512, BlockBuf ), XB_NO_ERROR ); for( int i = 0; i < 512; i++ ) BlockBuf[i] = 'B'; - rc += TestMethod( po, "WriteBlock()", f.WriteBlock( 1L, 512, BlockBuf ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "WriteBlock()", f.WriteBlock( 1L, 512, BlockBuf ), XB_NO_ERROR ); for( int i = 0; i < 512; i++ ) BlockBuf[i] = 'C'; - rc += TestMethod( po, "WriteBlock()", f.WriteBlock( 2L, 512, BlockBuf ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "WriteBlock()", f.WriteBlock( 2L, 512, BlockBuf ), XB_NO_ERROR ); char BlockBuf2[513]; memset( BlockBuf2, 0x00, 513 ); - rc += TestMethod( po, "ReadBlock()", f.ReadBlock( 2L, 512, BlockBuf2 ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "ReadBlock()", f.ReadBlock( 2L, 512, BlockBuf2 ), XB_NO_ERROR ); xbString s1 = BlockBuf; xbString s2 = BlockBuf2; - rc += TestMethod( po, "ReadBlock()", s1, s2, 512 ); - - rc += TestMethod( po, "xbTruncate()", f.xbTruncate( 1000 ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "ReadBlock()", s1, s2, 512 ); + iRc += TestMethod( iPo, "xbTruncate()", f.xbTruncate( 1000 ), XB_NO_ERROR ); xbUInt64 ullFsize; - rc += TestMethod( po, "GetFileSize()", f.GetFileSize( ullFsize ), XB_NO_ERROR ); - rc += TestMethod( po, "xbGetFileSize()", (xbInt32) ullFsize, 1000 ); - rc += TestMethod( po, "xbFclose()", f.xbFclose(), XB_NO_ERROR ); + iRc += TestMethod( iPo, "GetFileSize()", f.GetFileSize( ullFsize ), XB_NO_ERROR ); + iRc += TestMethod( iPo, "xbGetFileSize()", (xbInt32) ullFsize, 1000 ); + iRc += TestMethod( iPo, "xbFclose()", f.xbFclose(), XB_NO_ERROR ); + - if( po > 0 || rc < 0 ) - fprintf( stdout, "Total Errors = %d\n", rc * -1 ); + if( iPo > 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], rc * -1 ); + sMsg.Sprintf( "Program [%s] terminating with [%d] errors...", av[0], iRc * -1 ); x.WriteLogMessage( sMsg ); #endif - return rc; + return iRc; } |