You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
astro/basic/stardat_test.go

60 lines
1.3 KiB
Go

3 years ago
package basic
import (
. "b612.me/astro/tools"
"fmt"
3 years ago
"testing"
)
func Test_ParseStar(t *testing.T) {
//dat := []byte(`2491 9Alp CMaBD-16 1591 48915151881 257I 5423 064044.6-163444064508.9-164258227.22-08.88-1.46 0.00 -0.05 -0.03 A1Vm -0.553-1.205 +.375-008SBO 13 10.3 11.2AB 4*`)
err := LoadStarData()
if err != nil {
t.Fatal(err)
}
3 years ago
for _, v := range stardat {
_, err = parseStarData(v)
if err != nil {
t.Fatal(err)
}
3 years ago
}
}
1 year ago
func TestGetStarByChniese(t *testing.T) {
err := LoadStarData()
if err != nil {
t.Fatal(err)
}
sirius, err := StarDataByChinese("天狼星")
if err != nil {
t.Fatal(err)
}
if sirius.HIP != 32349 || sirius.HR != 2491 {
t.Fatal("cannot found star")
}
fmt.Printf("%+v\n", sirius)
sirius, err = StarDataByChinese("天狼")
if err != nil {
t.Fatal(err)
}
if sirius.HIP != 32349 || sirius.HR != 2491 {
t.Fatal("cannot found star")
}
}
func TestGetRaDecByDate(t *testing.T) {
err := LoadStarData()
if err != nil {
t.Fatal(err)
}
sirius, err := StarDataByHR(2491)
if err != nil {
t.Fatal(err)
}
1 year ago
fmt.Printf("%+v\n", sirius)
fmt.Println(Format(sirius.Ra/15, 1), Format(sirius.Dec, 0))
now := GetNowJDE()
ra, dec := sirius.RaDecByJde(now)
fmt.Println(Format(ra/15, 1), Format(dec, 0))
}