@@ -11,6 +11,7 @@ void main() {
11
11
expect (calculateLinearRegressionSlope ([10.0 , 20.0 , 30.0 ]), 10.0 );
12
12
expect (calculateLinearRegressionSlope ([30.0 , 20.0 , 10.0 ]), - 10.0 );
13
13
expect (calculateLinearRegressionSlope ([10.0 , 10.0 , 10.0 ]), 0 );
14
+ expect (calculateLinearRegressionSlope ([0.0 , 0.0 , 0.0 ]), 0 );
14
15
});
15
16
16
17
test ('return 0.0 if denominator is very small' , () {
@@ -20,11 +21,16 @@ void main() {
20
21
});
21
22
22
23
group ('computeRelativeGrowthRate' , () {
23
- test ('returns 0.0 for stable downloads meeting threshold ' , () {
24
+ test ('returns 0.0 for stable downloads' , () {
24
25
final downloads = List <int >.generate (analysisWindowDays, (i) => 2000 );
25
26
expect (computeRelativeGrowthRate (downloads), 0.0 );
26
27
});
27
28
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
+
28
34
test ('calculates positive relative growth rate for positive trend' , () {
29
35
// Input list (newest first): [1645, 1635, ..., 1355] (30 values)
30
36
// Average = 1500 for the first 30 values. Slope: 10.
0 commit comments