[Kst] kdeextragear-2/kst/tests
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Dec 9 21:11:36 CET 2004
CVS commit by netterfield:
-Fix some errors in the histogram tests
-don't use depricated (and now removed) histogram->point() method
There are two tests which fail, as I expect them to. I don't know why
they should pass. I have indicated this with comments. George?
M +13 -17 testhistogram.cpp 1.6
--- kdeextragear-2/kst/tests/testhistogram.cpp #1.5:1.6
@@ -6,4 +6,5 @@
#include "ksttestcase.h"
#include <ksthistogram.h>
+#include <kstvector.h>
static void exitHelper() {
@@ -30,7 +31,5 @@ void testAssert(bool result, const QStri
#define dumpPoints(histogram, n) do { \
for (int i = 0; i < n*4; ++i) { \
- double x, y; \
- histogram->point(i, x, y); \
- printf("%.15f, %.15f\n", x, y); \
+ printf("%.15f, %.15f\n", histogram->vX()->value(i), histogram->vY()->value(i)); \
} } while(0)
@@ -47,8 +46,6 @@ void doTests() {
doTest(h1->vNumSamples() == 100);
int count = 0;
- for (int i = 1; i < 10*3+1; i += 3) {
- double x, y;
- h1->point(i, x, y);
- count += int(y);
+ for (int i=0; i<10; i++) {
+ count += int(h1->vY()->value(i));
}
h1->setRealTimeAutoBin(true);
@@ -62,8 +59,7 @@ void doTests() {
doTest(h1->vMax() == 10.0);
doTest(h1->vNumSamples() == 100);
- for (int i = 1; i < 11*3+1; i += 3) {
- double x, y;
- h1->point(i, x, y);
- count += int(y);
+ count = 0;
+ for (int i=0; i<11; i++) {
+ count += int(h1->vY()->value(i));
}
//dumpPoints(h1, 11);
@@ -74,8 +70,7 @@ void doTests() {
doTest(h1->vMax() == 10.0);
doTest(h1->vNumSamples() == 100);
- for (int i = 1; i < 9*3+1; i += 3) {
- double x, y;
- h1->point(i, x, y);
- count += int(y);
+ count = 0;
+ for (int i=0; i<9; i++) {
+ count += int(h1->vY()->value(i));
}
//dumpPoints(h1, 9);
@@ -104,4 +98,5 @@ void doTests() {
doTest(h1->type() == KST_HISTOGRAM);
doTest(h1->nBins() == 2);
+ // the following test fails: why should it pass?
doTest(h1->xMax() - h1->xMin() >= 2.0);
doTest(h1->vMin() == 0.0);
@@ -112,7 +107,8 @@ void doTests() {
doTest(h1->xMax() == 11.0);
h1->setXRange(9, 10.999999999);
+ // the following test fails: why should it pass?
doTest(h1->xMax() - h1->xMin() >= 2.0);
h1->setXRange(8, 10);
- doTest(h1->xMin() == 9.0);
+ doTest(h1->xMin() == 8.0);
doTest(h1->xMax() == 10.0);
}
More information about the Kst
mailing list