summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-12-26 19:37:10 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2019-12-26 19:37:10 +0100
commitcd559841537726315d72a303447140f71e34f635 (patch)
tree144f2d9569876ecadc816192ea5b24ed599ca5b2 /test
parente8aa6f19e99e5de9a3953fef8ae50e2363531b3d (diff)
downloademacs-cd559841537726315d72a303447140f71e34f635.tar.gz
Calc: add missing dynamic variable declarations
* lisp/calc/calc-alg.el (math-simplify-only, calc-simplify-mode) (math-expand-formulas, calc-poly-div-remainder) (math-living-dangerously, math-simplifying, calc-angle-mode) (calc-prefer-frac, math-poly-base-variable): Declare dynamic variables. * test/lisp/calc/calc-tests.el (calc-poly-div): Add test for at least one bug caused by missing declarations.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calc/calc-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el
index 3f5adceeff1..33e6b14827f 100644
--- a/test/lisp/calc/calc-tests.el
+++ b/test/lisp/calc/calc-tests.el
@@ -318,6 +318,21 @@ An existing calc stack is reused, otherwise a new one is created."
'(vec (calcFunc-eq (var x var-x) 3)
(calcFunc-eq (var y var-y) 0)))))
+(ert-deftest calc-poly-div ()
+ "Test polynomial division, and that the remainder is recorded in the trail."
+ (with-current-buffer (calc-trail-buffer)
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+
+ (calc-eval "2x**3+1" 'push)
+ (calc-eval "x**2+2x" 'push)
+ (calc-poly-div nil)
+ (let ((tos (calc-top-n 1))
+ (trail (buffer-string)))
+ (calc-pop 0)
+ (should (equal tos '(- (* 2 (var x var-x)) 4)))
+ (should (equal trail "pdiv 2 * x - 4\nprem 8 * x + 1\n"))))))
+
(provide 'calc-tests)
;;; calc-tests.el ends here