aboutsummaryrefslogtreecommitdiff
path: root/tests/test-integration-drill-session-simple-workflow-integration-test.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-27 21:40:43 -0500
committerCraig Jennings <c@cjennings.net>2026-05-27 21:40:43 -0500
commita2a7471f88a8c0f5c710d5ffb90511fc54b432d7 (patch)
treeff48348c21808986e5d196a68246781329c6dda8 /tests/test-integration-drill-session-simple-workflow-integration-test.el
parent6e3f2d278d9598c6838428ee510445f51888bb30 (diff)
downloadorg-drill-a2a7471f88a8c0f5c710d5ffb90511fc54b432d7.tar.gz
org-drill-a2a7471f88a8c0f5c710d5ffb90511fc54b432d7.zip
refactor: take card-state in org-drill-determine-next-interval-sm5
Stage 4 of #147. sm5 now takes (state quality of-matrix &optional delta-days) instead of nine positional args, binding the recall fields from the struct at the top so the algorithm body is unchanged. Both call-site branches pass the state they already hold, dropping the per-branch accessor unpacking. The testutil adapter test-scheduler--call-sm5 keeps the sm5 test calls a one-symbol rename per site. I also kept the return as the existing list, matching the stage-3 refinement: the goal is reducing the input signature, and changing the return shape would force the shared return-extractors and every return-read to change for no real gain. Also folds in two stage-3 follow-ons I missed when sm2 landed: a direct sm5 call in tests/test-org-drill-small-branch-coverage.el now uses the new struct API inline, and five direct sm2 calls in the simple-workflow integration test now go through the testutil adapter (the integration file picks up the testutil-scheduler require). Caught by running make test-integration this stage, which I should have run on the sm2 stage.
Diffstat (limited to 'tests/test-integration-drill-session-simple-workflow-integration-test.el')
-rw-r--r--tests/test-integration-drill-session-simple-workflow-integration-test.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/test-integration-drill-session-simple-workflow-integration-test.el b/tests/test-integration-drill-session-simple-workflow-integration-test.el
index e6f0aae..f0335af 100644
--- a/tests/test-integration-drill-session-simple-workflow-integration-test.el
+++ b/tests/test-integration-drill-session-simple-workflow-integration-test.el
@@ -7,7 +7,7 @@
;; 1. Entry detection (org-drill-entry-p)
;; 2. Entry enumeration (org-drill-map-entries)
;; 3. Data retrieval (test-int--state-as-list (org-drill-get-item-data))
-;; 4. Scheduling algorithm (org-drill-determine-next-interval-sm2)
+;; 4. Scheduling algorithm (test-scheduler--call-sm2)
;; 5. Data storage (org-drill-store-item-data)
;;
;; This test uses actual org-mode buffers with drill entries to verify
@@ -19,6 +19,10 @@
(require 'assess)
(require 'org-drill)
+(add-to-list 'load-path
+ (file-name-directory (or load-file-name buffer-file-name)))
+(require 'testutil-scheduler)
+
;;; Helpers
(defun test-int--state-as-list (state)
@@ -195,7 +199,7 @@ Verifies integration between data retrieval and SM2 algorithm."
(test-int--state-as-list (org-drill-get-item-data))
;; Simulate quality rating of 4 (good recall)
(let* ((quality 4)
- (result (org-drill-determine-next-interval-sm2
+ (result (test-scheduler--call-sm2
last-interval repeats ease quality
failures meanq total-repeats))
(next-interval (nth 0 result))
@@ -220,7 +224,7 @@ Verifies that failure handling works correctly in integrated workflow."
(test-int--state-as-list (org-drill-get-item-data))
;; Simulate complete failure (quality 0)
(let* ((quality 0)
- (result (org-drill-determine-next-interval-sm2
+ (result (test-scheduler--call-sm2
last-interval repeats ease quality
failures meanq total-repeats))
(next-interval (nth 0 result))
@@ -249,7 +253,7 @@ Verifies org-drill-store-item-data updates properties correctly."
;; Calculate new scheduling data
(let* ((quality 5) ; Perfect recall
- (result (org-drill-determine-next-interval-sm2
+ (result (test-scheduler--call-sm2
last-interval repeats ease quality
failures meanq total-repeats))
(next-interval (nth 0 result))
@@ -339,7 +343,7 @@ Simulates reviewing a card and verifies all components work together."
;; Step 4: Simulate review with quality 4
(let* ((quality 4)
- (result (org-drill-determine-next-interval-sm2
+ (result (test-scheduler--call-sm2
last-interval repeats ease quality
failures meanq total-repeats))
(next-interval (nth 0 result))
@@ -459,7 +463,7 @@ Question content.
;; Verify scheduling can handle extreme values
(cl-destructuring-bind (last-interval repeats failures total-repeats meanq ease)
data
- (let ((result (org-drill-determine-next-interval-sm2
+ (let ((result (test-scheduler--call-sm2
last-interval repeats ease 4
failures meanq total-repeats)))
(should (listp result)))))))))