Skip to content

Commit

Permalink
🚨 Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisbr committed Jul 2, 2024
1 parent fd2501b commit d3d320f
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/j2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@
@test v[2] / 1000 -6.699518 atol = 1e-5
@test v[3] / 1000 -1.266334 atol = 1e-5
@test eltype(v) == T

r, v, j2d = j2((jd₁ - jd₀) * 86400, orb)

@test j2d isa J2Propagator{Float64, Float64}

@test r[1] / 1000 -6849.654348 atol = 5e-3
@test r[2] / 1000 -2253.059809 atol = 5e-3
@test r[3] / 1000 +3574.529667 atol = 5e-3
@test eltype(r) == T

@test v[1] / 1000 +1.656142 atol = 1e-5
@test v[2] / 1000 -6.699518 atol = 1e-5
@test v[3] / 1000 -1.266334 atol = 1e-5
@test eltype(v) == T
end

# == Float32 ===========================================================================
Expand Down Expand Up @@ -254,6 +268,20 @@
@test v[2] / 1000 -6.699518 atol = 1e-3
@test v[3] / 1000 -1.266334 atol = 1e-3
@test eltype(v) == T

r, v, j2d = j2((jd₁ - jd₀) * 86400, orb; j2c = j2c_egm2008_f32)

@test j2d isa J2Propagator{Float64, Float32}

@test r[1] / 1000 -6849.654348 atol = 5e-1
@test r[2] / 1000 -2253.059809 atol = 5e-1
@test r[3] / 1000 +3574.529667 atol = 5e-1
@test eltype(r) == T

@test v[1] / 1000 +1.656142 atol = 1e-3
@test v[2] / 1000 -6.699518 atol = 1e-3
@test v[3] / 1000 -1.266334 atol = 1e-3
@test eltype(v) == T
end
end

Expand Down
26 changes: 26 additions & 0 deletions test/j2osc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T

r, v, j2oscd = j2osc(results[end, 1], orb)

@test j2oscd isa J2OsculatingPropagator{Float64, Float64}

@test results[end, 2] r[1] / 1000 atol = 2e-1
@test results[end, 3] r[2] / 1000 atol = 2e-1
@test results[end, 4] r[3] / 1000 atol = 2e-1
@test results[end, 5] v[1] / 1000 atol = 1e-3
@test results[end, 6] v[2] / 1000 atol = 1e-3
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T
end

# == Float32 ===========================================================================
Expand Down Expand Up @@ -328,6 +341,19 @@
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T

r, v, j2oscd = j2osc(results[end, 1], orb; j2c = j2c_egm2008_f32)

@test j2oscd isa J2OsculatingPropagator{Float64, Float32}

@test results[end, 2] r[1] / 1000 atol = 2e-1
@test results[end, 3] r[2] / 1000 atol = 2e-1
@test results[end, 4] r[3] / 1000 atol = 2e-1
@test results[end, 5] v[1] / 1000 atol = 1e-3
@test results[end, 6] v[2] / 1000 atol = 1e-3
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T
end
end

Expand Down
32 changes: 32 additions & 0 deletions test/j4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@
@test orbk.f |> rad2deg 245.617459 (atol = 4e-3)

@test_broken orbk.Ω |> rad2deg 84.158846 (atol = 4e-3)

r, v, j4d = j4((jd₁ - jd₀) * 86400, orb)

@test eltype(r) == T
@test eltype(v) == T

orbk = j4d.orbk
M_k = true_to_mean_anomaly(orbk.e, orbk.f)

@test orbk.a 8000.0e3 (atol = 1e-3)
@test orbk.e 0.015 (atol = 1e-6)
@test orbk.i |> rad2deg 28.5 (atol = 1e-6)
@test orbk.ω |> rad2deg 225.864212 (atol = 4e-3)
@test orbk.f |> rad2deg 245.617459 (atol = 4e-3)

@test_broken orbk.Ω |> rad2deg 84.158846 (atol = 4e-3)
end

