[Kst] branches/work/kst/1.5/kst/tests
Andrew Walker
arwalker at sumusltd.com
Tue Sep 18 03:46:24 CEST 2007
SVN commit 713694 by arwalker:
update the tests for KstSMatrix
M +19 -12 testsmatrix.cpp
--- branches/work/kst/1.5/kst/tests/testsmatrix.cpp #713693:713694
@@ -99,14 +99,19 @@
//basic default constructor values
KstSMatrix* sm1 = new KstSMatrix(e);
doTest(sm1->tagName().startsWith("smDOM"));
- doTest(sm1->sampleCount() == 0); // is this right? it looks like matrices are 1x1 at minimum
+ // smatrix will always have at least one sample...
+ doTest(sm1->sampleCount() == 1);
doTest(sm1->minValue() == 0);
doTest(sm1->maxValue() == 0);
- doTest(sm1->value(0, 0, &ok) == 0);
- doTest(!ok); // why should this be not ok?
- doTest(sm1->value(10, 10, &ok) == 0); //should be outside the boundaries.
+
+ // gradzmin is 1.0 so the single matrix value is 1.0
+ doTest(sm1->value(0, 0, &ok) == 1);
+ doTest(ok);
+
+ // index 10,10 lies outside the boundaries so ok should be false...
+ doTest(sm1->value(10, 10, &ok) == 0);
doTest(!ok);
- doTest(sm1->sampleCount() == 0);
+ doTest(sm1->sampleCount() == 1);
doTest(sm1->meanValue() == 0);
//basic symetrical matrix
@@ -115,8 +120,8 @@
//basic default constructor values
KstSMatrix* sm2 = new KstSMatrix(e);
-
- doTest(sm2->tagName() == "Symetrical");
+
+ doTest(sm2->tagName() == "Symmetrical");
doTest(sm2->resize(3, 3, true));
doTest(sm2->editable());
@@ -140,14 +145,16 @@
doTest(sm2->yNumSteps() == 3);
doTest(sm2->minX() == 0);
doTest(sm2->minY() == 0);
- doTest(sm2->xStepSize() == 0);
- doTest(sm2->yStepSize() == 0);
+ // if the step size is set <= 0 then it will automatically be set to 0.1...
+ doTest(sm2->xStepSize() == 0.1);
+ doTest(sm2->yStepSize() == 0.1);
doTest(sm2->sampleCount() == 9);
- doTest(!sm2->setValue(0, 0, 1.0));
+ // smatrix will always have at least one sample...
+ doTest(sm2->setValue(0, 0, 1.0));
ok = true;
- doTest(sm2->value(0, 0, &ok) == 0.0);
- doTest(!ok);
+ doTest(sm2->value(0, 0, &ok) == 1.0);
+ doTest(ok);
doTest(!sm2->setValue(1, 1, 5.0));
doTest(sm2->value(1, 1) != 5.0);
More information about the Kst
mailing list