[Kst] extragear/graphics/kst/tests
Adam Treat
treat at kde.org
Fri Oct 13 18:28:14 CEST 2006
SVN commit 595233 by treat:
More tests and make them more verbose so we
can see what is going on.
M +65 -34 testrvector.cpp
--- trunk/extragear/graphics/kst/tests/testrvector.cpp #595232:595233
@@ -30,6 +30,7 @@
#define doTest(x) testAssert(x, QString("Line %1").arg(__LINE__))
#define doTestD(x, y) testAssert(x, QString("%1: %2").arg(__LINE__).arg(y))
+#define doTestV(name, expect, actual) testAssert((expect == actual), QString("Line:%1 %2-->Expect:%3 | Actual:%4").arg(__LINE__).arg(name).arg(expect).arg(actual))
void testAssert(bool result, const QString& text = "Unknown") {
if (!result) {
@@ -300,72 +301,102 @@
{
//Skip FIVE frames...
- KstRVectorPtr rvp = new KstRVector(dsp, "1", "RVTestDirfile", 0, -1, 5, true, false);
+ KstRVectorPtr rvp = new KstRVector(dsp, "INDEX", "RVTestDirfile", 0, -1, 5, true, false);
rvp->update(0);
//We should have length equal to three... items {0, 5, 10}
//NOTE: The last item, index #14, does not fit in the skip boundary...
- doTest(rvp->length() == 3);
+ doTestV("length", 3, rvp->length());
+ doTestV("item #0", 0, rvp->value(0));
+ doTestV("item #1", 5, rvp->value(1));
+ doTestV("item #2", 10, rvp->value(2));
//The numFrames should report 11 as it lies on the skip boundary
- doTest(rvp->numFrames() == 11);
- //The numFrames should report 0 as it lies on the skip boundary
- doTest(rvp->startFrame() == 0);
+ doTestV("numFrames", 11, rvp->numFrames());
+ //The startFrame should report 0 as it lies on the skip boundary
+ doTestV("startFrame", 0, rvp->startFrame());
- doTest(rvp->reqNumFrames() == -1);
- doTest(rvp->reqStartFrame() == 0);
+ doTestV("reqNumFrames", -1, rvp->reqNumFrames());
+ doTestV("reqStartFrame", 0, rvp->reqStartFrame());
- doTest(rvp->readToEOF() == true);
- doTest(rvp->countFromEOF() == false);
- doTest(rvp->doSkip() == true);
- doTest(rvp->skip() == 5);
+ doTestV("readToEOF", true, rvp->readToEOF());
+ doTestV("countFromEOF", false, rvp->countFromEOF());
+ doTestV("doSkip", true, rvp->doSkip());
+ doTestV("skip", 5, rvp->skip());
}
{
//Skip FIVE frames...
- KstRVectorPtr rvp = new KstRVector(dsp, "1", "RVTestDirfile", 3, -1, 5, true, false);
+ KstRVectorPtr rvp = new KstRVector(dsp, "INDEX", "RVTestDirfile", 3, -1, 5, true, false);
rvp->update(0);
//We should have length equal to three... items {3, 8, 13}
- doTest(rvp->length() == 3);
+ doTestV("length", 3, rvp->length());
+ doTestV("item #0", 3, rvp->value(0));
+ doTestV("item #1", 8, rvp->value(1));
+ doTestV("item #2", 13, rvp->value(2));
//The numFrames should still report 11 as it lies on the skip boundary
- doTest(rvp->numFrames() == 11);
- //The numFrames should report 3 as it lies on the skip boundary and was requested
- doTest(rvp->startFrame() == 3);
+ doTestV("numFrames", 11, rvp->numFrames());
+ //The startFrame should report 3 as it lies on the skip boundary and was requested
+ doTestV("startFrame", 3, rvp->startFrame());
- doTest(rvp->reqNumFrames() == -1);
- doTest(rvp->reqStartFrame() == 3);
+ doTestV("reqNumFrames", -1, rvp->reqNumFrames());
+ doTestV("reqStartFrame", 3, rvp->reqStartFrame());
- doTest(rvp->readToEOF() == true);
- doTest(rvp->countFromEOF() == false);
- doTest(rvp->doSkip() == true);
- doTest(rvp->skip() == 5);
+ doTestV("readToEOF", true, rvp->readToEOF());
+ doTestV("countFromEOF", false, rvp->countFromEOF());
+ doTestV("doSkip", true, rvp->doSkip());
+ doTestV("skip", 5, rvp->skip());
}
{
//Skip FIVE frames...
- KstRVectorPtr rvp = new KstRVector(dsp, "1", "RVTestDirfile", 0, 11, 5, true, false);
+ KstRVectorPtr rvp = new KstRVector(dsp, "INDEX", "RVTestDirfile", 0, 11, 5, true, false);
rvp->update(0);
//We should have length equal to three... items {0, 5, 10}
- doTest(rvp->length() == 3);
+ doTestV("length", 3, rvp->length());
+ doTestV("item #0", 0, rvp->value(0));
+ doTestV("item #1", 5, rvp->value(1));
+ doTestV("item #2", 10, rvp->value(2));
//The numFrames should still report 11 as it lies on the skip boundary
- doTest(rvp->numFrames() == 11);
- //The numFrames should still report 0 as it lies on the skip boundary
- doTest(rvp->startFrame() == 0);
+ doTestV("numFrames", 11, rvp->numFrames());
+ //The startFrame should still report 0 as it lies on the skip boundary
+ doTestV("startFrame", 0, rvp->startFrame());
- doTest(rvp->reqNumFrames() == 11);
- doTest(rvp->reqStartFrame() == 0);
+ doTestV("reqNumFrames", 11, rvp->reqNumFrames());
+ doTestV("reqStartFrame", 0, rvp->reqStartFrame());
- doTest(rvp->readToEOF() == false);
- doTest(rvp->countFromEOF() == false);
- doTest(rvp->doSkip() == true);
- doTest(rvp->skip() == 5);
+ doTestV("readToEOF", false, rvp->readToEOF());
+ doTestV("countFromEOF", false, rvp->countFromEOF());
+ doTestV("doSkip", true, rvp->doSkip());
+ doTestV("skip", 5, rvp->skip());
}
+ {
+ //Skip FIVE frames and countFromEOF()...
+ KstRVectorPtr rvp = new KstRVector(dsp, "INDEX", "RVTestDirfile", -1, 15, 5, true, false);
+ rvp->update(0);
- //TODO countFromEOF tests
+ //We should have length equal to three... items {14, 9, 4}
+ doTestV("length", 3, rvp->length());
+ doTestV("item #0", 14, rvp->value(0));
+ doTestV("item #1", 9, rvp->value(1));
+ doTestV("item #2", 4, rvp->value(2));
+ //The numFrames should still report 11 as it lies on the skip boundary
+ doTestV("numFrames", 11, rvp->numFrames());
+ //The startFrame should still report 0 as it lies on the skip boundary
+ doTestV("startFrame", 0, rvp->startFrame());
+
+ doTestV("reqNumFrames", 15, rvp->reqNumFrames());
+ doTestV("reqStartFrame", -1, rvp->reqStartFrame());
+
+ doTestV("readToEOF", false, rvp->readToEOF());
+ doTestV("countFromEOF", true, rvp->countFromEOF());
+ doTestV("doSkip", true, rvp->doSkip());
+ doTestV("skip", 5, rvp->skip());
}
+ }
}
More information about the Kst
mailing list