[Kst] Re: histogram unit test

Peter Kümmel syntheticpp at gmx.net
Sun Jan 16 16:20:34 CET 2011


In the meantime I've accidentally committed the patch.
Before reverting I wanna ask again if the original test
didn't disclosed a bug.

Peter


On 12.01.2011 20:50, Peter Kuemmel wrote:
> To fix the unit test for Histogram I need to call internalUpdate on GenerateVector once more:
> before the update changeRange is called, the new length is active (10) but the values not (max==0), the values only have after the internalUpdate the new values (max==10), see the adition QCOMPAREs.
> Is this the correct behaviour or a bug?
>
> Peter
>
> Index: tests/testhistogram.cpp
> ===================================================================
> --- tests/testhistogram.cpp	(Revision 1214031)
> +++ tests/testhistogram.cpp	(Arbeitskopie)
> @@ -30,8 +30,18 @@
>   void TestHistogram::testHistogram() {
>     Kst::GeneratedVectorPtr gvp = Kst::kst_cast<Kst::GeneratedVector>(_store.createObject<Kst::GeneratedVector>());
>     Q_ASSERT(gvp);
> +  QCOMPARE(gvp->length(), 1);
> +
>     gvp->changeRange(0, 10, 100);
> +  QCOMPARE(gvp->max(), 0.0);
> +  QCOMPARE(gvp->length(), 100);
> +
> +  gvp->internalUpdate();
> +  QCOMPARE(gvp->max(), 10.0);
> +  QCOMPARE(gvp->length(), 100);
> +
>     Kst::VectorPtr vp(gvp);
> +  QCOMPARE(vp->max(), 10.0);
>
>     Kst::HistogramPtr h1 = Kst::kst_cast<Kst::Histogram>(_store.createObject<Kst::Histogram>());
>     h1->change(vp, 0, 10, 10, Kst::Histogram::Number);


More information about the Kst mailing list