summaryrefslogtreecommitdiffstats
path: root/test/testframe.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2004-04-03 21:35:01 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2004-04-03 21:35:01 (GMT)
commit4c8f0b2463410eff8a0a6c4531ad051d7c33abd1 (patch)
tree07f5d45649e764a556be322e587d49a7a023cb6b /test/testframe.c
parent6705762081f1bbea41037cc44973dc20d85832fc (diff)
downloadhdf5-4c8f0b2463410eff8a0a6c4531ad051d7c33abd1.zip
hdf5-4c8f0b2463410eff8a0a6c4531ad051d7c33abd1.tar.gz
hdf5-4c8f0b2463410eff8a0a6c4531ad051d7c33abd1.tar.bz2
[svn-r8298] Purpose:
Code cleanup Description: Added SetTest() to handle test controls. Platforms tested: h5committested.
Diffstat (limited to 'test/testframe.c')
-rw-r--r--test/testframe.c62
1 files changed, 50 insertions, 12 deletions
diff --git a/test/testframe.c b/test/testframe.c
index d3391ac..3411b95 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -197,9 +197,7 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
(HDstrcmp(argv[CLLoop], "-x") == 0))) {
Loop = CLLoop + 1;
while ((Loop < argc) && (argv[Loop][0] != '-')) {
- for (Loop1 = 0; Loop1 < Index; Loop1++)
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
- Test[Loop1].SkipFlag = 1;
+ SetTest(argv[Loop], SKIPTEST);
Loop++;
} /* end while */
} /* end if */
@@ -207,12 +205,7 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
(HDstrcmp(argv[CLLoop], "-b") == 0))) {
Loop = CLLoop + 1;
while ((Loop < argc) && (argv[Loop][0] != '-')) {
- for (Loop1 = 0; Loop1 < Index; Loop1++) {
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) != 0)
- Test[Loop1].SkipFlag = 1;
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
- Loop1 = Index;
- } /* end for */
+ SetTest(argv[Loop], BEGINTEST);
Loop++;
} /* end while */
} /* end if */
@@ -223,9 +216,7 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
Loop = CLLoop + 1;
while ((Loop < argc) && (argv[Loop][0] != '-')) {
- for (Loop1 = 0; Loop1 < Index; Loop1++)
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
- Test[Loop1].SkipFlag = 0;
+ SetTest(argv[Loop], ONLYTEST);
Loop++;
} /* end while */
} /* end if */
@@ -380,3 +371,50 @@ TestErrPrintf(const char *format, ...)
return ret_value;
}
+
+/*
+ * Set (control) which test will be tested.
+ * SKIPTEST: skip this test
+ * ONLYTEST: do only this test
+ * BEGINETEST: skip all tests before this test
+ *
+ */
+void SetTest(const char *testname, int action)
+{
+ int Loop;
+
+ switch (action){
+ case SKIPTEST:
+ for (Loop = 0; Loop < Index; Loop++)
+ if (HDstrcmp(testname, Test[Loop].Name) == 0){
+ Test[Loop].SkipFlag = 1;
+ break;
+ }
+ break;
+ case BEGINTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) != 0)
+ Test[Loop].SkipFlag = 1;
+ else
+ break;
+ }
+ break;
+ case ONLYTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) != 0)
+ Test[Loop].SkipFlag = 1;
+ else {
+ Test[Loop].SkipFlag = 0;
+ break;
+ }
+ }
+ /* skip the rest */
+ while (++Loop < Index)
+ Test[Loop].SkipFlag = 1;
+ break;
+ default:
+ /* error */
+ printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
+ break;
+ }
+}