File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ void QgsStatisticalSummary::reset()
36
36
mMean = 0 ;
37
37
mMedian = 0 ;
38
38
mMin = std::numeric_limits<double >::max ();
39
- mMax = std::numeric_limits<double >::min ();
39
+ mMax = - std::numeric_limits<double >::max ();
40
40
mStdev = 0 ;
41
41
mSampleStdev = 0 ;
42
42
mMinority = 0 ;
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class TestQgsStatisticSummary: public QObject
32
32
void init ();// will be called before each testfunction is executed.
33
33
void cleanup ();// will be called after every testfunction.
34
34
void stats ();
35
+ void maxMin ();
35
36
36
37
private:
37
38
@@ -119,5 +120,18 @@ void TestQgsStatisticSummary::stats()
119
120
QCOMPARE ( s.interQuartileRange (), 11.0 );
120
121
}
121
122
123
+ void TestQgsStatisticSummary::maxMin ()
124
+ {
125
+ QgsStatisticalSummary s ( QgsStatisticalSummary::All );
126
+
127
+ // test max/min of negative value list
128
+ QList<double > negativeVals;
129
+ negativeVals << -5.0 << -10.0 << -15.0 ;
130
+ s.calculate ( negativeVals );
131
+
132
+ QCOMPARE ( s.min (), -15.0 );
133
+ QCOMPARE ( s.max (), -5.0 );
134
+ }
135
+
122
136
QTEST_MAIN ( TestQgsStatisticSummary )
123
137
#include " testqgsstatisticalsummary.moc"
You can’t perform that action at this time.
0 commit comments