emacs-ironsworn/rpgdm-ironsworn-tests.el

66 lines
3.5 KiB
EmacsLisp
Raw Normal View History

(ert-deftest rpgdm-ironsworn--results-test ()
(should (equal (rpgdm-ironsworn--results 3 2 4 1)
"Strong hit :: 5 (3 + 2) → 4 / 1"))
(should (equal (rpgdm-ironsworn--results 3 2 8 1)
"Weak hit :: 5 (3 + 2) → 8 / 1"))
(should (equal (rpgdm-ironsworn--results 3 2 8 6)
"Miss :: 5 (3 + 2) → 8 / 6"))
(should (equal (rpgdm-ironsworn--results 3 2 6 6)
"Miss :: 5 (3 + 2) → 6 / 6 ← Create a Twist"))
(should (equal (rpgdm-ironsworn--results 3 2 8 6 7)
"Miss :: 5 (3 + 2) → 8 / 6 -- Burn momentum for a Weak hit"))
(should (equal (rpgdm-ironsworn--results 3 2 8 6 9)
"Miss :: 5 (3 + 2) → 8 / 6 -- Burn momentum for a Strong hit")))
(ert-deftest rpgdm-ironsworn--good-character-assets-test ()
(should (rpgdm-ironsworn--good-character-assets '("foo" "bar" "baz")))
(should-not (rpgdm-ironsworn--good-character-assets '("foo" "bar" "foo")))
(should-not (rpgdm-ironsworn--good-character-assets '("assets/companions/dog.org"
"assets/paths/good-guy.org"
"assets/companions/monkey.org")))
(should-not (rpgdm-ironsworn--good-character-assets '(("Companions :: Dog" . "assets/companions/dog.org")
("Paths :: Good Guy" . "assets/paths/good-guy.org")
("Companions :: Monkey" . "assets/companions/monkey.org")))))
(ert-deftest rpgdm-ironsworn--some-character-assets-test ()
(should (= 4 (seq-length (rpgdm-ironsworn--some-character-assets '(1 2 3 4 5 6) 4))))
(should (= 3 (seq-length (rpgdm-ironsworn--some-character-assets '(1 2 3 4 5 6))))))
(ert-deftest rpgdm-ironsworn--move-tuple-test ()
(let ((file "moves/fate/ask-the-oracle.org")
(full "~/other/over/here/moves/fate/ask-the-oracle.org"))
(should (equal (list "Fate :: ask the oracle" file)
(rpgdm-ironsworn--move-tuple file)))
(should (equal (list "Fate :: ask the oracle" full)
(rpgdm-ironsworn--move-tuple full)))))
(ert-deftest rpgdm-ironsworn-progress-level-label-test ()
(should (equal (rpgdm-ironsworn-progress-level-label 1) "epic"))
(should (equal (rpgdm-ironsworn-progress-level-label 12) "troublesome"))
(should (equal (rpgdm-ironsworn-progress-level-label 4) "formidable")))
(ert-deftest rpgdm-ironsworn-progress-test ()
(let ((track "Battling a Grue"))
(rpgdm-ironsworn-progress-delete track)
(rpgdm-ironsworn-progress-create track "Dangerous")
(should (= (rpgdm-ironsworn-progress-amount track) 0))
(rpgdm-ironsworn-progress-mark track)
(should (= (rpgdm-ironsworn-progress-amount track) 2))
(rpgdm-ironsworn-progress-mark track 2)
(should (= (rpgdm-ironsworn-progress-amount track) 6))))
(ert-deftest rpgdm-ironsworn-progress-test ()
(let ((track "Battling an Extreme Grue"))
(rpgdm-ironsworn-progress-delete track)
(rpgdm-ironsworn-progress-create track "Extreme")
(should (= (rpgdm-ironsworn-progress-amount track) 0))
(rpgdm-ironsworn-progress-mark track)
(should (= (rpgdm-ironsworn-progress-amount track) 0))
(rpgdm-ironsworn-progress-mark track 2)
(should (= (rpgdm-ironsworn-progress-amount track) 1))))
(ert-deftest rpgdm-ironsworn--progress-to-str-test ()
(should (equal (rpgdm-ironsworn--progress-to-str :IRONSWORN-PROGRESS-EPIC)
"ironsworn-progress-epic")))