1 ;;; inplace-tests.el -- Regression Tests for in-place mapping
2 ;; Copyright (C) 2006 Sebastian Freundt
4 ;; Author: Sebastian Freundt <hroptatyr@sxemacs.org>
7 ;; This file is part of SXEmacs.
9 ;; SXEmacs is free software: you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published by the
11 ;; Free Software Foundation, either version 3 of the License, or (at your
12 ;; option) any later version.
14 ;; SXEmacs is distributed in the hope that it will be
15 ;; useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ;;; Synched up with: Not in FSF.
26 ;; See test-harness.el for instructions on how to run these tests.
30 (require 'test-harness)
33 (when (and (boundp 'load-file-name) (stringp load-file-name))
34 (push (file-name-directory load-file-name) load-path))
35 (require 'test-harness))))
37 (let ((ilist '(1 2 3 4))
38 (idllist (dllist 1 2 3 4))
41 (ibvec (bit-vector 0 1 0 1 1)))
43 (mapc-inplace #'1+ ilist)
44 (Assert (listp ilist))
45 (Assert (= (nth 0 ilist) 2))
46 (Assert (= (nth 3 ilist) 5))
48 (mapc-inplace #'1- idllist)
49 (Assert (dllistp idllist))
50 (Assert (= (dllist-car idllist) 0))
51 (Assert (= (dllist-rac idllist) 3))
53 (mapc-inplace #'evenp ivector)
54 (Assert (vectorp ivector))
55 (Assert (equal ivector [nil t nil t]))
57 ;; we can't test strings at the moment
59 (mapc-inplace #'zerop ibvec)
60 (Assert (bit-vector-p ibvec))
61 (Assert (= (aref ibvec 0) 1))
62 (Assert (= (aref ibvec 1) 0))
63 (Assert (= (aref ibvec 2) 1))
64 (Assert (= (aref ibvec 3) 0))
65 (Assert (= (aref ibvec 4) 0))
69 ;;; inplace-tests.el ends here