-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprop_test.go
More file actions
75 lines (59 loc) · 1.49 KB
/
prop_test.go
File metadata and controls
75 lines (59 loc) · 1.49 KB
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
package gpelements
import (
"bufio"
"fmt"
"os"
"testing"
"time"
)
func TestProp(t *testing.T) {
filename := "data/test.tle"
in, err := os.Open(filename)
if err != nil {
t.Skipf("Couldn't read %s: %s", filename, err)
}
defer in.Close() // Ignore error.
var (
r = bufio.NewReader(in)
now = time.Now().UTC() // ToDo: Use a constant.
errs = make([]error, 0, 32)
count = 0
)
f := func(lines []string) error {
count++
e, err := ParseTLE(lines[0], lines[1], lines[2])
if err != nil {
return err
}
o, err := e.SGP4()
if err != nil {
return err
}
s, err := Prop(o, now)
if err != nil {
err = fmt.Errorf("error %s\n%s\n%s\n%s\n", err, lines[0], lines[1], lines[2])
errs = append(errs, err)
}
if false {
fmt.Printf("%#v\n", s)
}
return nil
}
if err := DoTLEs(r, 3, f); err != nil {
t.Fatal(err)
}
for i, err := range errs {
fmt.Printf("%d %s\n", i, err)
}
// 0 error SGP4 error at ms=1608048467780: code=1: mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
// SIRIUSSAT-1
// 1 43595U 98067PG 20344.55055662 .07916525 12514-4 56251-3 0 9997
// 2 43595 51.6588 97.6693 0009437 42.2825 52.9592 16.39998780132780
// 1 error SGP4 error at ms=1608048467780: code=1: mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er
// SIRIUSSAT-2
// 1 43596U 98067PH 20344.36554324 .08904132 12494-4 57179-3 0 9995
// 2 43596 51.6062 99.6513 0006261 312.7483 99.6145 16.40921535132742
if 2 < len(errs) {
t.Fatal(errs)
}
}