radcheb / Adhan

High precision prayer time library
MIT License
13 stars 4 forks source link

Prayer Times Tests Fail on Windows MSYS2 and MinGW #16

Open AyahBot-Dev opened 1 year ago

AyahBot-Dev commented 1 year ago

Assalamu'alaikum wa rahmatullahi wa barakatuh, Recently while using this repo on windows after found it working successfully on Linux, I found an error while running the tests:

[==========] Running 25 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 9 tests from PrayerTimesTest
[ RUN      ] PrayerTimesTest.testDaysSinceSolstice
[       OK ] PrayerTimesTest.testDaysSinceSolstice (0 ms)
[ RUN      ] PrayerTimesTest.testPrayerTimes
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:57: Failure
Expected equality of these values:
  destString
    Which is: "08:42 AM"
  "04:42 AM"
[  FAILED  ] PrayerTimesTest.testPrayerTimes (0 ms)
[ RUN      ] PrayerTimesTest.testOffsets
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:90: Failure
Expected equality of these values:
  destString
    Which is: "10:35 AM"
  "05:35 AM"
[  FAILED  ] PrayerTimesTest.testOffsets (0 ms)
[ RUN      ] PrayerTimesTest.testMoonsightingMethod
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:174: Failure
Expected equality of these values:
  destString
    Which is: "10:48 AM"
  "05:48 AM"
[  FAILED  ] PrayerTimesTest.testMoonsightingMethod (0 ms)
[ RUN      ] PrayerTimesTest.testMoonsightingMethodHighLat
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:208: Failure
Expected equality of these values:
  destString
    Which is: "06:34 AM"
  "07:34 AM"
[  FAILED  ] PrayerTimesTest.testMoonsightingMethodHighLat (0 ms)
[ RUN      ] PrayerTimesTest.testTimeForPrayer
[       OK ] PrayerTimesTest.testTimeForPrayer (0 ms)
[ RUN      ] PrayerTimesTest.testCurrentPrayer
[       OK ] PrayerTimesTest.testCurrentPrayer (0 ms)
[ RUN      ] PrayerTimesTest.testNextPrayer
[       OK ] PrayerTimesTest.testNextPrayer (0 ms)
[ RUN      ] PrayerTimesTest.testPrayerTimesInTimezone
[       OK ] PrayerTimesTest.testPrayerTimesInTimezone (0 ms)
[----------] 9 tests from PrayerTimesTest (1 ms total)

[----------] 2 tests from CalculationMethodTest
[ RUN      ] CalculationMethodTest.testNightPortion
[       OK ] CalculationMethodTest.testNightPortion (0 ms)
[ RUN      ] CalculationMethodTest.testCalculationMethods
[       OK ] CalculationMethodTest.testCalculationMethods (0 ms)
[----------] 2 tests from CalculationMethodTest (0 ms total)

[----------] 2 tests from DoubleUtilsTest
[ RUN      ] DoubleUtilsTest.testNormalizing
[       OK ] DoubleUtilsTest.testNormalizing (0 ms)
[ RUN      ] DoubleUtilsTest.testClosestAngle
[       OK ] DoubleUtilsTest.testClosestAngle (0 ms)
[----------] 2 tests from DoubleUtilsTest (0 ms total)

[----------] 12 tests from AstronomicalTest
[ RUN      ] AstronomicalTest.testAngleConversion
[       OK ] AstronomicalTest.testAngleConversion (0 ms)
[ RUN      ] AstronomicalTest.testSolarCoordinates
[       OK ] AstronomicalTest.testSolarCoordinates (0 ms)
[ RUN      ] AstronomicalTest.testRightAscensionEdgeCase
[       OK ] AstronomicalTest.testRightAscensionEdgeCase (7 ms)
[ RUN      ] AstronomicalTest.testAltitudeOfCelestialBody
[       OK ] AstronomicalTest.testAltitudeOfCelestialBody (0 ms)
[ RUN      ] AstronomicalTest.testTransitAndHourAngle
[       OK ] AstronomicalTest.testTransitAndHourAngle (0 ms)
[ RUN      ] AstronomicalTest.testSolarTime
[       OK ] AstronomicalTest.testSolarTime (0 ms)
[ RUN      ] AstronomicalTest.testCalendricalDate
[       OK ] AstronomicalTest.testCalendricalDate (0 ms)
[ RUN      ] AstronomicalTest.testInterpolation
[       OK ] AstronomicalTest.testInterpolation (0 ms)
[ RUN      ] AstronomicalTest.testAngleInterpolation
[       OK ] AstronomicalTest.testAngleInterpolation (0 ms)
[ RUN      ] AstronomicalTest.testJulianDay
[       OK ] AstronomicalTest.testJulianDay (0 ms)
[ RUN      ] AstronomicalTest.testJulianHours
[       OK ] AstronomicalTest.testJulianHours (0 ms)
[ RUN      ] AstronomicalTest.testLeapYear
[       OK ] AstronomicalTest.testLeapYear (0 ms)
[----------] 12 tests from AstronomicalTest (7 ms total)

[----------] Global test environment tear-down
[==========] 25 tests from 4 test suites ran. (9 ms total)
[  PASSED  ] 21 tests.
[  FAILED  ] 4 tests, listed below:
[  FAILED  ] PrayerTimesTest.testPrayerTimes
[  FAILED  ] PrayerTimesTest.testOffsets
[  FAILED  ] PrayerTimesTest.testMoonsightingMethod
[  FAILED  ] PrayerTimesTest.testMoonsightingMethodHighLat

 4 FAILED TESTS

Can you look thoroughly into this issue?

AyahBot-Dev commented 1 year ago

I am further debugging on this issue I added a printf("%lld\n", final_fajr_time); in prayer_times.c file and so I ran tests and did grep '14' and save output to a txt file

in linux (wsl), I found:

1436690520
1448966100
1448966700
1448966100
1454237280
1451630040
1467321900
1441052040
1441052040
1451626440

in msys2 and mingw:

1436690520
1448966100
1454237280
1451630040
1467332700
1441062840
1441062840
1451630040

It is notable that the first one which ends with 520 in both, was the output of line 57 in prayer_times_test.cpp in errors I tried them in both windows terminal and mintty terminal, but all's the same