Alexander Adolf <alexander.ad...@condition-alpha.com> writes: > 4 unexpected results: > FAILED ob-calc/matrix-inversion ((should (equal "[[-1, 0.625, -0.125], > [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" (org-babel-execute-src-block))) > :form (equal "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, > -0.125]]" "[[-1, 625e-3, -125e-3], [250e-3, -500e-3, 250e-3], [500e-3, > 125e-3, -125e-3]]") :value nil :explanation (arrays-of-different-length 63 77 > "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" "[[-1, > 625e-3, -125e-3], [250e-3, -500e-3, 250e-3], [500e-3, 125e-3, -125e-3]]" > first-mismatch-at 6))
Will the failure disappear if you try the attached patch?
>From fb317be318aaf32104e9334d34813681c26ac240 Mon Sep 17 00:00:00 2001 Message-ID: <fb317be318aaf32104e9334d34813681c26ac240.1714651740.git.yanta...@posteo.net> From: Ihor Radchenko <yanta...@posteo.net> Date: Thu, 2 May 2024 15:07:12 +0300 Subject: [PATCH] ob-calc/matrix-inversion: Force `calc-float-format' in the test * testing/lisp/test-ob-calc.el (ob-calc/matrix-inversion): When testing, make sure that calc output follows the expected format. This is needed on MacOS where Emacs defaults are not exactly the same. Reported-by: Alexander Adolf <alexander.ad...@condition-alpha.com> Link: https://list.orgmode.org/orgmode/91dfeb0fed1a1fe0564e5eb9b95a4...@condition-alpha.com/ --- testing/lisp/test-ob-calc.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testing/lisp/test-ob-calc.el b/testing/lisp/test-ob-calc.el index 6d6ca104d..e5f2cee0b 100644 --- a/testing/lisp/test-ob-calc.el +++ b/testing/lisp/test-ob-calc.el @@ -59,7 +59,14 @@ (ert-deftest ob-calc/matrix-inversion () inv(a) #+END_SRC " (should (equal "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" - (org-babel-execute-src-block))))) + (let ((calc-float-format '(float 0))) + ;; ;; Make sure that older Calc buffers are not present. + (save-current-buffer + (when (ignore-errors (calc-select-buffer)) + (kill-buffer))) + ;; Now, let-bound `calc-float-format' will take + ;; effect. + (org-babel-execute-src-block)))))) (ert-deftest ob-calc/matrix-algebra () "Test of simple matrix algebra." -- 2.44.0
-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>