䷓ Contemplation
Some checks failed
melpazoid-i-ching / build (push) Has been cancelled

This commit is contained in:
nik gaffney 2024-11-13 17:42:28 +01:00
parent 0870cb1fa5
commit e4339cb64a
Signed by: nik
GPG key ID: 989F5E6EDB478160
2 changed files with 14 additions and 6 deletions

View file

@ -865,17 +865,21 @@ Provided by Randomness and Integrity Services Ltd. via https://www.random.org/"
The hexagram can be entered as a string, or by number." The hexagram can be entered as a string, or by number."
(interactive "sHexagram number? " hexagram) (interactive "sHexagram number? " hexagram)
(let ((hexagram-number (let ((hexagram-number
(pcase hexagram (cond
((pred numberp) hexagram) ((i-ching-hexagram-p hexagram)
((pred i-ching-hexagram-p) (i-ching-hexagram-to-number hexagram))
(i-ching-hexagram-to-number hexagram)) ((numberp hexagram) hexagram)
(_ (error "Not a hexagram symbol or number"))))) ((stringp hexagram)
(if (numberp (string-to-number hexagram))
(string-to-number hexagram)))
(t (error "Not a hexagram symbol or number")))))
(format "%s\n\n%s\n\nJudgment: %s\n\nImage: %s\n\n" (format "%s\n\n%s\n\nJudgment: %s\n\nImage: %s\n\n"
(i-ching-number-to-hexagram hexagram-number) (i-ching-number-to-hexagram hexagram-number)
(i-ching-number-to-description hexagram-number) (i-ching-number-to-description hexagram-number)
(i-ching-number-to-judgment hexagram-number) (i-ching-number-to-judgment hexagram-number)
(i-ching-number-to-image hexagram-number)))) (i-ching-number-to-image hexagram-number))))
;; querying the I Ching ;; querying the I Ching
;;;###autoload ;;;###autoload

View file

@ -76,7 +76,11 @@
(ert-deftest i-ching-interprets () (ert-deftest i-ching-interprets ()
(should (stringp (i-ching-interpretation 49))) (should (stringp (i-ching-interpretation 49)))
(should-not (seq-empty-p (i-ching-interpretation 49)))) (should (stringp (i-ching-interpretation "23")))
(should (stringp (i-ching-interpretation "")))
(should-not (seq-empty-p (i-ching-interpretation 49)))
(should-not (seq-empty-p (i-ching-interpretation "23")))
(should-not (seq-empty-p (i-ching-interpretation ""))))
(ert-deftest i-ching-queries () (ert-deftest i-ching-queries ()
(should (stringp (i-ching-query-string))) (should (stringp (i-ching-query-string)))