# == Float32 ===========================================================================
Expand Down Expand Up @@ -245,6 +261,22 @@
@test orbk.f |> rad2deg 245.617459 (atol = 4e-3)

@test_broken orbk.Ω |> rad2deg 84.158846 (atol = 4e-3)

r, v, j4d = j4((jd₁ - jd₀) * 86400, orb; j4c = j4c_egm2008_f32)

@test eltype(r) == T
@test eltype(v) == T

orbk = j4d.orbk
M_k = true_to_mean_anomaly(orbk.e, orbk.f)

@test orbk.a 8000.0e3 (atol = 1e-1)
@test orbk.e 0.015 (atol = 1e-6)
@test orbk.i |> rad2deg 28.5 (atol = 2e-6)
@test orbk.ω |> rad2deg 225.864212 (atol = 4e-3)
@test orbk.f |> rad2deg 245.617459 (atol = 4e-3)

@test_broken orbk.Ω |> rad2deg 84.158846 (atol = 4e-3)
end
end

Expand Down
26 changes: 26 additions & 0 deletions test/j4osc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T

r, v, j4oscd = j4osc(results[end, 1], orb)

@test j4oscd isa J4OsculatingPropagator{Float64, Float64}

@test results[end, 2] r[1] / 1000 atol = 2e-1
@test results[end, 3] r[2] / 1000 atol = 2e-1
@test results[end, 4] r[3] / 1000 atol = 2e-1
@test results[end, 5] v[1] / 1000 atol = 1e-3
@test results[end, 6] v[2] / 1000 atol = 1e-3
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T
end

# == Float32 ===========================================================================
Expand Down Expand Up @@ -328,6 +341,19 @@
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T

r, v, j4oscd = j4osc(results[end, 1], orb; j4c = j4c_egm2008_f32)

@test j4oscd isa J4OsculatingPropagator{Float64, Float32}

@test results[end, 2] r[1] / 1000 atol = 2e-1
@test results[end, 3] r[2] / 1000 atol = 2e-1
@test results[end, 4] r[3] / 1000 atol = 2e-1
@test results[end, 5] v[1] / 1000 atol = 1e-3
@test results[end, 6] v[2] / 1000 atol = 1e-3
@test results[end, 7] v[3] / 1000 atol = 1e-3
@test eltype(r) == T
@test eltype(v) == T
end
end

Expand Down
28 changes: 28 additions & 0 deletions test/twobody.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@
@test v[2] / 1000 -1.916735 atol = 1e-6
@test v[3] / 1000 -6.112511 atol = 1e-6
@test eltype(v) == T

r, v, tbd = twobody(40 * 60, orb)

@test tbd isa TwoBodyPropagator{Float64, Float64}

@test r[1] / 1000 -4219.7527 atol = 1e-3
@test r[2] / 1000 +4363.0292 atol = 1e-3
@test r[3] / 1000 -3958.7666 atol = 1e-3
@test eltype(r) == T

@test v[1] / 1000 +3.689866 atol = 1e-6
@test v[2] / 1000 -1.916735 atol = 1e-6
@test v[3] / 1000 -6.112511 atol = 1e-6
@test eltype(v) == T
end

# == Float32 ===========================================================================
Expand Down Expand Up @@ -252,6 +266,20 @@
@test v[2] / 1000 -1.916735 atol = 5e-3
@test v[3] / 1000 -6.112511 atol = 5e-3
@test eltype(v) == T

r, v, tbd = twobody(40 * 60, orb; m0 = tbc_m0_f32)

@test tbd isa TwoBodyPropagator{Float64, Float32}

@test r[1] / 1000 -4219.7527 atol = 5e-1
@test r[2] / 1000 +4363.0292 atol = 5e-1
@test r[3] / 1000 -3958.7666 atol = 5e-1
@test eltype(r) == T

@test v[1] / 1000 +3.689866 atol = 5e-3
@test v[2] / 1000 -1.916735 atol = 5e-3
@test v[3] / 1000 -6.112511 atol = 5e-3
@test eltype(v) == T
end
end

Expand Down

0 comments on commit d3d320f

Please sign in to comment.