[Kst] kdeextragear-2/kst/tests
George Staikos
staikos at kde.org
Thu Nov 25 07:12:26 CET 2004
CVS commit by staikos:
- add utility to run the regression suite and report results
- change the tests and template so that they return the number of failures
A runregression.sh 1.1
M +2 -1 ksttestcase.h 1.3
M +5 -4 testeqparser.cpp 1.20
M +2 -2 testhistogram.cpp 1.3
M +2 -2 testtemplate.cpp 1.4
--- kdeextragear-2/kst/tests/ksttestcase.h #1.2:1.3
@@ -26,4 +26,5 @@ double INF = 1.0/0.0;
#define KstTestSuccess 0
#define KstTestFailure -1
+#define KstTestFailed() rc--
#endif
--- kdeextragear-2/kst/tests/testeqparser.cpp #1.19:1.20
@@ -41,4 +41,5 @@ bool doTest(const char *equation, double
if (!optimizerFailed) {
optimizerFailed = true;
+ ::rc--;
printf("Optimizer bug: found an unoptimized const equation. Optimizing for coverage purposes.\n");
}
@@ -73,5 +74,5 @@ bool doTest(const char *equation, double
void test(const char *equation, double x, double result, const double tol = 0.00000000001) {
if (!doTest(equation, x, result, tol)) {
- rc = KstTestFailure;
+ rc--;
printf("Test of (%s)[%.16f] == %.16f failed.\n", equation, x, result);
}
@@ -83,9 +84,9 @@ void testParseFail(const char *equation)
if (0 == yyparse()) {
printf("Test of (%s) parsing passed, but should have failed.\n", equation);
- rc = KstTestFailure;
+ rc--;
} else {
if (Equation::errorStack.count() == 1 && Equation::errorStack.first() == "parse error") {
printf("ERROR: [%s] doesn't have error handling yet!\n", equation);
- rc = KstTestFailure;
+ rc--;
#ifdef DUMP_FAIL_MSGS
} else {
@@ -437,5 +438,5 @@ int main(int argc, char **argv) {
printf("All tests passed!\n");
}
- return rc;
+ return -rc;
}
--- kdeextragear-2/kst/tests/testhistogram.cpp #1.2:1.3
@@ -22,5 +22,5 @@ int rc = KstTestSuccess;
void testAssert(bool result, const QString& text = "Unknown") {
if (!result) {
- rc = KstTestFailure;
+ KstTestFailed();
printf("Test [%s] failed.\n", text.latin1());
}
@@ -82,5 +82,5 @@ int main(int argc, char **argv) {
printf("All tests passed!\n");
}
- return rc;
+ return -rc;
}
--- kdeextragear-2/kst/tests/testtemplate.cpp #1.3:1.4
@@ -20,5 +20,5 @@ int rc = KstTestSuccess;
void testAssert(bool result, const QString& text = "Unknown") {
if (!result) {
- rc = KstTestFailure;
+ KstTestFailed();
printf("Test [%s] failed.\n", text.latin1());
}
@@ -43,5 +43,5 @@ int main(int argc, char **argv) {
printf("All tests passed!\n");
}
- return rc;
+ return -rc;
}
More information about the Kst
mailing list