-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathparameter_test.go
78 lines (75 loc) · 1.47 KB
/
parameter_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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package meteomatics
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestParameterString(t *testing.T) {
for _, tc := range []struct {
ps ParameterStringer
expected ParameterString
}{
{
ps: ParameterString("t_2m:C"),
expected: "t_2m:C",
},
{
ps: Parameter{
Name: ParameterTemperature,
Level: LevelMeters(2),
Units: UnitsCelsius,
},
expected: "t_2m:C",
},
{
ps: Parameter{
Name: ParameterTemperature,
Level: LevelCentimeters(-150),
Units: UnitsCelsius,
},
expected: "t_-150cm:C",
},
{
ps: Parameter{
Name: ParameterTemperatureMean,
Level: LevelHectopascals(500),
Interval: Interval6H,
Units: UnitsKelvin,
},
expected: "t_mean_500hPa_6h:K",
},
{
ps: Parameter{
Name: ParameterRelativeHumidity,
Level: LevelHectopascals(1000),
Units: UnitsPercentage,
},
expected: "relative_humidity_1000hPa:p",
},
{
ps: Parameter{
Name: ParameterPrecipitation,
Interval: Interval(15 * time.Minute),
Units: UnitsMillimeters,
},
expected: "precip_15min:mm",
},
{
ps: Parameter{
Name: ParameterPrecipitationType,
Units: UnitsIndex,
},
expected: "precip_type:idx",
},
{
ps: Parameter{
Name: ParameterPolarVortex,
Level: LevelHectopascals(200),
Units: UnitsMetersPerSecond,
},
expected: "polar_vortex_200hPa:ms",
},
} {
assert.Equal(t, tc.expected, tc.ps.ParameterString())
}
}