Skip to content

Commit

Permalink
assertions straightened to avoid confusion when tests fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ArkenCh committed Nov 1, 2023
1 parent f62467c commit 1588aa0
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 123 deletions.
64 changes: 32 additions & 32 deletions pFUnittests/test_slamastroconv.pf
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ module test_slamastroconv
expected_LonPer = 999999.09999999998_dp

! Check if the computed values match the expected values
@assertRelativelyEqual(P, expected_P, tolerance=1.0e-5_dp)
@assertRelativelyEqual(A, expected_A, tolerance=1.0e-5_dp)
@assertRelativelyEqual(Ecc, expected_Ecc, tolerance=1.0e-5_dp)
@assertRelativelyEqual(Incl, expected_Incl, tolerance=1.0e-5_dp)
@assertRelativelyEqual(Omega, expected_Omega, tolerance=1.0e-5_dp)
@assertRelativelyEqual(Argp, expected_Argp, tolerance=1.0e-5_dp)
@assertRelativelyEqual(Nu, expected_Nu, tolerance=1.0e-5_dp)
@assertRelativelyEqual(M, expected_M, tolerance=1.0e-5_dp)
@assertRelativelyEqual(ArgLat, expected_ArgLat, tolerance=1.0e-5_dp)
@assertRelativelyEqual(TrueLon, expected_TrueLon, tolerance=1.0e-5_dp)
@assertRelativelyEqual(LonPer, expected_LonPer, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_P, P, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_A, A, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_Ecc, Ecc, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_Incl, Incl, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_Omega, Omega, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_Argp, Argp, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_Nu, Nu, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_M, M, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_ArgLat, ArgLat, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_TrueLon, TrueLon, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_LonPer, LonPer, tolerance=1.0e-5_dp)

end subroutine test_rv2coe_long

Expand Down Expand Up @@ -120,16 +120,16 @@ module test_slamastroconv
expected_epoch%second = 47_dp

! Check if the computed values match the expected values
@assertRelativelyEqual(kep%sma, expected_sma, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%ecc, expected_ecc, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%inc, expected_inc, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%raan, expected_raan, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%aop, expected_aop, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%tran, expected_tran, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%man, expected_man, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%arglat, expected_arglat, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%truelon, expected_truelon, tolerance=1.0e-5_dp)
@assertRelativelyEqual(kep%lonper, expected_lonper, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_sma, kep%sma, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_ecc, kep%ecc, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_inc, kep%inc, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_raan, kep%raan, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_aop, kep%aop, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_tran, kep%tran, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_man, kep%man, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_arglat, kep%arglat, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_truelon, kep%truelon, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_lonper, kep%lonper, tolerance=1.0e-5_dp)

end subroutine test_rv2coe_short

Expand Down Expand Up @@ -163,8 +163,8 @@ module test_slamastroconv
expected_V = (/-1.3525457950562447_dp, -0.2804534841971075_dp, -7.4721873681232385_dp/)

! Check if the computed values match the expected values
@assertRelativelyEqual(R, expected_R, tolerance=1.0e-5_dp)
@assertRelativelyEqual(V, expected_V, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_R, R, tolerance=1.0e-5_dp)
@assertRelativelyEqual(expected_V, V, tolerance=1.0e-5_dp)

end subroutine test_coe2rv_long

Expand Down Expand Up @@ -192,9 +192,9 @@ module test_slamastroconv
expected_lon = 0.78539816339744839_dp

! Check if the computed values match the expected values
@assertRelativelyEqual(altitude, expected_altitude, tolerance=1.0e-5_dp)
@assertEqual(lat, expected_lat)
@assertEqual(lon, expected_lon)
@assertRelativelyEqual(expected_altitude, altitude, tolerance=1.0e-5_dp)
@assertEqual(expected_lat, lat)
@assertEqual(expected_lon, lon)

! Initialize the input values
r_ecef = (/6800.0_dp, 6720.0_dp, 0.0_dp/)
Expand All @@ -208,9 +208,9 @@ module test_slamastroconv
expected_lon = 0.77948107269142086_dp

! Check if the computed values match the expected values
@assertRelativelyEqual(altitude, expected_altitude, tolerance=1.0e-5_dp)
@assertEqual(lat, expected_lat)
@assertEqual(lon, expected_lon)
@assertRelativelyEqual(expected_altitude, altitude, tolerance=1.0e-5_dp)
@assertEqual(expected_lat, lat)
@assertEqual(expected_lon, lon)

! Initialize the input values
r_ecef = (/6660.0_dp, 6700.0_dp, 6800.0_dp/)
Expand All @@ -224,9 +224,9 @@ module test_slamastroconv
expected_lon = 0.78839216642732912_dp

! Check if the computed values match the expected values
@assertRelativelyEqual(altitude, expected_altitude, tolerance=1.0e-5_dp)
@assertEqual(lat, expected_lat)
@assertEqual(lon, expected_lon)
@assertRelativelyEqual(expected_altitude, altitude, tolerance=1.0e-5_dp)
@assertEqual(expected_lat, lat)
@assertEqual(expected_lon, lon)

end subroutine test_getGeodeticLatLon

Expand Down
2 changes: 1 addition & 1 deletion pFUnittests/test_slamlinAlgebra.pf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module test_slamlinAlgebra
-0.1, -0.14285714285714285, 0.27142857142857146/), (/3, 3/))

! Check if the compute inverse matrix matches the expected inverse matrix
@assertEqual(A_inv, expected, tolerance = 0.00001)
@assertEqual(expected, A_inv, tolerance = 0.00001)

end subroutine test_invert_matrix

Expand Down
2 changes: 1 addition & 1 deletion pFUnittests/test_slammath.pf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module test_slammath
expected_result = sqrt(14.0_dp)

! Check if the computed result matches the expected result
@assertRelativelyEqual(result, expected_result, tolerance=1.0e-10_dp)
@assertRelativelyEqual(expected_result, result, tolerance=1.0e-10_dp)
end subroutine test_magFunction

end module test_slammath
Loading

0 comments on commit 1588aa0

Please sign in to comment.