summaryrefslogtreecommitdiff
path: root/src/tests/xb_test_ndx2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/xb_test_ndx2.cpp')
-rwxr-xr-xsrc/tests/xb_test_ndx2.cpp145
1 files changed, 0 insertions, 145 deletions
diff --git a/src/tests/xb_test_ndx2.cpp b/src/tests/xb_test_ndx2.cpp
deleted file mode 100755
index f406b05..0000000
--- a/src/tests/xb_test_ndx2.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/* xb_test_ndx2.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:
-
- xb64-devel@lists.sourceforge.net
- xb64-users@lists.sourceforge.net
-
-*/
-
-// This program tests the class xbIxNdx
-
-// usage: xb_test_ndx QUITE|NORMAL|VERBOSE
-
-
-
-// fix me - this program needs to test GetUnique
-
-#include "xbase.h"
-
-using namespace xb;
-
-#include "tstfuncs.cpp"
-
-
-int main( int argCnt, char **av )
-{
- int iRc = 0;
- int iRc2 = 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;
- }
-
-
- xbSchema MyV3Record[] =
- {
- { "CFLD", XB_CHAR_FLD, 30, 0 },
- { "DFLD", XB_DATE_FLD, 8, 0 },
- { "NFLD", XB_NUMERIC_FLD, 12, 0 },
- { "",0,0,0 }
- };
-
-
- 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 );
- x.SetLogSize( 1000000 );
-#endif
-
- x.SetDataDirectory( PROJECT_DATA_DIR );
- x.EnableMsgLogging();
-// x.DisableDefaultAutoLock();
-
- x.SetUniqueKeyOpt( XB_EMULATE_DBASE );
- InitTime();
- xbString s;
- iRc = 0;
-
- if( po > 0 )
- std::cout << "Default Data Directory is [" << x.GetDataDirectory().Str() << "]" << std::endl;
-
- xbDbf *V3Dbf = new xbDbf3( &x );
- xbIx *ixPtr;
- void *ndx;
-
- iRc2 = V3Dbf->CreateTable( "TestNdx.DBF", "TestNdx", MyV3Record, XB_OVERLAY, XB_MULTI_USER );
- iRc += TestMethod( po, "CreateTable()", (xbInt32) iRc2, XB_NO_ERROR );
-
- if( iRc2 )
- x.DisplayError( iRc2 );
-
- iRc2 = V3Dbf->CreateTag( "NDX", "TestNdxC.NDX", "CFLD", "", 0, xbTrue, XB_OVERLAY, &ixPtr, &ndx );
- iRc += TestMethod( po, "CreateTag()", (xbInt32) iRc2, XB_NO_ERROR );
- if( iRc2 )
- x.DisplayError( iRc2 );
-
- iRc2 = V3Dbf->AssociateIndex( "NDX", "TestNdxC.NDX", 0 );
- iRc += TestMethod( po, "Associate()", (xbInt32) iRc2, XB_NO_ERROR );
-
-
- iRc += TestMethod( po, "BlankRecord()", V3Dbf->BlankRecord(), XB_NO_ERROR );
- iRc += TestMethod( po, "Putfield()", V3Dbf->PutField( "CFLD", "AAA" ), XB_NO_ERROR );
- iRc += TestMethod( po, "Putfield()", V3Dbf->PutField( "DFLD", "19611109" ), XB_NO_ERROR );
- iRc += TestMethod( po, "PutfieldDouble()", V3Dbf->PutDoubleField( "NFLD", 50 ), XB_NO_ERROR );
- iRc += TestMethod( po, "AppendRecord()", V3Dbf->AppendRecord(), XB_NO_ERROR );
-
-
- iRc += TestMethod( po, "BlankRecord()", V3Dbf->BlankRecord(), XB_NO_ERROR );
- iRc += TestMethod( po, "Putfield()", V3Dbf->PutField( "CFLD", "BBB" ), XB_NO_ERROR );
- iRc += TestMethod( po, "Putfield()", V3Dbf->PutField( "DFLD", "19611109" ), XB_NO_ERROR );
- iRc += TestMethod( po, "PutfieldDouble()", V3Dbf->PutDoubleField( "NFLD", 50 ), XB_NO_ERROR );
- iRc += TestMethod( po, "AppendRecord()", V3Dbf->AppendRecord(), XB_NO_ERROR );
-
- iRc += TestMethod( po, "BlankRecord()", V3Dbf->BlankRecord(), XB_NO_ERROR );
- iRc += TestMethod( po, "Putfield()", V3Dbf->PutField( "CFLD", "BBB" ), XB_NO_ERROR );
- iRc += TestMethod( po, "Putfield()", V3Dbf->PutField( "DFLD", "19611109" ), XB_NO_ERROR );
- iRc += TestMethod( po, "PutfieldDouble()", V3Dbf->PutDoubleField( "NFLD", 50 ), XB_NO_ERROR );
- iRc += TestMethod( po, "AppendRecord()", V3Dbf->AppendRecord(), XB_NO_ERROR );
-
-
- xbIxList *ixl = V3Dbf->GetIxList();
- xbIxNdx *ix;
- xbString sTagName;
- while( ixl ){
- if( *ixl->sFmt == "NDX" ){
- ix = (xbIxNdx *) ixl->ix;
- //ix->GetTagName( 0, sTagName );
- sMsg.Sprintf( "CheckTagIntegrity() - [%s]", ix->GetTagName(ix->GetCurTag()).Str());
- iRc += TestMethod( po, sMsg, ix->CheckTagIntegrity( ix->GetCurTag(), 2 ), XB_NO_ERROR );
- ixl = ixl->next;
- }
- }
-
- iRc += TestMethod( po, "Close()", V3Dbf->Close(), XB_NO_ERROR );
- delete V3Dbf;
-
- 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, 2 );
-#endif
-
- return iRc;
-}