-
Notifications
You must be signed in to change notification settings - Fork 3
/
remarks_test.go
39 lines (32 loc) · 1.77 KB
/
remarks_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
package metar
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestParseRemarks(t *testing.T) {
type testpair struct {
input []string
expected *Remark
}
var tests = []testpair{
// WindOnRWY []WindOnRWY
// QBB int // cloud base in meters
// МТOBSC bool // Mountains obscured
// MASTOBSC bool // Mast obscured
// OBSTOBSC bool // Obstacle obscured
// QFE int // Q-code Field Elevation (mmHg/hPa)
{[]string{"RMK", "R06/25002MPS", "QFE762"}, &Remark{WindOnRWY: []WindOnRWY{WindOnRWY{Runway: "06", Wind: getWind("25002MPS")}}, QBB: 0, МТOBSC: false, MASTOBSC: false, OBSTOBSC: false, QFE: 762}},
{[]string{"QBB200", "MT", "OBSC", "QFE762"}, &Remark{WindOnRWY: nil, QBB: 200, МТOBSC: true, MASTOBSC: false, OBSTOBSC: false, QFE: 762}},
{[]string{"QBB180"}, &Remark{WindOnRWY: nil, QBB: 180, МТOBSC: false, MASTOBSC: false, OBSTOBSC: false, QFE: 0}},
{[]string{"MT", "OBSC", "MAST", "OBSC", "OBST", "OBSC", "QFE762/1004"}, &Remark{WindOnRWY: nil, QBB: 0, МТOBSC: true, MASTOBSC: true, OBSTOBSC: true, QFE: 762}},
{[]string{"MT", "OBSC"}, &Remark{WindOnRWY: nil, QBB: 0, МТOBSC: true, MASTOBSC: false, OBSTOBSC: false, QFE: 0}},
{[]string{"MAST", "OBSC"}, &Remark{WindOnRWY: nil, QBB: 0, МТOBSC: false, MASTOBSC: true, OBSTOBSC: false, QFE: 0}},
{[]string{"OBST", "OBSC"}, &Remark{WindOnRWY: nil, QBB: 0, МТOBSC: false, MASTOBSC: false, OBSTOBSC: true, QFE: 0}},
{[]string{"RMK", "R06/25002MPS", "120V180"}, &Remark{WindOnRWY: []WindOnRWY{WindOnRWY{Runway: "06", Wind: getWind("25002MPS 120V180")}}, QBB: 0, МТOBSC: false, MASTOBSC: false, OBSTOBSC: false, QFE: 0}},
}
Convey("Remarks parsing tests", t, func() {
for _, pair := range tests {
So(parseRemarks(pair.input), ShouldResemble, pair.expected)
}
})
}