1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-04 06:31:13 -08:00
emacs/test/lisp/calendar/solar-tests.el
Mattias Engdegård c734ba6862 Fix Indian time zone test when run by Irishmen (bug#45818)
* test/lisp/calendar/solar-tests.el (solar-sunrise-sunset):
Inhibit any attempt by confused calendar code to apply daylight saving
correction when Irish time zone settings are in effect.  It's not
entirely clear why this is needed but may be related to the fact that
'IST' stands for both Irish and Indian Standard Time, and that Ireland
uses reversed daylight saving in winter.
2021-01-12 21:48:13 +01:00

44 lines
1.9 KiB
EmacsLisp

;;; solar-tests.el --- tests for solar.el -*- lexical-binding: t -*-
;; Copyright (C) 2020-2021 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
(require 'ert)
(require 'solar)
(ert-deftest solar-sunrise-sunset ()
;; Bug#44237: wrong sunrise time on Dec 30 and 31, 2020 for Jaipur.
(let ((calendar-latitude 26.9)
(calendar-longitude 75.8)
(calendar-time-zone +330)
(calendar-standard-time-zone-name "IST")
;; Make sure our clockwork isn't confused by daylight saving rules
;; in effect for any other time zone (bug#45818).
(calendar-daylight-savings-starts nil)
(epsilon (/ 60.0))) ; Minute accuracy is good enough.
(let* ((sunrise-sunset (solar-sunrise-sunset '(12 30 2020)))
(sunrise (car (nth 0 sunrise-sunset)))
(sunset (car (nth 1 sunrise-sunset))))
(should (< (abs (- sunrise 7.27)) epsilon))
(should (< (abs (- sunset 17.72)) epsilon)))
(let* ((sunrise-sunset (solar-sunrise-sunset '(12 31 2020)))
(sunrise (car (nth 0 sunrise-sunset)))
(sunset (car (nth 1 sunrise-sunset))))
(should (< (abs (- sunrise 7.28)) epsilon))
(should (< (abs (- sunset 17.72)) epsilon)))))
(provide 'solar-tests)