]> code.delx.au - gnu-emacs/blob - test/automated/fns-tests.el
* tests/automated/fns-tests.el: New file.
[gnu-emacs] / test / automated / fns-tests.el
1 ;;; fns-tests.el --- tests for src/fns.c
2
3 ;; Copyright (C) 2014 Free Software Foundation, Inc.
4
5 ;; This file is part of GNU Emacs.
6
7 ;; This program is free software: you can redistribute it and/or
8 ;; modify it under the terms of the GNU General Public License as
9 ;; published by the Free Software Foundation, either version 3 of the
10 ;; License, or (at your option) any later version.
11 ;;
12 ;; This program is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
16 ;;
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see `http://www.gnu.org/licenses/'.
19
20 ;;; Commentary:
21
22 ;;; Code:
23
24 (require 'cl-lib)
25 (eval-when-compile (require 'cl))
26
27 (ert-deftest fns-tests-reverse ()
28 (should-error (reverse))
29 (should-error (reverse 1))
30 (should-error (reverse (make-char-table 'foo)))
31 (should (equal [1 2 3 4] (reverse (reverse [1 2 3 4]))))
32 (should (equal "xyzzy" (reverse (reverse "xyzzy"))))
33 (should (equal "こんにちは / コンニチハ" (reverse (reverse "こんにちは / コンニチハ")))))
34
35 (ert-deftest fns-tests-reverse-bool-vector ()
36 (let ((A (make-bool-vector 10 nil)))
37 (dotimes (i 5) (aset A i t))
38 (should (equal [nil nil nil nil nil t t t t t] (vconcat (reverse A))))
39 (should (equal A (reverse (reverse A))))))