summaryrefslogtreecommitdiff
path: root/src/tests/xb_test_mdx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/xb_test_mdx.cpp')
-rwxr-xr-xsrc/tests/xb_test_mdx.cpp70
1 files changed, 56 insertions, 14 deletions
diff --git a/src/tests/xb_test_mdx.cpp b/src/tests/xb_test_mdx.cpp
index af191ad..2ef5ffb 100755
--- a/src/tests/xb_test_mdx.cpp
+++ b/src/tests/xb_test_mdx.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.
@@ -55,20 +55,28 @@ int main( int argCnt, char **av )
};
+ xbSchema MyV4Record2[] =
+ {
+ { "CHAR1", XB_CHAR_FLD, 1, 0 },
+ { "CHAR27", XB_CHAR_FLD, 27, 0 },
+ { "",0,0,0 }
+ };
+
+
xbXBase x;
-#ifdef XB_LOGGING_SUPPORT
+ #ifdef XB_LOGGING_SUPPORT
+ x.SetLogDirectory( PROJECT_LOG_DIR );
x.EnableMsgLogging();
if( iPo ){
std::cout << "Logfile is [" << x.GetLogFqFileName().Str() << "]" << std::endl;
}
sMsg.Sprintf( "Program [%s] initializing...", av[0] );
x.WriteLogMessage( sMsg );
-#endif
+ #endif
x.SetDataDirectory( PROJECT_DATA_DIR );
- x.EnableMsgLogging();
- x.SetMultiUser( false );
+ x.SetMultiUser( xbFalse );
InitTime();
if( iPo > 0 )
@@ -92,6 +100,7 @@ int main( int argCnt, char **av )
xbInt16 iDescending, xbInt16 iUnique, xbInt16 iOverLay, xbIx **xbIxOut, void **vpTagOut );
*/
+
iRc2 = V4DbfX1->CreateTag( "MDX", "CITY_TAGA", "CITY", "", 0, 0, XB_OVERLAY, &pIx, &pTag );
iRc += TestMethod( iPo, "CreateTag(1)", iRc2, 0 );
@@ -109,8 +118,6 @@ int main( int argCnt, char **av )
// std::cout << iRc2 << "\n";
-// something in th following block of code causing issues
-
xbInt32 uZip = 10000;
for( xbUInt16 i = 0; i < 35; i++ ){
for( xbUInt16 j = 0; j < 14; j++ ){
@@ -147,7 +154,7 @@ int main( int argCnt, char **av )
}
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+ iRc += TestMethod( iPo, "CheckTagIntegrity(1)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
// attempt to add a dup key, should fail with XB_KEY_NOT_UNIQUE
iRc2 = V4DbfX1->BlankRecord();
@@ -177,7 +184,7 @@ int main( int argCnt, char **av )
iRc += TestMethod( iPo, "Abort()", iRc2, XB_NO_ERROR );
iRc += TestMethod( iPo, "DeleteTag()", V4DbfX1->DeleteTag( "MDX", "CITY_TAGA" ), XB_NO_ERROR );
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+ iRc += TestMethod( iPo, "CheckTagIntegrity(2)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
iRc2 = V4DbfX1->CreateTag( "MDX", "CITY_TAGF", "CITY", ".NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag );
iRc += TestMethod( iPo, "CreateTag(4)", iRc2, 0 );
@@ -186,27 +193,29 @@ int main( int argCnt, char **av )
iRc += TestMethod( iPo, "SetCurTag()", iRc2, XB_NO_ERROR );
iRc += TestMethod( iPo, "GetCurTagName()", V4DbfX1->GetCurTagName().Str(), "CITY_TAGF", 9 );
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_INVALID_INDEX );
+ // next check throws an error message on the display, that is what it is testing, don't need to debug it
+ iRc += TestMethod( iPo, "CheckTagIntegrity(3)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_INVALID_INDEX );
+
iRc2 = V4DbfX1->Reindex( 0 );
iRc += TestMethod( iPo, "Reindex( 0 )", iRc2, XB_NO_ERROR );
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+ iRc += TestMethod( iPo, "CheckTagIntegrity(4)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
iRc += TestMethod( iPo, "GetCurTagName()", V4DbfX1->GetCurTagName().Str(), "CITY_TAGF", 9 );
iRc2 = V4DbfX1->Reindex( 1 );
iRc += TestMethod( iPo, "Reindex( 1 )", iRc2, XB_NO_ERROR );
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+ iRc += TestMethod( iPo, "CheckTagIntegrity(5)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
// delete everything, all keys should be removed from the filtered index
iRc += TestMethod( iPo, "DeleteAll(0)", V4DbfX1->DeleteAll( 0 ), XB_NO_ERROR );
iRc += TestMethod( iPo, "Commit()", V4DbfX1->Commit(), XB_NO_ERROR );
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+ iRc += TestMethod( iPo, "CheckTagIntegrity(6)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
// undelete everything, all keys should be added back into the filtered index
iRc += TestMethod( iPo, "DeleteAll(1)", V4DbfX1->DeleteAll( 1 ), XB_NO_ERROR );
iRc += TestMethod( iPo, "Commit()", V4DbfX1->Commit(), XB_NO_ERROR );
- iRc += TestMethod( iPo, "CheckTagIntegrity()", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+ iRc += TestMethod( iPo, "CheckTagIntegrity(7)", V4DbfX1->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
// std::cout << "Cur Tag Name = " << V4DbfX1->GetCurTagName().Str() << "\n";
sKey = "abc";
@@ -239,8 +248,41 @@ int main( int argCnt, char **av )
iRc += TestMethod( iPo, "Rename()", V4DbfX1->Rename( "TestMdxR.DBF" ), XB_NO_ERROR );
+ xbDbf *V4DbfX2 = new xbDbf4( &x );
+ iRc2 = V4DbfX2->CreateTable( "TMDXDB02.DBF", "TestMdxX4", MyV4Record2, XB_OVERLAY, XB_MULTI_USER );
+ iRc += TestMethod( iPo, "CreateTable(2)", iRc2, 0 );
+
+
+ iRc2 = V4DbfX2->CreateTag( "MDX", "TAG1", "CHAR27", ".NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag );
+// iRc2 = V4DbfX2->CreateTag( "MDX", "TAG2", "CHAR1", "CHAR1 = 'O' .AND. .NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag );
+ iRc += TestMethod( iPo, "CreateTag(4)", iRc2, 0 );
+
+
+
+ for( xbUInt32 ul = 0; ul < 500 && iRc2 == XB_NO_ERROR; ul++ ){
+ c = 'O';
+ V4DbfX2->BlankRecord();
+ iRc2 = V4DbfX2->PutField( 1, c );
+ if( iRc2 != XB_NO_ERROR ){
+ iRc += TestMethod( iPo, "PutField()", iRc2, XB_NO_ERROR );
+ } else {
+ iRc2 = V4DbfX2->AppendRecord();
+ if( iRc2 != XB_NO_ERROR ){
+ iRc += TestMethod( iPo, "AppendRecord()", iRc2, XB_NO_ERROR );
+ } else {
+ iRc2 = V4DbfX2->Commit();
+ if( iRc2 != XB_NO_ERROR ){
+ iRc += TestMethod( iPo, "Commit()", iRc2, XB_NO_ERROR );
+ }
+ }
+ }
+ }
+
+ iRc += TestMethod( iPo, "CheckTagIntegrity(7)", V4DbfX2->CheckTagIntegrity( 1, 2 ), XB_NO_ERROR );
+
x.CloseAllTables();
delete V4DbfX1;
+ delete V4DbfX2;
if( iPo > 0 || iRc < 0 )
fprintf( stdout, "Total Errors = %d\n", iRc * -1 );