Initial git import
[sxemacs] / tests / automated / ase-permutation-tests.el
1 ;;;  ase-tests.el -- Tests for ASE
2 ;; Copyright (C) 2006, 2007 Sebastian Freundt
3 ;;
4 ;; Author: Sebastian Freundt <hroptatyr@sxemacs.org>
5 ;; Keywords: tests
6 ;;
7 ;; This file is part of SXEmacs.
8 ;;
9 ;; Redistribution and use in source and binary forms, with or without
10 ;; modification, are permitted provided that the following conditions
11 ;; are met:
12 ;;
13 ;; 1. Redistributions of source code must retain the above copyright
14 ;;    notice, this list of conditions and the following disclaimer.
15 ;;
16 ;; 2. Redistributions in binary form must reproduce the above copyright
17 ;;    notice, this list of conditions and the following disclaimer in the
18 ;;    documentation and/or other materials provided with the distribution.
19 ;;
20 ;; 3. Neither the name of the author nor the names of any contributors
21 ;;    may be used to endorse or promote products derived from this
22 ;;    software without specific prior written permission.
23 ;;
24 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
25 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 ;; DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ;;
36 ;;; Synched up with: Not in FSF.
37
38 ;;; Commentary:
39 ;; See test-harness.el for instructions on how to run these tests.
40
41 (eval-when-compile
42   (condition-case nil
43       (require 'test-harness)
44     (file-error
45      (push "." load-path)
46      (when (and (boundp 'load-file-name) (stringp load-file-name))
47        (push (file-name-directory load-file-name) load-path))
48      (require 'test-harness))))
49
50 ;;;###eval-me-first
51 (and (featurep 'modules)
52      (locate-module "ase-permutation")
53      (require 'ase-permutation))
54
55 (when (featurep 'ase-permutation)
56   (Assert ase-identity-permutation)
57   (Assert (ase-permutation [2 3 1]))
58   (Assert (ase-permutation [1 3 2 4 6 5]))
59
60   ;; testing the read syntax
61   ;; can't test it with test-harness atm, because they read the buffer
62   ;; using #'read which does not allow for changing the scanner+parser
63   ;; while scanning and parsing
64   ;;
65   ;; #p[1 3 2]
66   ;;
67   ;; #p[(1 2) (6 3 7)]
68   ;; #p[(1 2 4) (6 3 7)]
69   ;; #p[(1 2) (6 3 4 5 7)]
70   ;; #p[(1 2 4 5) (6 3 7)]
71   ;;
72   ;; #p[2 4 7 5 1 3 6]
73   ;; #p[(4 5 1 2) (6 3 7)]
74   ;;
75   ;; #p[(1 2 3) (2 4 5)]
76   )
77 ;; ase-permutation-tests.el ends here