func TestAnomalyDistance2(t *testing.T) { var e nearparabolic.Elements for _, d := range tdat2 { e.TimeP = base.J2000 + rand.Float64()*base.JulianCentury e.PDis = d.q e.Ecc = d.e ν, _, err := e.AnomalyDistance(e.TimeP + d.t) if (err == nil) != d.c { t.Errorf("%#v", d) continue } if math.Abs(ν.Deg()-d.ν) > math.Pow(10, float64(-d.p)) { t.Errorf("got ν = %.*f expected %.*f", d.p+1, ν.Deg(), d.p+1, d.ν) } } }
func TestAnomalyDistance(t *testing.T) { var e nearparabolic.Elements for _, d := range tdat { e.TimeP = base.J2000 + rand.Float64()*base.JulianCentury e.PDis = d.q e.Ecc = d.e ν, r, err := e.AnomalyDistance(e.TimeP + d.t) if err != nil { t.Error(err) continue } if math.Abs(ν.Deg()-d.ν) > 1e-5 { t.Errorf("got ν = %.6f expected %.6f", ν.Deg(), d.ν) } if math.Abs(r-d.r) > 1e-6 { t.Errorf("got r = %.7f expected %.7f", r, d.r) } } }