aboutsummaryrefslogtreecommitdiff
path: root/tests/test-org-drill-determine-next-interval-sm5.el
Commit message (Collapse)AuthorAgeFilesLines
* refactor: take card-state in org-drill-determine-next-interval-sm5Craig Jennings2026-05-271-37/+37
| | | | | | | | 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.
* ci: drop Emacs 28.2 from matrix; skip cl-assert tests on Emacs 29Craig Jennings2026-05-051-8/+9
| | | | | | | | | | | | | | | | | | | | | | | Two pragmatic changes after watching CI fail repeatedly: CI matrix: dropped 28.2. Emacs 28 ships Org 9.5; Cask is supposed to pull our declared org>=9.6 over the built-in but doesn't reliably in this CI setup, and several test categories use APIs/behaviors (cl-letf on signal-hook-function, eieio idioms, modern org-fold-*) that don't quite work on 28. Practical floor is now Emacs 29 (ships Org 9.6 built-in). Matrix is 29.4 + snapshot. Scheduler error tests: added skip-unless (>= emacs-major-version 30) to the test-scheduler--should-cl-assert helper in both simple8 and sm5 test files. ERT 29 installs an aggressive signal-hook-function around the entire ert-deftest body that intercepts every signal before any inner condition-case runs; shadowing the hook locally doesn't help (verified across four attempts). The eight cl-assert-precondition tests now run on Emacs 30+ where ERT's hook leaves inner condition-case alone, and skip on 29.x. All other tests still run on 29.4. Locally green. Pushing to verify CI.
* test: shadow signal-hook-function so cl-assertion-failed can be caughtCraig Jennings2026-05-051-5/+8
| | | | | | | | | | | | | | | | | | | | Attempt 4 at making the eight scheduler error tests pass on Emacs 29.4 in CI. The earlier approaches kept failing because ERT 29.4 installs ert--should-signal-hook as signal-hook-function around the entire ert-deftest body — not just inside should forms. That hook fires on every signal before any inner condition-case can catch it, which is why even a bare (condition-case ... (cl-assertion-failed nil)) at the top of the test body didn't work. The new helper rebinds signal-hook-function to nil inside its own let-scope, so condition-case catches the cl-assertion-failed signal normally. The ert-fail on the no-error path runs outside that shadowing scope, so it still routes through ERT's failure handling. Locally green; pushing to test 29.4 in CI.
* test: catch cl-assertion-failed by name without ERT should-wrappingCraig Jennings2026-05-051-8/+8
| | | | | | | | | | | | | | | | The previous fix wrapped condition-case in (should (eq 'caught ...)), but ERT in Emacs 29.4 installs signal-hook-function around should forms — that hook fires on every signal, intercepting them before the inner condition-case can catch. CI on 29.4 still failed. This iteration drops should entirely. Each test body becomes a plain condition-case at the top level: run the form, and if it returns normally, ert-fail. Catch cl-assertion-failed by name rather than via the error parent — its parent-class registration is inconsistent across Emacs versions, but the symbol-name match through condition-case always works. Locally green; let's see what 29.4 does with it.
* test: replace should-error with manual condition-case in scheduler error testsCraig Jennings2026-05-051-9/+16
| | | | | | | | | | | | | | | | | | | The :type 'cl-assertion-failed' fix didn't help — Emacs 29.4 in CI still marks the eight scheduler error tests as failures even though the cl-assertion-failed signal clearly fires (visible in the test-failure backtrace). Whatever ERT's should-error is doing in 29.4, it isn't accepting the signal as a pass. Replacing should-error with a manual condition-case wrapped in should sidesteps the fragility — we just verify SOMETHING was signalled, which is all the test ever needed. Extracted as a test-scheduler--should-cl-assert helper macro in each file (the two test files don't share infrastructure right now). Locally green; expected to clear the 29.4 CI failure.
* test: pin should-error type to cl-assertion-failed in scheduler error testsCraig Jennings2026-05-051-3/+6
| | | | | | | | | | | | | | | | | | CI on Emacs 29.4 failed eight scheduler :error: tests (5 in Simple8, 3 in SM5). All eight wrap a function call that violates a cl-assert precondition and use bare (should-error ...) to catch the resulting cl-assertion-failed signal. The same tests pass locally (Emacs 30.2) and in CI on Emacs snapshot. Hypothesis: in 29.4 cl-assertion-failed isn't registered with error as a parent class, so the default should-error filter (which catches type 'error') doesn't match. Adding an explicit :type 'cl-assertion-failed' tells should-error exactly what condition to expect, avoiding the inheritance-class question entirely. Locally still green; expected to clear the CI failure on the next push.
* refactor: extract shared scheduler test extractorsCraig Jennings2026-04-291-72/+46
| | | | | | | | Three test files (SM2, SM5, and the upcoming Simple8) all extract the same fields from a scheduler result list. Pull the shared extractors into tests/testutil-scheduler.el so each algorithm's test file can use them. Position 2 holds an EF in SM2 and SM5 and an EASE in Simple8. Both names are exposed as aliases pointing at the same nth position so each call site reads accurately. SM2 and SM5 test files now require testutil-scheduler and call the shared helpers. 69 of 69 scheduler tests still green. Full unit suite at 180 of 180.
* test: add SM5 scheduler testsCraig Jennings2026-04-291-0/+337
The SM5 algorithm at org-drill-determine-next-interval-sm5 had no direct test coverage. SM2 has 37 tests. SM5 has zero. Adds a per-function test file that mirrors the SM2 file's structure. 32 tests cover Normal, Boundary, Error, and algorithm-verification categories. The SM5-specific surface gets dedicated coverage. Failure preserves the input EF, not the modified one. The of-matrix is copied, not mutated. The four delta-days configurations (nil, positive, negative-with-flag, negative-without-flag) each take a different code path. The Error category includes should-error cases for the cl-assert preconditions on n and quality, which is a gap SM2's tests still have. All 32 pass on first run as characterization. Full suite at 180 of 180.