summaryrefslogtreecommitdiff
path: root/test/lisp/legacy/bytecomp-tests.el
diff options
context:
space:
mode:
authorPhillip Lord <phillip.lord@russet.org.uk>2015-11-23 22:02:42 +0000
committerPhillip Lord <phillip.lord@russet.org.uk>2015-11-24 17:04:22 +0000
commit22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e (patch)
tree779ff7e07667194416e01c6a6e8bd7b970244c70 /test/lisp/legacy/bytecomp-tests.el
parentc378d6c33f751d1a0b97958f3cacfe0b07c72f58 (diff)
downloademacs-22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e.tar.gz
emacs-22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e.tar.bz2
emacs-22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e.zip
Rename all test files to reflect source layout.
* CONTRIBUTE,Makefile.in,configure.ac: Update to reflect test directory moves. * test/file-organisation.org: New file. * test/automated/Makefile.in test/automated/data/decompress/foo.gz test/automated/data/epg/pubkey.asc test/automated/data/epg/seckey.asc test/automated/data/files-bug18141.el.gz test/automated/data/flymake/test.c test/automated/data/flymake/test.pl test/automated/data/package/archive-contents test/automated/data/package/key.pub test/automated/data/package/key.sec test/automated/data/package/multi-file-0.2.3.tar test/automated/data/package/multi-file-readme.txt test/automated/data/package/newer-versions/archive-contents test/automated/data/package/newer-versions/new-pkg-1.0.el test/automated/data/package/newer-versions/simple-single-1.4.el test/automated/data/package/package-test-server.py test/automated/data/package/signed/archive-contents test/automated/data/package/signed/archive-contents.sig test/automated/data/package/signed/signed-bad-1.0.el test/automated/data/package/signed/signed-bad-1.0.el.sig test/automated/data/package/signed/signed-good-1.0.el test/automated/data/package/signed/signed-good-1.0.el.sig test/automated/data/package/simple-depend-1.0.el test/automated/data/package/simple-single-1.3.el test/automated/data/package/simple-single-readme.txt test/automated/data/package/simple-two-depend-1.1.el test/automated/abbrev-tests.el test/automated/auto-revert-tests.el test/automated/calc-tests.el test/automated/icalendar-tests.el test/automated/character-fold-tests.el test/automated/comint-testsuite.el test/automated/descr-text-test.el test/automated/electric-tests.el test/automated/cl-generic-tests.el test/automated/cl-lib-tests.el test/automated/eieio-test-methodinvoke.el test/automated/eieio-test-persist.el test/automated/eieio-tests.el test/automated/ert-tests.el test/automated/ert-x-tests.el test/automated/generator-tests.el test/automated/let-alist.el test/automated/map-tests.el test/automated/advice-tests.el test/automated/package-test.el test/automated/pcase-tests.el test/automated/regexp-tests.el test/automated/seq-tests.el test/automated/subr-x-tests.el test/automated/tabulated-list-test.el test/automated/thunk-tests.el test/automated/timer-tests.el test/automated/epg-tests.el test/automated/eshell.el test/automated/faces-tests.el test/automated/file-notify-tests.el test/automated/auth-source-tests.el test/automated/gnus-tests.el test/automated/message-mode-tests.el test/automated/help-fns.el test/automated/imenu-test.el test/automated/info-xref.el test/automated/mule-util.el test/automated/isearch-tests.el test/automated/json-tests.el test/automated/bytecomp-tests.el test/automated/coding-tests.el test/automated/core-elisp-tests.el test/automated/decoder-tests.el test/automated/files.el test/automated/font-parse-tests.el test/automated/lexbind-tests.el test/automated/occur-tests.el test/automated/process-tests.el test/automated/syntax-tests.el test/automated/textprop-tests.el test/automated/undo-tests.el test/automated/man-tests.el test/automated/completion-tests.el test/automated/dbus-tests.el test/automated/newsticker-tests.el test/automated/sasl-scram-rfc-tests.el test/automated/tramp-tests.el test/automated/obarray-tests.el test/automated/compile-tests.el test/automated/elisp-mode-tests.el test/automated/f90.el test/automated/flymake-tests.el test/automated/python-tests.el test/automated/ruby-mode-tests.el test/automated/subword-tests.el test/automated/replace-tests.el test/automated/simple-test.el test/automated/sort-tests.el test/automated/subr-tests.el test/automated/reftex-tests.el test/automated/sgml-mode-tests.el test/automated/tildify-tests.el test/automated/thingatpt.el test/automated/url-future-tests.el test/automated/url-util-tests.el test/automated/add-log-tests.el test/automated/vc-bzr.el test/automated/vc-tests.el test/automated/xml-parse-tests.el test/BidiCharacterTest.txt test/biditest.el test/cedet/cedet-utests.el test/cedet/ede-tests.el test/cedet/semantic-ia-utest.el test/cedet/semantic-tests.el test/cedet/semantic-utest-c.el test/cedet/semantic-utest.el test/cedet/srecode-tests.el test/cedet/tests/test.c test/cedet/tests/test.el test/cedet/tests/test.make test/cedet/tests/testdoublens.cpp test/cedet/tests/testdoublens.hpp test/cedet/tests/testfriends.cpp test/cedet/tests/testjavacomp.java test/cedet/tests/testnsp.cpp test/cedet/tests/testpolymorph.cpp test/cedet/tests/testspp.c test/cedet/tests/testsppcomplete.c test/cedet/tests/testsppreplace.c test/cedet/tests/testsppreplaced.c test/cedet/tests/testsubclass.cpp test/cedet/tests/testsubclass.hh test/cedet/tests/testtypedefs.cpp test/cedet/tests/testvarnames.c test/etags/CTAGS.good test/etags/ETAGS.good_1 test/etags/ETAGS.good_2 test/etags/ETAGS.good_3 test/etags/ETAGS.good_4 test/etags/ETAGS.good_5 test/etags/ETAGS.good_6 test/etags/a-src/empty.zz test/etags/a-src/empty.zz.gz test/etags/ada-src/2ataspri.adb test/etags/ada-src/2ataspri.ads test/etags/ada-src/etags-test-for.ada test/etags/ada-src/waroquiers.ada test/etags/c-src/a/b/b.c test/etags/c-src/abbrev.c test/etags/c-src/c.c test/etags/c-src/dostorture.c test/etags/c-src/emacs/src/gmalloc.c test/etags/c-src/emacs/src/keyboard.c test/etags/c-src/emacs/src/lisp.h test/etags/c-src/emacs/src/regex.h test/etags/c-src/etags.c test/etags/c-src/exit.c test/etags/c-src/exit.strange_suffix test/etags/c-src/fail.c test/etags/c-src/getopt.h test/etags/c-src/h.h test/etags/c-src/machsyscalls.c test/etags/c-src/machsyscalls.h test/etags/c-src/sysdep.h test/etags/c-src/tab.c test/etags/c-src/torture.c test/etags/cp-src/MDiagArray2.h test/etags/cp-src/Range.h test/etags/cp-src/burton.cpp test/etags/cp-src/c.C test/etags/cp-src/clheir.cpp.gz test/etags/cp-src/clheir.hpp test/etags/cp-src/conway.cpp test/etags/cp-src/conway.hpp test/etags/cp-src/fail.C test/etags/cp-src/functions.cpp test/etags/cp-src/screen.cpp test/etags/cp-src/screen.hpp test/etags/cp-src/x.cc test/etags/el-src/TAGTEST.EL test/etags/el-src/emacs/lisp/progmodes/etags.el test/etags/erl-src/gs_dialog.erl test/etags/f-src/entry.for test/etags/f-src/entry.strange.gz test/etags/f-src/entry.strange_suffix test/etags/forth-src/test-forth.fth test/etags/html-src/algrthms.html test/etags/html-src/index.shtml test/etags/html-src/software.html test/etags/html-src/softwarelibero.html test/etags/lua-src/allegro.lua test/etags/objc-src/PackInsp.h test/etags/objc-src/PackInsp.m test/etags/objc-src/Subprocess.h test/etags/objc-src/Subprocess.m test/etags/objcpp-src/SimpleCalc.H test/etags/objcpp-src/SimpleCalc.M test/etags/pas-src/common.pas test/etags/perl-src/htlmify-cystic test/etags/perl-src/kai-test.pl test/etags/perl-src/yagrip.pl test/etags/php-src/lce_functions.php test/etags/php-src/ptest.php test/etags/php-src/sendmail.php test/etags/prol-src/natded.prolog test/etags/prol-src/ordsets.prolog test/etags/ps-src/rfc1245.ps test/etags/pyt-src/server.py test/etags/tex-src/gzip.texi test/etags/tex-src/nonewline.tex test/etags/tex-src/testenv.tex test/etags/tex-src/texinfo.tex test/etags/y-src/atest.y test/etags/y-src/cccp.c test/etags/y-src/cccp.y test/etags/y-src/parse.c test/etags/y-src/parse.y test/indent/css-mode.css test/indent/js-indent-init-dynamic.js test/indent/js-indent-init-t.js test/indent/js-jsx.js test/indent/js.js test/indent/latex-mode.tex test/indent/modula2.mod test/indent/nxml.xml test/indent/octave.m test/indent/pascal.pas test/indent/perl.perl test/indent/prolog.prolog test/indent/ps-mode.ps test/indent/ruby.rb test/indent/scheme.scm test/indent/scss-mode.scss test/indent/sgml-mode-attribute.html test/indent/shell.rc test/indent/shell.sh test/redisplay-testsuite.el test/rmailmm.el test/automated/buffer-tests.el test/automated/cmds-tests.el test/automated/data-tests.el test/automated/finalizer-tests.el test/automated/fns-tests.el test/automated/inotify-test.el test/automated/keymap-tests.el test/automated/print-tests.el test/automated/libxml-tests.el test/automated/zlib-tests.el: Files Moved.
Diffstat (limited to 'test/lisp/legacy/bytecomp-tests.el')
-rw-r--r--test/lisp/legacy/bytecomp-tests.el429
1 files changed, 429 insertions, 0 deletions
diff --git a/test/lisp/legacy/bytecomp-tests.el b/test/lisp/legacy/bytecomp-tests.el
new file mode 100644
index 00000000000..c65009cb1b0
--- /dev/null
+++ b/test/lisp/legacy/bytecomp-tests.el
@@ -0,0 +1,429 @@
+;;; bytecomp-testsuite.el
+
+;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
+
+;; Author: Shigeru Fukaya <shigeru.fukaya@gmail.com>
+;; Created: November 2008
+;; Keywords: internal
+;; Human-Keywords: internal
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+(require 'ert)
+
+;;; Code:
+(defconst byte-opt-testsuite-arith-data
+ '(
+ ;; some functional tests
+ (let ((a most-positive-fixnum) (b 1) (c 1.0)) (+ a b c))
+ (let ((a most-positive-fixnum) (b -2) (c 1.0)) (- a b c))
+ (let ((a most-positive-fixnum) (b 2) (c 1.0)) (* a b c))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b c))
+ (let ((a (+ 1 (expt 2 -64))) (b (expt 2 -65))) (+ a -1 b))
+ (let ((a (+ 1 (expt 2 -64))) (b (expt 2 -65))) (- a 1 (- b)))
+ ;; This fails. Should it be a bug?
+ ;; (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))
+ (let ((a 1.0)) (* a 0))
+ (let ((a 1.0)) (* a 2.0 0))
+ (let ((a 1.0)) (/ 0 a))
+ (let ((a 1.0)) (/ 3 a 2))
+ (let ((a most-positive-fixnum) (b 2.0)) (* a 2 b))
+ (let ((a 3) (b 2)) (/ a b 1.0))
+ (/ 3 -1)
+ (+ 4 3 2 1)
+ (+ 4 3 2.0 1)
+ (- 4 3 2 1) ; not new, for reference
+ (- 4 3 2.0 1) ; not new, for reference
+ (* 4 3 2 1)
+ (* 4 3 2.0 1)
+ (/ 4 3 2 1)
+ (/ 4 3 2.0 1)
+ (let ((a 3) (b 2)) (+ a b 1))
+ (let ((a 3) (b 2)) (+ a b -1))
+ (let ((a 3) (b 2)) (- a b 1))
+ (let ((a 3) (b 2)) (- a b -1))
+ (let ((a 3) (b 2)) (+ a b a 1))
+ (let ((a 3) (b 2)) (+ a b a -1))
+ (let ((a 3) (b 2)) (- a b a 1))
+ (let ((a 3) (b 2)) (- a b a -1))
+ (let ((a 3) (b 2)) (* a b -1))
+ (let ((a 3) (b 2)) (* a -1))
+ (let ((a 3) (b 2)) (/ a b 1))
+ (let ((a 3) (b 2)) (/ (+ a b) 1))
+
+ ;; coverage test
+ (let ((a 3) (b 2) (c 1.0)) (+))
+ (let ((a 3) (b 2) (c 1.0)) (+ 2))
+ (let ((a 3) (b 2) (c 1.0)) (+ 2 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 2 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 2.0 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 2.0 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 2))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0.0 2))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0.0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ a))
+ (let ((a 3) (b 2) (c 1.0)) (+ a 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ a 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0.0 a))
+ (let ((a 3) (b 2) (c 1.0)) (+ c 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ c 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 c))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0.0 c))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b 0 c 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 a b))
+ (let ((a 3) (b 2) (c 1.0)) (+ 0 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (+ 1 2 3))
+ (let ((a 3) (b 2) (c 1.0)) (+ 3.0 2.0 1))
+ (let ((a 3) (b 2) (c 1.0)) (+ 3.0 2.0 1 4))
+ (let ((a 3) (b 2) (c 1.0)) (+ a 1))
+ (let ((a 3) (b 2) (c 1.0)) (+ a -1))
+ (let ((a 3) (b 2) (c 1.0)) (+ 1 a))
+ (let ((a 3) (b 2) (c 1.0)) (+ -1 a))
+ (let ((a 3) (b 2) (c 1.0)) (+ c 1))
+ (let ((a 3) (b 2) (c 1.0)) (+ c -1))
+ (let ((a 3) (b 2) (c 1.0)) (+ 1 c))
+ (let ((a 3) (b 2) (c 1.0)) (+ -1 c))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b 1))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b -1))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b 2))
+ (let ((a 3) (b 2) (c 1.0)) (+ 1 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b c 0))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b c 1))
+ (let ((a 3) (b 2) (c 1.0)) (+ a b c -1))
+
+ (let ((a 3) (b 2) (c 1.0)) (-))
+ (let ((a 3) (b 2) (c 1.0)) (- 2))
+ (let ((a 3) (b 2) (c 1.0)) (- 2 0))
+ (let ((a 3) (b 2) (c 1.0)) (- 2 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (- 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (- 2.0 0))
+ (let ((a 3) (b 2) (c 1.0)) (- 2.0 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 2))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (- 0.0 2))
+ (let ((a 3) (b 2) (c 1.0)) (- 0.0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (- a))
+ (let ((a 3) (b 2) (c 1.0)) (- a 0))
+ (let ((a 3) (b 2) (c 1.0)) (- a 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (- 0.0 a))
+ (let ((a 3) (b 2) (c 1.0)) (- c 0))
+ (let ((a 3) (b 2) (c 1.0)) (- c 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 c))
+ (let ((a 3) (b 2) (c 1.0)) (- 0.0 c))
+ (let ((a 3) (b 2) (c 1.0)) (- a b 0 c 0))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 a b))
+ (let ((a 3) (b 2) (c 1.0)) (- 0 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (- 1 2 3))
+ (let ((a 3) (b 2) (c 1.0)) (- 3.0 2.0 1))
+ (let ((a 3) (b 2) (c 1.0)) (- 3.0 2.0 1 4))
+ (let ((a 3) (b 2) (c 1.0)) (- a 1))
+ (let ((a 3) (b 2) (c 1.0)) (- a -1))
+ (let ((a 3) (b 2) (c 1.0)) (- 1 a))
+ (let ((a 3) (b 2) (c 1.0)) (- -1 a))
+ (let ((a 3) (b 2) (c 1.0)) (- c 1))
+ (let ((a 3) (b 2) (c 1.0)) (- c -1))
+ (let ((a 3) (b 2) (c 1.0)) (- 1 c))
+ (let ((a 3) (b 2) (c 1.0)) (- -1 c))
+ (let ((a 3) (b 2) (c 1.0)) (- a b 0))
+ (let ((a 3) (b 2) (c 1.0)) (- a b 1))
+ (let ((a 3) (b 2) (c 1.0)) (- a b -1))
+ (let ((a 3) (b 2) (c 1.0)) (- a b 2))
+ (let ((a 3) (b 2) (c 1.0)) (- 1 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (- a b c 0))
+ (let ((a 3) (b 2) (c 1.0)) (- a b c 1))
+ (let ((a 3) (b 2) (c 1.0)) (- a b c -1))
+
+ (let ((a 3) (b 2) (c 1.0)) (*))
+ (let ((a 3) (b 2) (c 1.0)) (* 2))
+ (let ((a 3) (b 2) (c 1.0)) (* 2 0))
+ (let ((a 3) (b 2) (c 1.0)) (* 2 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (* 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (* 2.0 0))
+ (let ((a 3) (b 2) (c 1.0)) (* 2.0 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 2))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (* 0.0 2))
+ (let ((a 3) (b 2) (c 1.0)) (* 0.0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (* a))
+ (let ((a 3) (b 2) (c 1.0)) (* a 0))
+ (let ((a 3) (b 2) (c 1.0)) (* a 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (* 0.0 a))
+ (let ((a 3) (b 2) (c 1.0)) (* c 0))
+ (let ((a 3) (b 2) (c 1.0)) (* c 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 c))
+ (let ((a 3) (b 2) (c 1.0)) (* 0.0 c))
+ (let ((a 3) (b 2) (c 1.0)) (* a b 0 c 0))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 a b))
+ (let ((a 3) (b 2) (c 1.0)) (* 0 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (* 1 2 3))
+ (let ((a 3) (b 2) (c 1.0)) (* 3.0 2.0 1))
+ (let ((a 3) (b 2) (c 1.0)) (* 3.0 2.0 1 4))
+ (let ((a 3) (b 2) (c 1.0)) (* a 1))
+ (let ((a 3) (b 2) (c 1.0)) (* a -1))
+ (let ((a 3) (b 2) (c 1.0)) (* 1 a))
+ (let ((a 3) (b 2) (c 1.0)) (* -1 a))
+ (let ((a 3) (b 2) (c 1.0)) (* c 1))
+ (let ((a 3) (b 2) (c 1.0)) (* c -1))
+ (let ((a 3) (b 2) (c 1.0)) (* 1 c))
+ (let ((a 3) (b 2) (c 1.0)) (* -1 c))
+ (let ((a 3) (b 2) (c 1.0)) (* a b 0))
+ (let ((a 3) (b 2) (c 1.0)) (* a b 1))
+ (let ((a 3) (b 2) (c 1.0)) (* a b -1))
+ (let ((a 3) (b 2) (c 1.0)) (* a b 2))
+ (let ((a 3) (b 2) (c 1.0)) (* 1 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (* a b c 0))
+ (let ((a 3) (b 2) (c 1.0)) (* a b c 1))
+ (let ((a 3) (b 2) (c 1.0)) (* a b c -1))
+
+ (let ((a 3) (b 2) (c 1.0)) (/))
+ (let ((a 3) (b 2) (c 1.0)) (/ 2))
+ (let ((a 3) (b 2) (c 1.0)) (/ 2 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 2 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 2.0 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 2.0 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 2))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0.0 2))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0.0 2.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ a))
+ (let ((a 3) (b 2) (c 1.0)) (/ a 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ a 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0.0 a))
+ (let ((a 3) (b 2) (c 1.0)) (/ c 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ c 0.0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 c))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0.0 c))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b 0 c 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 a))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 a b))
+ (let ((a 3) (b 2) (c 1.0)) (/ 0 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (/ 1 2 3))
+ (let ((a 3) (b 2) (c 1.0)) (/ 3.0 2.0 1))
+ (let ((a 3) (b 2) (c 1.0)) (/ 3.0 2.0 1 4))
+ (let ((a 3) (b 2) (c 1.0)) (/ a 1))
+ (let ((a 3) (b 2) (c 1.0)) (/ a -1))
+ (let ((a 3) (b 2) (c 1.0)) (/ 1 a))
+ (let ((a 3) (b 2) (c 1.0)) (/ -1 a))
+ (let ((a 3) (b 2) (c 1.0)) (/ c 1))
+ (let ((a 3) (b 2) (c 1.0)) (/ c -1))
+ (let ((a 3) (b 2) (c 1.0)) (/ 1 c))
+ (let ((a 3) (b 2) (c 1.0)) (/ -1 c))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b 1))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b -1))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b 2))
+ (let ((a 3) (b 2) (c 1.0)) (/ 1 a b c))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b c 0))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b c 1))
+ (let ((a 3) (b 2) (c 1.0)) (/ a b c -1)))
+ "List of expression for test.
+Each element will be executed by interpreter and with
+bytecompiled code, and their results compared.")
+
+(defun bytecomp-check-1 (pat)
+ "Return non-nil if PAT is the same whether directly evalled or compiled."
+ (let ((warning-minimum-log-level :emergency)
+ (byte-compile-warnings nil)
+ (v0 (condition-case nil
+ (eval pat)
+ (error nil)))
+ (v1 (condition-case nil
+ (funcall (byte-compile (list 'lambda nil pat)))
+ (error nil))))
+ (equal v0 v1)))
+
+(put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1)
+
+(defun bytecomp-explain-1 (pat)
+ (let ((v0 (condition-case nil
+ (eval pat)
+ (error nil)))
+ (v1 (condition-case nil
+ (funcall (byte-compile (list 'lambda nil pat)))
+ (error nil))))
+ (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
+ pat v0 v1)))
+
+(ert-deftest bytecomp-tests ()
+ "Test the Emacs byte compiler."
+ (dolist (pat byte-opt-testsuite-arith-data)
+ (should (bytecomp-check-1 pat))))
+
+(defun test-byte-opt-arithmetic (&optional arg)
+ "Unit test for byte-opt arithmetic operations.
+Subtests signal errors if something goes wrong."
+ (interactive "P")
+ (switch-to-buffer (generate-new-buffer "*Font Pase Test*"))
+ (let ((warning-minimum-log-level :emergency)
+ (byte-compile-warnings nil)
+ (pass-face '((t :foreground "green")))
+ (fail-face '((t :foreground "red")))
+ (print-escape-nonascii t)
+ (print-escape-newlines t)
+ (print-quoted t)
+ v0 v1)
+ (dolist (pat byte-opt-testsuite-arith-data)
+ (condition-case nil
+ (setq v0 (eval pat))
+ (error (setq v0 nil)))
+ (condition-case nil
+ (setq v1 (funcall (byte-compile (list 'lambda nil pat))))
+ (error (setq v1 nil)))
+ (insert (format "%s" pat))
+ (indent-to-column 65)
+ (if (equal v0 v1)
+ (insert (propertize "OK" 'face pass-face))
+ (insert (propertize "FAIL\n" 'face fail-face))
+ (indent-to-column 55)
+ (insert (propertize (format "[%s] vs [%s]" v0 v1)
+ 'face fail-face)))
+ (insert "\n"))))
+
+(defun test-byte-comp-compile-and-load (compile &rest forms)
+ (let ((elfile nil)
+ (elcfile nil))
+ (unwind-protect
+ (progn
+ (setf elfile (make-temp-file "test-bytecomp" nil ".el"))
+ (when compile
+ (setf elcfile (make-temp-file "test-bytecomp" nil ".elc")))
+ (with-temp-buffer
+ (dolist (form forms)
+ (print form (current-buffer)))
+ (write-region (point-min) (point-max) elfile nil 'silent))
+ (if compile
+ (let ((byte-compile-dest-file-function
+ (lambda (e) elcfile)))
+ (byte-compile-file elfile t))
+ (load elfile nil 'nomessage)))
+ (when elfile (delete-file elfile))
+ (when elcfile (delete-file elcfile)))))
+(put 'test-byte-comp-compile-and-load 'lisp-indent-function 1)
+
+(ert-deftest test-byte-comp-macro-expansion ()
+ (test-byte-comp-compile-and-load t
+ '(progn (defmacro abc (arg) 1) (defun def () (abc 2))))
+ (should (equal (funcall 'def) 1)))
+
+(ert-deftest test-byte-comp-macro-expansion-eval-and-compile ()
+ (test-byte-comp-compile-and-load t
+ '(eval-and-compile (defmacro abc (arg) -1) (defun def () (abc 2))))
+ (should (equal (funcall 'def) -1)))
+
+(ert-deftest test-byte-comp-macro-expansion-eval-when-compile ()
+ ;; Make sure we interpret eval-when-compile forms properly. CLISP
+ ;; and SBCL interpreter eval-when-compile (well, the CL equivalent)
+ ;; in the same way.
+ (test-byte-comp-compile-and-load t
+ '(eval-when-compile
+ (defmacro abc (arg) -10)
+ (defun abc-1 () (abc 2)))
+ '(defmacro abc-2 () (abc-1))
+ '(defun def () (abc-2)))
+ (should (equal (funcall 'def) -10)))
+
+(ert-deftest test-byte-comp-macro-expand-lexical-override ()
+ ;; Intuitively, one might expect the defmacro to override the
+ ;; macrolet since macrolet's is explicitly called out as being
+ ;; equivalent to toplevel, but CLISP and SBCL both evaluate the form
+ ;; this way, so we should too.
+ (test-byte-comp-compile-and-load t
+ '(require 'cl-lib)
+ '(cl-macrolet ((m () 4))
+ (defmacro m () 5)
+ (defun def () (m))))
+ (should (equal (funcall 'def) 4)))
+
+(ert-deftest bytecomp-tests--warnings ()
+ (with-current-buffer (get-buffer-create "*Compile-Log*")
+ (let ((inhibit-read-only t)) (erase-buffer)))
+ (test-byte-comp-compile-and-load t
+ '(progn
+ (defun my-test0 ()
+ (my--test11 3)
+ (my--test12 3)
+ (my--test2 5))
+ (defmacro my--test11 (arg) (+ arg 1))
+ (eval-and-compile
+ (defmacro my--test12 (arg) (+ arg 1))
+ (defun my--test2 (arg) (+ arg 1)))))
+ (with-current-buffer (get-buffer-create "*Compile-Log*")
+ (goto-char (point-min))
+ ;; Should warn that mt--test1[12] are first used as functions.
+ ;; The second alternative is for when the file name is so long
+ ;; that pretty-printing starts the message on the next line.
+ (should (or (re-search-forward "my--test11:\n.*macro" nil t)
+ (re-search-forward "my--test11:\n.*:\n.*macro" nil t)))
+ (should (or (re-search-forward "my--test12:\n.*macro" nil t)
+ (re-search-forward "my--test12:\n.*:\n.*macro" nil t)))
+ (goto-char (point-min))
+ ;; Should not warn that mt--test2 is not known to be defined.
+ (should-not (re-search-forward "my--test2" nil t))))
+
+(ert-deftest test-eager-load-macro-expansion ()
+ (test-byte-comp-compile-and-load nil
+ '(progn (defmacro abc (arg) 1) (defun def () (abc 2))))
+ (should (equal (funcall 'def) 1)))
+
+(ert-deftest test-eager-load-macro-expansion-eval-and-compile ()
+ (test-byte-comp-compile-and-load nil
+ '(eval-and-compile (defmacro abc (arg) -1) (defun def () (abc 2))))
+ (should (equal (funcall 'def) -1)))
+
+(ert-deftest test-eager-load-macro-expansion-eval-when-compile ()
+ ;; Make sure we interpret eval-when-compile forms properly. CLISP
+ ;; and SBCL interpreter eval-when-compile (well, the CL equivalent)
+ ;; in the same way.
+ (test-byte-comp-compile-and-load nil
+ '(eval-when-compile
+ (defmacro abc (arg) -10)
+ (defun abc-1 () (abc 2)))
+ '(defmacro abc-2 () (abc-1))
+ '(defun def () (abc-2)))
+ (should (equal (funcall 'def) -10)))
+
+(ert-deftest test-eager-load-macro-expand-lexical-override ()
+ ;; Intuitively, one might expect the defmacro to override the
+ ;; macrolet since macrolet's is explicitly called out as being
+ ;; equivalent to toplevel, but CLISP and SBCL both evaluate the form
+ ;; this way, so we should too.
+ (test-byte-comp-compile-and-load nil
+ '(require 'cl-lib)
+ '(cl-macrolet ((m () 4))
+ (defmacro m () 5)
+ (defun def () (m))))
+ (should (equal (funcall 'def) 4)))
+
+
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
+
+(provide 'byte-opt-testsuite)
+