1 ;;; ase-tests.el -- Tests for ASE
2 ;; Copyright (C) 2006, 2007 Sebastian Freundt
4 ;; Author: Sebastian Freundt <hroptatyr@sxemacs.org>
7 ;; This file is part of SXEmacs.
9 ;; Redistribution and use in source and binary forms, with or without
10 ;; modification, are permitted provided that the following conditions
13 ;; 1. Redistributions of source code must retain the above copyright
14 ;; notice, this list of conditions and the following disclaimer.
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.
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.
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.
36 ;;; Synched up with: Not in FSF.
39 ;; See test-harness.el for instructions on how to run these tests.
43 (require 'test-harness)
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))))
51 (and (featurep 'modules)
52 (locate-module "ase-resclass")
53 (require 'ase-resclass))
55 (when (featurep 'ase-resclass)
56 (let ((r1 (make-residue-class-ring 23))
58 (r2 (make-residue-class-ring 81))
61 ;; test the read syntax
62 ;;(eval `(Assert (eq ,r1 ,r1p))) ;; uh oh
64 (eval `(Assert (residue-class-p (+ (make-residue-class 1 ,r1)
65 (make-residue-class 4 ,r1)))))
66 (eval `(Assert (residue-class-p (+ (make-residue-class 1 ,r1) 4+23Z))))
67 (eval `(Assert (residue-class-p (+ (make-residue-class 1 ,r2) 4+81Z))))
68 (eval `(Assert (= 2+23Z (make-residue-class 2 ,r1))))
70 (Assert (not (comparablep 2+21Z)))
71 (Assert (not (comparablep 2+23Z)))
72 (Assert (not (comparablep 0+23Z)))
73 (Check-Error relation-error (< 2+23Z 3+23Z))
74 (Check-Error relation-error (< 2+23Z 2+21Z))
75 (Check-Error relation-error (> 2+23Z 3+23Z))
76 (Check-Error relation-error (> 2+23Z 2+21Z))
77 (Check-Error relation-error (<= 2+23Z 2+23Z))
78 (Check-Error relation-error (<= 2+23Z 3+23Z))
79 (Check-Error relation-error (<= 2+23Z 2+21Z))
80 (Check-Error relation-error (<= 2+23Z 3+21Z))
81 (Check-Error relation-error (>= 2+23Z 2+23Z))
82 (Check-Error relation-error (>= 2+23Z 3+23Z))
83 (Check-Error relation-error (>= 2+23Z 2+21Z))
84 (Check-Error relation-error (>= 2+23Z 3+21Z))
85 (Assert (= 2+23Z 2+23Z))
86 (Assert (not (/= 2+23Z 2+23Z)))
87 (Assert (/= 2+23Z 3+23Z))
88 (Assert (not (= 2+23Z 3+23Z)))
89 (Assert (= 2+23Z 25+23Z))
90 (Assert (= -2+23Z 21+23Z))
91 (Check-Error domain-error (= 2+23Z 2+22Z))
92 (Check-Error domain-error (= -2+23Z -2+2Z))
93 (Check-Error domain-error (/= 2+23Z 2+22Z))
94 (Check-Error domain-error (/= -2+23Z -2+2Z))
99 (unless (boundp 'Z/0Z)
100 (Check-Error (void-variable Z/0Z) Z/0Z))
101 (unless (boundp '0+0Z)
102 (Check-Error (void-variable 0+0Z) 0+0Z))
105 ;; ase-resclass-tests.el ends here