From: Stefan Kangas Date: Mon, 17 Feb 2025 01:21:26 +0000 (+0100) Subject: Add test for zerop X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b434dbb51b6df0b013b470beae1743b07883cd60;p=emacs.git Add test for zerop * test/lisp/subr-tests.el (subr-test-zerop): New test. (cherry picked from commit f2fb19d008f57d83053e7981eecded6ace9ab6c7) --- diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 5b17c598efa..29767ed07b5 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -30,6 +30,21 @@ (require 'ert-x) (eval-when-compile (require 'cl-lib)) +(ert-deftest subr-test-zerop () + (should (zerop 0)) + (should (zerop 0.0)) + (should (zerop -0)) + (should (zerop -0.0)) + (should-not (zerop -0.0e+NaN)) + (should-not (zerop 0.0e+NaN)) + (should-not (zerop float-pi)) + (should-not (zerop 1.0e+INF)) + (should-not (zerop (random most-positive-fixnum))) + (should-not (zerop (- (random (- most-negative-fixnum))))) + (should-not (zerop (1+ most-positive-fixnum))) + (should-not (zerop (1- most-negative-fixnum))) + (should-error (zerop "-5") :type 'wrong-type-argument)) + (ert-deftest let-when-compile () ;; good case (should (equal (macroexpand '(let-when-compile ((foo (+ 2 3)))