From d3ad26d5af65c19c69667d60d020f473f340f7c8 Mon Sep 17 00:00:00 2001 From: prabatuty Date: Sat, 7 May 2011 17:55:52 +0000 Subject: [PATCH] test cases for trie index --- test/dbapi/Index/Makefile | 47 +++++++++++++++++++++++++++++++++- test/dbapi/Index/common.h | 8 +++++- test/dbapi/Index/compositekeyindex1.c | 5 ++++ test/dbapi/Index/createindexnofld.c | 2 ++ test/dbapi/Index/createindexnotexist.c | 2 ++ test/dbapi/Index/twoindex1.c | 6 +++++ test/dbapi/Index/twoindex2.c | 6 +++++ 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/test/dbapi/Index/Makefile b/test/dbapi/Index/Makefile index 16234734..7f9f3b32 100644 --- a/test/dbapi/Index/Makefile +++ b/test/dbapi/Index/Makefile @@ -38,7 +38,14 @@ TARGETS = \ test012 test012a test013 \ test001a test002a test003a \ test004a test004b test004c \ - test005a test005b test005c + test004d test004e test004f \ + test004g test004h \ + test005a test005b test005c \ + test005d test005e test005f \ + test005g test005h \ + test001b test002b test003b \ + test006b test007b test008b \ + test009b test010b test012b ifeq ($(PlatForm), supported) @@ -53,14 +60,20 @@ test001: uniqueindex1.c common.h $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test001a: uniqueindex1.c common.h $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test001b: uniqueindex1.c common.h + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test002: uniqueindex2.c common.h $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test002a: uniqueindex2.c common.h $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002b: uniqueindex2.c common.h + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test003: uniqueindex3.c common.h $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test003a: uniqueindex3.c common.h $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003b: uniqueindex3.c common.h + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test004: twoindex1.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test004a: twoindex1.c @@ -69,6 +82,16 @@ test004b: twoindex1.c $(CPlus) $(CPlusFlags) -DF2TREE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test004c: twoindex1.c $(CPlus) $(CPlusFlags) -DF1TREE -DF2TREE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004d: twoindex1.c + $(CPlus) $(CPlusFlags) -DF1TRIE -DF2TREE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004e: twoindex1.c + $(CPlus) $(CPlusFlags) -DF1TREE -DF2TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004f: twoindex1.c + $(CPlus) $(CPlusFlags) -DF1TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004g: twoindex1.c + $(CPlus) $(CPlusFlags) -DF2TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004h: twoindex1.c + $(CPlus) $(CPlusFlags) -DF1TRIE -DF2TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test005: twoindex2.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test005a: twoindex2.c @@ -77,32 +100,54 @@ test005b: twoindex2.c $(CPlus) $(CPlusFlags) -DF2TREE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test005c: twoindex2.c $(CPlus) $(CPlusFlags) -DF1TREE -DF2TREE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005d: twoindex2.c + $(CPlus) $(CPlusFlags) -DF1TRIE -DF2TREE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005e: twoindex2.c + $(CPlus) $(CPlusFlags) -DF1TREE -DF2TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005f: twoindex2.c + $(CPlus) $(CPlusFlags) -DF1TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005g: twoindex2.c + $(CPlus) $(CPlusFlags) -DF2TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005h: twoindex2.c + $(CPlus) $(CPlusFlags) -DF1TRIE -DF2TRIE -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test006: dupindex1.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test006a: dupindex1.c $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006b: dupindex1.c + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test007: dupindex2.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test007a: dupindex2.c $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007b: dupindex2.c + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test008: compositekeyindex1.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test008a: compositekeyindex1.c $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test008b: compositekeyindex1.c + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test009: createindexnotexist.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test009a: createindexnotexist.c $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test009b: createindexnotexist.c + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test010: createindexnofld.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test010a: createindexnofld.c $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test010b: createindexnofld.c + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test011: primarynonunique.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test012: index1.c common.h $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test012a: index1.c common.h $(CPlus) $(CPlusFlags) -DTREEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test012b: index1.c common.h + $(CPlus) $(CPlusFlags) -DTRIEINDEX -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) test013:multiplecompositeindex1.c $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) clean: diff --git a/test/dbapi/Index/common.h b/test/dbapi/Index/common.h index 3e203682..d8b67882 100644 --- a/test/dbapi/Index/common.h +++ b/test/dbapi/Index/common.h @@ -7,7 +7,9 @@ int createIndex(DatabaseManager *dbMgr, bool unique) idxInfo->list.append("f1"); #ifdef TREEINDEX idxInfo->indType = treeIndex; -#else +#elif TRIEINDEX + idxInfo->indType = trieIndex; +#else idxInfo->indType = hashIndex; #endif #ifndef DEFAULT @@ -106,6 +108,8 @@ int createIndex(DatabaseManager *dbMgr) idxInfo->list.append("f1"); #ifdef TREEINDEX idxInfo->indType = treeIndex; +#elif TRIEINDEX + idxInfo->indType = trieIndex; #else idxInfo->indType = hashIndex; #endif @@ -120,6 +124,8 @@ int createIndex(DatabaseManager *dbMgr) idxInfo->list.append("f2"); #ifdef TREEINDEX idxInfo->indType = treeIndex; +#elif TRIEINDEX + idxInfo->indType = trieIndex; #else idxInfo->indType = hashIndex; #endif diff --git a/test/dbapi/Index/compositekeyindex1.c b/test/dbapi/Index/compositekeyindex1.c index fbf8e10e..11ef39ee 100644 --- a/test/dbapi/Index/compositekeyindex1.c +++ b/test/dbapi/Index/compositekeyindex1.c @@ -26,11 +26,16 @@ int main() idxInfo->indType = hashIndex; #ifdef TREEINDEX idxInfo->indType = treeIndex; +#elif TRIEINDEX + idxInfo->indType = treeIndex; #endif rv = dbMgr->createIndex("indx1", idxInfo); #ifdef TREEINDEX if(rv == OK) { printf("Composite Index creation Passed\n"); return 1; } printf("Composite Index failed as expected\n"); +#elif TRIEINDEX + if(rv == OK) { printf("Composite Index creation Passed\n"); return 1; } + printf("Composite Index failed as expected\n"); #else if(rv != OK) { printf("Composite Index creation Failed\n"); return 1; } printf("Composite Index created\n"); diff --git a/test/dbapi/Index/createindexnofld.c b/test/dbapi/Index/createindexnofld.c index 321ec811..df3031b4 100644 --- a/test/dbapi/Index/createindexnofld.c +++ b/test/dbapi/Index/createindexnofld.c @@ -24,6 +24,8 @@ int main() idxInfo->indType = hashIndex; #ifdef TREEINDEX idxInfo->indType = treeIndex; +#elif TRIEINDEX + idxInfo->indType = trieIndex; #endif int ret =0; rv = dbMgr->createIndex("indx1", idxInfo); diff --git a/test/dbapi/Index/createindexnotexist.c b/test/dbapi/Index/createindexnotexist.c index 309eadc0..0850402c 100644 --- a/test/dbapi/Index/createindexnotexist.c +++ b/test/dbapi/Index/createindexnotexist.c @@ -25,6 +25,8 @@ int main() idxInfo->indType = hashIndex; #ifdef TREEINDEX idxInfo->indType = treeIndex; +#elif defined TRIEINDEX + idxInfo->indType = trieIndex; #endif int ret =0; rv = dbMgr->createIndex("indx1", idxInfo); diff --git a/test/dbapi/Index/twoindex1.c b/test/dbapi/Index/twoindex1.c index a71e0f8c..188abe55 100644 --- a/test/dbapi/Index/twoindex1.c +++ b/test/dbapi/Index/twoindex1.c @@ -26,6 +26,9 @@ int main() #ifdef F1TREE idxInfo->indType = treeIndex; #endif +#ifdef F1TRIE + idxInfo->indType = trieIndex; +#endif rv = dbMgr->createIndex("indx1", idxInfo); if (rv != OK) { printf("Index creation failed\n"); return -1; } printf("Index created for f1\n"); @@ -38,6 +41,9 @@ int main() #ifdef F2TREE idxInfo->indType = treeIndex; #endif +#ifdef F2TRIE + idxInfo->indType = trieIndex; +#endif rv = dbMgr->createIndex("indx2", idxInfo); if (rv != OK) { printf("Index creation failed\n"); return -1; } printf("Index created for f2\n"); diff --git a/test/dbapi/Index/twoindex2.c b/test/dbapi/Index/twoindex2.c index a4c5fa47..f0a0d7a6 100644 --- a/test/dbapi/Index/twoindex2.c +++ b/test/dbapi/Index/twoindex2.c @@ -24,6 +24,9 @@ int main() #ifdef F1TREE idxInfo->indType = treeIndex; #endif +#ifdef F2TRIE + idxInfo->indType = trieIndex; +#endif rv = dbMgr->createIndex("indx1", idxInfo); if (rv != OK) { printf("Index creation failed\n"); return -1; } printf("Index created for f1\n"); @@ -36,6 +39,9 @@ int main() #ifdef F2TREE idxInfo->indType = treeIndex; #endif +#ifdef F2TRIE + idxInfo->indType = trieIndex; +#endif rv = dbMgr->createIndex("indx2", idxInfo); if (rv != OK) { printf("Index creation failed\n"); return -1; } printf("Index created for f2\n"); -- 2.11.4.GIT