Commit 820bd0e0 authored by Mattias Engdegård's avatar Mattias Engdegård

Stabilise lunar-phase-list test (bug#45818)

The test reference data was produced with accidental interference from
the system daylight saving in effect at the time.  Prevent that
from occurring again and correct the data.

* test/lisp/calendar/lunar-tests.el (with-lunar-test):
Switch to UTC and make sure daylight saving adjustment is disabled.
Use normal time presentation for maintainability.
* test/lisp/calendar/lunar-tests.el (lunar-test-phase): Adjust to UTC.
(lunar-test-phase-list): Adjust to UTC with correct times.
Enable the test by removing its :unstable mark.
parent c734ba68
Pipeline #8685 passed with stage
in 55 minutes and 52 seconds
......@@ -27,39 +27,37 @@
(defmacro with-lunar-test (&rest body)
`(let ((calendar-latitude 40.1)
(calendar-longitude -88.2)
(calendar-location-name "Urbana, IL")
(calendar-time-zone -360)
(calendar-standard-time-zone-name "CST")
(calendar-time-display-form '(12-hours ":" minutes am-pm)))
(calendar-location-name "Paris")
(calendar-time-zone 0)
(calendar-standard-time-zone-name "UTC")
;; Make sure daylight saving is disabled to avoid interference
;; from the system settings (see bug#45818).
(calendar-daylight-savings-starts nil)
(calendar-time-display-form '(24-hours ":" minutes)))
,@body))
(ert-deftest lunar-test-phase ()
(with-lunar-test
(should (equal (lunar-phase 1)
'((1 7 1900) "11:40pm" 1 "")))))
'((1 8 1900) "05:40" 1 "")))))
(ert-deftest lunar-test-eclipse-check ()
(with-lunar-test
(should (equal (eclipse-check 1 1) "** Eclipse **"))))
;; This fails in certain time zones.
;; Eg TZ=America/Phoenix make lisp/calendar/lunar-tests
;; Similarly with TZ=UTC.
;; Daylight saving related?
(ert-deftest lunar-test-phase-list ()
:tags '(:unstable)
(with-lunar-test
(should (equal (lunar-phase-list 3 1871)
'(((3 20 1871) "11:03pm" 0 "")
((3 29 1871) "1:46am" 1 "** Eclipse **")
((4 5 1871) "9:20am" 2 "")
((4 12 1871) "12:57am" 3 "** Eclipse possible **")
((4 19 1871) "2:06pm" 0 "")
((4 27 1871) "6:49pm" 1 "")
((5 4 1871) "5:57pm" 2 "")
((5 11 1871) "9:29am" 3 "")
((5 19 1871) "5:46am" 0 "")
((5 27 1871) "8:02am" 1 ""))))))
'(((3 21 1871) "04:03" 0 "")
((3 29 1871) "06:46" 1 "** Eclipse **")
((4 5 1871) "14:20" 2 "")
((4 12 1871) "05:57" 3 "** Eclipse possible **")
((4 19 1871) "19:06" 0 "")
((4 27 1871) "23:49" 1 "")
((5 4 1871) "22:57" 2 "")
((5 11 1871) "14:29" 3 "")
((5 19 1871) "10:46" 0 "")
((5 27 1871) "13:02" 1 ""))))))
(ert-deftest lunar-test-new-moon-time ()
(with-lunar-test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment