From 1588aa0294666c74d1b34a1be2a6180c6a352cee Mon Sep 17 00:00:00 2001 From: Arkene Chouchene Date: Wed, 1 Nov 2023 15:13:44 +0100 Subject: [PATCH] assertions straightened to avoid confusion when tests fail --- pFUnittests/test_slamastroconv.pf | 64 +++++++++--------- pFUnittests/test_slamlinAlgebra.pf | 2 +- pFUnittests/test_slammath.pf | 2 +- pFUnittests/test_slamreduction.pf | 78 +++++++++++----------- pFUnittests/test_slamtime.pf | 102 +++++++++++++++-------------- 5 files changed, 125 insertions(+), 123 deletions(-) diff --git a/pFUnittests/test_slamastroconv.pf b/pFUnittests/test_slamastroconv.pf index 10d7083..3f4ebeb 100644 --- a/pFUnittests/test_slamastroconv.pf +++ b/pFUnittests/test_slamastroconv.pf @@ -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 @@ -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 @@ -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 @@ -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/) @@ -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/) @@ -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 diff --git a/pFUnittests/test_slamlinAlgebra.pf b/pFUnittests/test_slamlinAlgebra.pf index b7aed13..643e540 100644 --- a/pFUnittests/test_slamlinAlgebra.pf +++ b/pFUnittests/test_slamlinAlgebra.pf @@ -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 diff --git a/pFUnittests/test_slammath.pf b/pFUnittests/test_slammath.pf index 153e2c6..adee0e3 100644 --- a/pFUnittests/test_slammath.pf +++ b/pFUnittests/test_slammath.pf @@ -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 \ No newline at end of file diff --git a/pFUnittests/test_slamreduction.pf b/pFUnittests/test_slamreduction.pf index e9cfe4c..c6ad34a 100644 --- a/pFUnittests/test_slamreduction.pf +++ b/pFUnittests/test_slamreduction.pf @@ -60,7 +60,7 @@ module test_slamreduction tolerance = 1.0d-6 ! check if output matches expected do i = 1, 3 - @assertRelativelyEqual(vec_out(i), expected(i), tolerance) + @assertRelativelyEqual(expected(i), vec_out(i), tolerance) end do ! Test case 2 : SSO @@ -78,7 +78,7 @@ module test_slamreduction tolerance = 1.0d-6 ! check if output matches expected do i = 1, 3 - @assertRelativelyEqual(vec_out(i), expected(i), tolerance) + @assertRelativelyEqual(expected(i), vec_out(i), tolerance) end do @@ -97,7 +97,7 @@ module test_slamreduction tolerance = 1.0d-6 ! check if output matches expected do i = 1, 3 - @assertRelativelyEqual(vec_out(i), expected(i), tolerance) + @assertRelativelyEqual(expected(i), vec_out(i), tolerance) end do ! Test case 4 : GTO2 @@ -115,7 +115,7 @@ module test_slamreduction tolerance = 1.0d-6 ! check if output matches expected do i = 1, 3 - @assertRelativelyEqual(vec_out(i), expected(i), tolerance) + @assertRelativelyEqual(expected(i), vec_out(i), tolerance) end do @@ -135,7 +135,7 @@ module test_slamreduction tolerance = 1.0d-6 ! check if output matches expected do i = 1, 3 - @assertRelativelyEqual(vec_out(i), expected(i), tolerance) + @assertRelativelyEqual(expected(i), vec_out(i), tolerance) end do @@ -276,7 +276,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(vec_sez, expected, tolerance) + @assertRelativelyEqual(expected, vec_sez, tolerance) ! Test case 2 : SSO @@ -294,7 +294,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(vec_sez, expected, tolerance) + @assertRelativelyEqual(expected, vec_sez, tolerance) end subroutine test_itrf2sez @@ -330,7 +330,7 @@ module test_slamreduction ! check if output matches expected - @assertRelativelyEqual(vec_itrf, expected, tolerance) + @assertRelativelyEqual(expected, vec_itrf, tolerance) ! Test case 2 vec_sez = (/-773.8654, -581.4980, 328.8145/) @@ -348,7 +348,7 @@ module test_slamreduction ! check if output matches expected - @assertRelativelyEqual(vec_itrf, expected, tolerance) + @assertRelativelyEqual(expected, vec_itrf, tolerance) end subroutine test_sez2itrf @@ -478,8 +478,8 @@ module test_slamreduction tolerance = 1e-6_dp ! Check if outputs match expected values - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) - @assertRelativelyEqual(v_inr, expected_v_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) + @assertRelativelyEqual(expected_v_inr, v_inr, tolerance) ! Test case 2 : SSO r_ef = (/1276.3548924297563, -6983.018152962259, -106.49682863132377/) @@ -497,8 +497,8 @@ module test_slamreduction tolerance = 1e-6_dp ! Check if outputs match expected values - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) - @assertRelativelyEqual(v_inr, expected_v_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) + @assertRelativelyEqual(expected_v_inr, v_inr, tolerance) ! Test case 3 : GTO1 r_ef = (/31986.08889084533, 3886.249797563777, -17606.478382491812/) @@ -516,8 +516,8 @@ module test_slamreduction tolerance = 1e-6_dp ! Check if outputs match expected values - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) - @assertRelativelyEqual(v_inr, expected_v_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) + @assertRelativelyEqual(expected_v_inr, v_inr, tolerance) ! Test case 4 : GTO2 r_ef = (/-2075.594626467358, -11489.252286113591, 2263.027976512451/) @@ -535,8 +535,8 @@ module test_slamreduction tolerance = 1e-6_dp ! Check if outputs match expected values - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) - @assertRelativelyEqual(v_inr, expected_v_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) + @assertRelativelyEqual(expected_v_inr, v_inr, tolerance) ! Test case 5 : GEO @@ -555,8 +555,8 @@ module test_slamreduction tolerance = 1e-6_dp ! Check if outputs match expected values - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) - @assertRelativelyEqual(v_inr, expected_v_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) + @assertRelativelyEqual(expected_v_inr, v_inr, tolerance) end subroutine test_earthFixed2inertial_rv @@ -593,7 +593,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) ! Test case 2 : SSO r_ef = (/1276.3548924297563, -6983.018152962259, -106.49682863132377/) @@ -609,7 +609,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) ! Test case 3 : GTO1 r_ef = (/31986.08889084533, 3886.249797563777, -17606.478382491812/) @@ -625,7 +625,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) ! Test case 4 : GTO2 r_ef = (/-2075.594626467358, -11489.252286113591, 2263.027976512451/) @@ -641,7 +641,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) ! Test case 5 : GEO r_ef = (/-42044.21889179173, -3193.6719204189853, 105.63094940415252/) @@ -657,7 +657,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_inr, expected_r_inr, tolerance) + @assertRelativelyEqual(expected_r_inr, r_inr, tolerance) end subroutine test_earthFixed2inertial_r @@ -803,8 +803,8 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) - @assertRelativelyEqual(v_ef, expected_v_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) + @assertRelativelyEqual(expected_v_ef, v_ef, tolerance) ! Test case 2 : SSO r_inr = (/7072.2648613669126, 609.22370162380560, -121.98699255537927/) @@ -822,8 +822,8 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) - @assertRelativelyEqual(v_ef, expected_v_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) + @assertRelativelyEqual(expected_v_ef, v_ef, tolerance) ! Test case 3 : GTO1 @@ -842,8 +842,8 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) - @assertRelativelyEqual(v_ef, expected_v_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) + @assertRelativelyEqual(expected_v_ef, v_ef, tolerance) ! Test case 4 : GTO2 r_inr = (/10988.388059643426, 3958.7024881264651, 2239.7103486946576/) @@ -861,8 +861,8 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) - @assertRelativelyEqual(v_ef, expected_v_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) + @assertRelativelyEqual(expected_v_ef, v_ef, tolerance) ! Test case 5 : GEO r_inr = (/42151.662630156716, 1078.8766087037018, 19.774161242768663/) @@ -880,8 +880,8 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) - @assertRelativelyEqual(v_ef, expected_v_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) + @assertRelativelyEqual(expected_v_ef, v_ef, tolerance) end subroutine test_inertial2earthFixed_rv @@ -916,7 +916,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) ! Test case 2 : SSO r_inr = (/-6195.3089449426943, -3182.2858414848092, 1376.2879473774449/) @@ -932,7 +932,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) ! Test case 3 : GTO1 r_inr = (/1325.9633384465537, -20603.560170780896, -30363.400598296554/) @@ -948,7 +948,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) ! Test case 4 : GTO2 r_inr = (/-9850.7931103627325, -2444.8938941380229, 6198.1181763580144/) @@ -964,7 +964,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) ! Test case 5 : GEO r_inr = (/42151.662630156716, 1078.8766087037018, 19.774161242768663/) @@ -980,7 +980,7 @@ module test_slamreduction tolerance = 1e-6_dp ! check if output matches expected - @assertRelativelyEqual(r_ef, expected_r_ef, tolerance) + @assertRelativelyEqual(expected_r_ef, r_ef, tolerance) end subroutine test_inertial2earthFixed_r end module test_slamreduction diff --git a/pFUnittests/test_slamtime.pf b/pFUnittests/test_slamtime.pf index 695959d..25a4b91 100644 --- a/pFUnittests/test_slamtime.pf +++ b/pFUnittests/test_slamtime.pf @@ -43,12 +43,12 @@ module test_slamtime call checkdate(year, mon, day, hrs, mins, secs) - @assertEqual(year, 2021) - @assertEqual(mon, 5) - @assertEqual(day, 3) - @assertEqual(hrs, 12) - @assertEqual(mins, 30) - @assertRelativelyEqual(secs, 10.0_dp, tolerance=1.0e-10) + @assertEqual(2021, year) + @assertEqual(5, mon) + @assertEqual(3, day) + @assertEqual(12, hrs) + @assertEqual(30, mins) + @assertRelativelyEqual(10.0_dp, secs, tolerance=1.0e-10) end subroutine test_checkdate @test @@ -67,7 +67,7 @@ module test_slamtime date_str = date2string(date) - @assertEqual(date_str, '2021-05-03T12:30:05Z') + @assertEqual('2021-05-03T12:30:05Z', date_str) end subroutine test_date2string @test @@ -86,7 +86,7 @@ module test_slamtime date_str = date2longstring(date) - @assertEqual(date_str, '2021-05-03T12:09:05.445566Z') + @assertEqual('2021-05-03T12:09:05.445566Z', date_str) end subroutine test_date2longstring @@ -105,7 +105,7 @@ module test_slamtime call gd2jd(jyr, jmo, jdy, jhr, jmi, sc, computed_jd) - @assertRelativelyEqual(computed_jd, expected_jd, tolerance=1e-10) + @assertRelativelyEqual(expected_jd, computed_jd, tolerance=1e-10) end subroutine test_gd2jd_std @@ -119,7 +119,7 @@ module test_slamtime call gd2jd(2023, 5, 4, 13, 30, 0.0_dp, computed_jd) - @assertRelativelyEqual(computed_jd, expected_jd, tolerance=1e-10) + @assertRelativelyEqual(expected_jd, computed_jd, tolerance=1e-10) end subroutine test_gd2jd_dt @@ -139,7 +139,7 @@ module test_slamtime call gd2mjd(year, month, day, hour, minute, second, DJM0, computed_mjd) - @assertEqual(computed_mjd, expected_mjd, tolerance=1e-10) + @assertEqual(expected_mjd, computed_mjd, tolerance=1e-10) end subroutine test_gd2mjd_std @test @@ -162,12 +162,12 @@ module test_slamtime call jd2gd(jd, computed_year, computed_month, computed_day, computed_hour, computed_minute, computed_second) - @assertEqual(computed_year, expected_year) - @assertEqual(computed_month, expected_month) - @assertEqual(computed_day, expected_day) - @assertEqual(computed_hour, expected_hour) - @assertEqual(computed_minute, expected_minute) - @assertEqual(computed_second, expected_second, tolerance=1e-10) + @assertEqual(expected_year, computed_year) + @assertEqual(expected_month, computed_month) + @assertEqual(expected_day, computed_day) + @assertEqual(expected_hour, computed_hour) + @assertEqual(expected_minute, computed_minute) + @assertEqual(expected_second, computed_second) end subroutine test_jd2gd_std @@ -189,13 +189,13 @@ module test_slamtime date%jd = jd call jd2gd(date) - @assertEqual(date%mjd, expected_mjd) - @assertEqual(date%year, expected_year) - @assertEqual(date%month, expected_month) - @assertEqual(date%day, expected_day) - @assertEqual(date%hour, expected_hour) - @assertEqual(date%minute, expected_minute) - @assertEqual(date%second, expected_second, tolerance=1e-10) + @assertEqual(expected_mjd, date%mjd) + @assertEqual(expected_year, date%year) + @assertEqual(expected_month, date%month) + @assertEqual(expected_day, date%day) + @assertEqual(expected_hour, date%hour) + @assertEqual(expected_minute, date%minute) + @assertEqual(expected_second, date%second) end subroutine test_jd2gd_dt @test @@ -208,7 +208,7 @@ module test_slamtime call jd2gd(input_jd, actual_out) - @assertEqual(actual_out, expected_out, 'The conversion from JD to GD is incorrect') + @assertEqual(expected_out, actual_out, 'The conversion from JD to GD is incorrect') end subroutine test_jd2gd_string @@ -231,13 +231,13 @@ module test_slamtime expected_minute = 0 expected_second = 0.0_dp expected_jd = 2459602.5_dp - @assertEqual(date%year, expected_year) - @assertEqual(date%month, expected_month) - @assertEqual(date%day, expected_day) - @assertEqual(date%hour, expected_hour) - @assertEqual(date%minute, expected_minute) - @assertEqual(date%second, expected_second) - @assertEqual(date%jd, expected_jd) + @assertEqual(expected_year, date%year) + @assertEqual(expected_month, date%month) + @assertEqual(expected_day, date%day) + @assertEqual(expected_hour, date%hour) + @assertEqual(expected_minute, date%minute) + @assertEqual(expected_second, date%second) + @assertEqual(expected_jd, date%jd) ! test #2: November 12, 2022 23:59:59 UT date%mjd = 59554.0_dp @@ -250,13 +250,13 @@ module test_slamtime expected_second = 0 expected_jd = 2459554.5_dp expected_frac = 0.999988425925926_dp - @assertEqual(date%year, expected_year) - @assertEqual(date%month, expected_month) - @assertEqual(date%day, expected_day) - @assertEqual(date%hour, expected_hour) - @assertEqual(date%minute, expected_minute) - @assertEqual(date%second, expected_second) - @assertEqual(date%jd, expected_jd) + @assertEqual(expected_year, date%year) + @assertEqual(expected_month, date%month) + @assertEqual(expected_day, date%day) + @assertEqual(expected_hour, date%hour) + @assertEqual(expected_minute, date%minute) + @assertEqual(expected_second, date%second) + @assertEqual(expected_jd, date%jd) end subroutine test_mjd2gd_dt @@ -282,7 +282,7 @@ module test_slamtime date%mjd = 58856.0_dp call mjd2jd(date) - @assertEqual(date%jd, 2458856.5_dp) + @assertEqual(2458856.5_dp, date%jd) end subroutine test_mjd2jd @@ -295,12 +295,12 @@ module test_slamtime date = yyddd2date(yyddd) - @assertEqual(date%year, 2021) - @assertEqual(date%month, 5) - @assertEqual(date%day, 3) - @assertEqual(date%hour, 10) - @assertEqual(date%minute, 57) - @assertRelativelyEqual(date%second, 46.569600300863542_dp, tolerance=1.0e-10) + @assertEqual(2021, date%year) + @assertEqual(5, date%month) + @assertEqual(3, date%day) + @assertEqual(10, date%hour) + @assertEqual(57, date%minute) + @assertRelativelyEqual(46.569600300863542_dp, date%second, tolerance=1.0e-10) end subroutine test_yyddd2date @test @@ -319,6 +319,7 @@ module test_slamtime call gd2mjd(year, month, day, 0, 0, 0.0_dp,DB0, time_mjd) expected_yyddd = 00001 actual_yyddd = mjd2yyddd(time_mjd) + @assertEqual(expected_yyddd, actual_yyddd) ! Test 2: Check yyddd on 31 Dec 2020 @@ -328,7 +329,8 @@ module test_slamtime call gd2mjd(year, month, day, 23, 59, 59.0_dp,DB0, time_mjd) expected_yyddd = 20366 actual_yyddd = mjd2yyddd(time_mjd) - @assertEqual(actual_yyddd, expected_yyddd) + + @assertEqual(expected_yyddd, actual_yyddd) end subroutine test_mjd2yyddd @@ -347,7 +349,7 @@ module test_slamtime expected_delT = 36.0 call delta_AT(IY, IM, ID, FD, DELTAT, J) - @assertRelativelyEqual(DELTAT, expected_delT, tolerance=1.0e-10) + @assertRelativelyEqual(expected_delT, DELTAT, tolerance=1.0e-10) ! Test case 2: 2017-01-01T00:00:00.0 UTC IY = 2017 @@ -357,7 +359,7 @@ module test_slamtime expected_delT = 36.0 call delta_AT(IY, IM, ID, FD, DELTAT, J) - @assertRelativelyEqual(DELTAT, expected_delT, tolerance=1.0e-10) + @assertRelativelyEqual(expected_delT, DELTAT, tolerance=1.0e-10) ! Test case 3: 2022-12-31T23:59:59.5 UTC IY = 2022 @@ -367,7 +369,7 @@ module test_slamtime expected_delT = 36.0 call delta_AT(IY, IM, ID, FD, DELTAT, J) - @assertRelativelyEqual(DELTAT, expected_delT, tolerance=1.0e-10) + @assertRelativelyEqual(expected_delT, DELTAT, tolerance=1.0e-10) end subroutine test_delta_AT