Function: calendar-bahai--verify-twin-birthdays

calendar-bahai--verify-twin-birthdays is a byte-compiled function defined in cal-bahai.el.gz.

Signature

(calendar-bahai--verify-twin-birthdays)

Documentation

Verify Twin Holy Birthday calculations against official reference dates.

Returns a plist with :total, :bab-correct, :baha-correct, and :errors keys.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-bahai.el.gz
(defun calendar-bahai--verify-twin-birthdays ()
  "Verify Twin Holy Birthday calculations against official reference dates.
Returns a plist with :total, :bab-correct, :baha-correct, and :errors keys."
  (let ((total 0)
        (bab-correct 0)
        (baha-correct 0)
        (errors nil))
    (dolist (entry calendar-bahai--twin-birthdays-reference-dates)
      (let* ((greg-year (nth 0 entry))
             (bahai-year (- greg-year (1- 1844)))
             (expected-bab (list (nth 1 entry) (nth 2 entry) greg-year))
             (expected-baha (list (nth 3 entry) (nth 4 entry) greg-year)))
        ;; Only verify from reform year onwards
        (when (>= bahai-year calendar-bahai-reform-year)
          (setq total (1+ total))
          (let* ((computed (calendar-bahai-twin-holy-birthdays-for-year bahai-year))
                 (computed-bab (car computed))
                 (computed-baha (cadr computed)))
            (if (equal computed-bab expected-bab)
                (setq bab-correct (1+ bab-correct))
              (push (list greg-year "Báb" expected-bab computed-bab) errors))
            (if (equal computed-baha expected-baha)
                (setq baha-correct (1+ baha-correct))
              (push (list greg-year "Bahá’u’lláh" expected-baha computed-baha)
                    errors))))))
    (list :total total
          :bab-correct bab-correct
          :baha-correct baha-correct
          :errors (nreverse errors))))