aboutsummaryrefslogtreecommitdiff
path: root/tests/test-org-drill-determine-next-interval-sm2.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 18:09:21 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 18:09:21 -0500
commit1338b2ae757b7143fe4d211fc5a354c73cee526b (patch)
treed9b1afbc6b15754439314ad47cbcc053ad9d3598 /tests/test-org-drill-determine-next-interval-sm2.el
parent1a53381a176e99f5c7f9bed1589dbaf689f38390 (diff)
downloadorg-drill-1338b2ae757b7143fe4d211fc5a354c73cee526b.tar.gz
org-drill-1338b2ae757b7143fe4d211fc5a354c73cee526b.zip
chore: coverage, autoload fix, and internal cleanup for org-drill
A batch of test-coverage and hardening work, squashed from the test-work branch. Tests: deduplicated a colliding leitner-capture test name so make test-name loads again. Added SM2 assert-failure cases, the six basic multicloze variant delegations, the three English-side spanish-verb branches, and org-drill-current-scope branch coverage. Fix: the entry-point commands (org-drill itself, cram-tree, tree, directory, resume, relearn-item, strip-all-data, merge-buffers) carried no autoload cookies, so M-x failed from a fresh install until something pulled the file in. They're autoloaded now. Perf: org-drill-shuffle was quadratic because it indexed a list with elt on every swap. It runs a linear Fisher-Yates pass over a vector now, and it checks its argument is a list. Feat: added org-drill-version, a constant plus an interactive command, so a bug reporter doesn't have to open the file header. Refactor: extracted org-drill--format-tense-mood, shared by the two verb-conjugation presenters that each carried a copy. Docs: explained the SM8 magic numbers in the simple8 helpers as empirical fits rather than tunable knobs.
Diffstat (limited to 'tests/test-org-drill-determine-next-interval-sm2.el')
-rw-r--r--tests/test-org-drill-determine-next-interval-sm2.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test-org-drill-determine-next-interval-sm2.el b/tests/test-org-drill-determine-next-interval-sm2.el
index 622744d..3bf5cf3 100644
--- a/tests/test-org-drill-determine-next-interval-sm2.el
+++ b/tests/test-org-drill-determine-next-interval-sm2.el
@@ -417,5 +417,26 @@ Simulates inconsistent learning."
(should (= interval-2 -1))
(should (= failures-2 1))))
+;;; Error Cases - cl-assert invariant violations
+
+;; The function asserts (> n 0) and (and (>= quality 0) (<= quality 5)).
+;; n is normalized from 0 to 1 first, so only a negative n trips its assert.
+
+(ert-deftest test-org-drill-determine-next-interval-sm2-error-quality-above-max ()
+ "Quality above the 0-5 range trips the quality assertion."
+ (should-error (org-drill-determine-next-interval-sm2 1 2 2.5 6 0 4.0 1)
+ :type 'cl-assertion-failed))
+
+(ert-deftest test-org-drill-determine-next-interval-sm2-error-quality-below-min ()
+ "Quality below the 0-5 range trips the quality assertion."
+ (should-error (org-drill-determine-next-interval-sm2 1 2 2.5 -1 0 4.0 1)
+ :type 'cl-assertion-failed))
+
+(ert-deftest test-org-drill-determine-next-interval-sm2-error-negative-n ()
+ "A negative repeat count trips the (> n 0) assertion. Note n=0 is
+normalized to 1 before the assert, so zero is not an error case."
+ (should-error (org-drill-determine-next-interval-sm2 1 -1 2.5 4 0 4.0 1)
+ :type 'cl-assertion-failed))
+
(provide 'test-org-drill-determine-next-interval-sm2)
;;; test-org-drill-determine-next-interval-sm2.el ends here