@@ -11,6 +11,7 @@ void main() {
1111 expect (calculateLinearRegressionSlope ([10.0 , 20.0 , 30.0 ]), 10.0 );
1212 expect (calculateLinearRegressionSlope ([30.0 , 20.0 , 10.0 ]), - 10.0 );
1313 expect (calculateLinearRegressionSlope ([10.0 , 10.0 , 10.0 ]), 0 );
14+ expect (calculateLinearRegressionSlope ([0.0 , 0.0 , 0.0 ]), 0 );
1415 });
1516
1617 test ('return 0.0 if denominator is very small' , () {
@@ -20,11 +21,16 @@ void main() {
2021 });
2122
2223 group ('computeRelativeGrowthRate' , () {
23- test ('returns 0.0 for stable downloads meeting threshold ' , () {
24+ test ('returns 0.0 for stable downloads' , () {
2425 final downloads = List <int >.generate (analysisWindowDays, (i) => 2000 );
2526 expect (computeRelativeGrowthRate (downloads), 0.0 );
2627 });
2728
29+ test ('returns 0.0 for 0 downloads' , () {
30+ final downloads = List <int >.generate (analysisWindowDays, (i) => 0 );
31+ expect (computeRelativeGrowthRate (downloads), 0.0 );
32+ });
33+
2834 test ('calculates positive relative growth rate for positive trend' , () {
2935 // Input list (newest first): [1645, 1635, ..., 1355] (30 values)
3036 // Average = 1500 for the first 30 values. Slope: 10.
0 commit comments