-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeltat_test.go
55 lines (48 loc) · 843 Bytes
/
deltat_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package gosolarpos
import (
"math"
"testing"
"time"
)
func TestHistoricData(t *testing.T) {
var referenceData = [][]float64{
{100, 9600},
{200, 8640},
{300, 7680},
{400, 6700},
{500, 5710},
{600, 4740},
{700, 3810},
{800, 2960},
{900, 2200},
{1000, 1570},
{1100, 1090},
{1200, 740},
{1300, 490},
{1400, 320},
{1500, 200},
{1600, 120},
{1700, 9},
{1750, 13},
{1800, 14},
{1850, 7},
{1900, -3},
{1950, 29},
{1955, 31.1},
{1990, 56.9},
{2005, 64.7},
{2015, 68.0},
{2019, 69.2202},
{2022, 69.2945},
}
for _, row := range referenceData {
year := row[0]
cal := time.Date(int(year), 1, 1, 0, 0, 0, 0, time.UTC)
ref := row[1]
est := EstimateDeltaT(cal)
estDiffRatio := math.Abs(est-ref) / ref
if estDiffRatio > 0.03 {
t.Error("ref: ", ref, " actual: ", est)
}
}
}