annotate tests/automated/weak-tests.el @ 1758:90502933fb98

[xemacs-hg @ 2003-10-21 08:21:00 by stephent] revert "fix space leak" patch <87oewb0zqn.fsf_-_@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Tue, 21 Oct 2003 08:21:08 +0000
parents f062c28f4a11
children aa0db78e67c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
890
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
1 ;; Copyright (C) 1998 Free Software Foundation, Inc.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
2
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
3 ;; Author: Mike Sperber <mike@xemacs.org>
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
4 ;; Maintainer: Mike Sperber <mike@xemacs.org>
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
5 ;; Created: 2002
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
6 ;; Keywords: tests, database
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
7
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
8 ;; This file is part of XEmacs.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
9
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
13 ;; any later version.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
14
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
18 ;; General Public License for more details.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
19
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
23 ;; 02111-1307, USA.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
24
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
25 ;;; Synched up with: Not in FSF.
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
26
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
27 ;;; Commentary:
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
28
1636
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
29 ;;; Test implementation of weak boxes, ephemerons, and weak lists
890
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
30 ;;; See test-harness.el
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
31
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
32 (condition-case err
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
33 (require 'test-harness)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
34 (file-error
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
35 (when (and (boundp 'load-file-name) (stringp load-file-name))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
36 (push (file-name-directory load-file-name) load-path)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
37 (require 'test-harness))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
38
1758
90502933fb98 [xemacs-hg @ 2003-10-21 08:21:00 by stephent]
stephent
parents: 1636
diff changeset
39 (when test-harness-test-compiled
90502933fb98 [xemacs-hg @ 2003-10-21 08:21:00 by stephent]
stephent
parents: 1636
diff changeset
40 ;; this ha-a-ack depends on the compiled test coming last
90502933fb98 [xemacs-hg @ 2003-10-21 08:21:00 by stephent]
stephent
parents: 1636
diff changeset
41 (setq test-harness-failure-tag
90502933fb98 [xemacs-hg @ 2003-10-21 08:21:00 by stephent]
stephent
parents: 1636
diff changeset
42 "KNOWN BUG - fix reverted; after 2003-10-31 bitch at stephen\n"))
90502933fb98 [xemacs-hg @ 2003-10-21 08:21:00 by stephent]
stephent
parents: 1636
diff changeset
43
890
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
44 (garbage-collect)
1636
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
45
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
46 ;; tests for weak-boxes
890
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
47 (let ((w (make-weak-box (cons 2 3))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
48 (Assert (equal (cons 2 3) (weak-box-ref w)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
49 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
50 (Assert (not (weak-box-ref w))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
51
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
52 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
53
1636
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
54 ;; tests for ephemerons
890
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
55 (let* ((p (cons 3 4))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
56 (finalized-p nil)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
57 (eph1 (make-ephemeron (cons 1 2) p
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
58 '(lambda (value)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
59 (setq finalized-p t))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
60 (eph2 (make-ephemeron p p)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
61 (Assert (eq p (ephemeron-ref (make-ephemeron (cons 1 2) p))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
62 (Assert (ephemeron-p (make-ephemeron (cons 1 2) p)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
63
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
64 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
65 (garbage-collect) ; ensure the post-gc hook runs
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
66
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
67 (Assert finalized-p)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
68 (Assert (not (ephemeron-ref eph1)))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
69
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
70 (garbage-collect)
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
71
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
72 (Assert (eq p (ephemeron-ref eph2))))
7532e276a83a [xemacs-hg @ 2002-06-28 14:24:43 by michaels]
michaels
parents:
diff changeset
73
1636
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
74 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
75
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
76 ;; tests for simple weak-lists
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
77 (let* ((a (cons 23 42))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
78 (b (cons 42 65))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
79 (testlist (list a b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
80 (weaklist1 (make-weak-list 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
81 (weaklist2 (make-weak-list 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
82 (weaklist3 (make-weak-list 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
83 (weaklist4 (make-weak-list 'simple)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
84 (set-weak-list-list weaklist1 testlist)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
85 (set-weak-list-list weaklist2 (list (cons 1 2) a b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
86 (set-weak-list-list weaklist3 (list a (cons 1 2) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
87 (set-weak-list-list weaklist4 (list a b (cons 1 2)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
88 (Assert (weak-list-p weaklist1))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
89 (Assert (eq (weak-list-type weaklist1) 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
90 (Assert (weak-list-p weaklist2))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
91 (Assert (eq (weak-list-type weaklist2) 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
92 (Assert (weak-list-p weaklist3))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
93 (Assert (eq (weak-list-type weaklist3) 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
94 (Assert (weak-list-p weaklist4))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
95 (Assert (eq (weak-list-type weaklist4) 'simple))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
96
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
97 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
98
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
99 (Assert (eq (weak-list-list weaklist1) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
100 (Assert (equal (weak-list-list weaklist2) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
101 (Assert (equal (weak-list-list weaklist3) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
102 (Assert (equal (weak-list-list weaklist4) testlist)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
103
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
104 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
105
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
106 ;; tests for assoc weak-lists
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
107 (let* ((a (cons 23 42))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
108 (b (cons a a))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
109 (testlist (list b b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
110 (weaklist1 (make-weak-list 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
111 (weaklist2 (make-weak-list 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
112 (weaklist3 (make-weak-list 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
113 (weaklist4 (make-weak-list 'assoc)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
114 (set-weak-list-list weaklist1 testlist)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
115 (set-weak-list-list weaklist2 (list b (cons (cons 1 2) a) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
116 (set-weak-list-list weaklist3 (list b (cons a (cons 1 2)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
117 (set-weak-list-list weaklist4 (list b (cons (cons 1 2) (cons 3 4)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
118 (Assert (weak-list-p weaklist1))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
119 (Assert (eq (weak-list-type weaklist1) 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
120 (Assert (weak-list-p weaklist2))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
121 (Assert (eq (weak-list-type weaklist2) 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
122 (Assert (weak-list-p weaklist3))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
123 (Assert (eq (weak-list-type weaklist3) 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
124 (Assert (weak-list-p weaklist4))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
125 (Assert (eq (weak-list-type weaklist4) 'assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
126
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
127 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
128
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
129 (Assert (eq (weak-list-list weaklist1) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
130 (Assert (equal (weak-list-list weaklist2) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
131 (Assert (equal (weak-list-list weaklist3) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
132 (Assert (equal (weak-list-list weaklist4) testlist)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
133
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
134 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
135
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
136 ;; tests for key-assoc weak-lists
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
137 (let* ((a (cons 23 42))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
138 (b (cons a a))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
139 (testlist (list b b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
140 (weaklist1 (make-weak-list 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
141 (weaklist2 (make-weak-list 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
142 (weaklist3 (make-weak-list 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
143 (weaklist4 (make-weak-list 'key-assoc)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
144 (set-weak-list-list weaklist1 testlist)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
145 (set-weak-list-list weaklist2 (list b (cons (cons 1 2) a) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
146 (set-weak-list-list weaklist3 (list b (cons a (cons 1 2)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
147 (set-weak-list-list weaklist4 (list b (cons (cons 1 2) (cons 3 4)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
148 (Assert (weak-list-p weaklist1))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
149 (Assert (eq (weak-list-type weaklist1) 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
150 (Assert (weak-list-p weaklist2))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
151 (Assert (eq (weak-list-type weaklist2) 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
152 (Assert (weak-list-p weaklist3))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
153 (Assert (eq (weak-list-type weaklist3) 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
154 (Assert (weak-list-p weaklist4))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
155 (Assert (eq (weak-list-type weaklist4) 'key-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
156
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
157 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
158
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
159 (Assert (eq (weak-list-list weaklist1) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
160 (Assert (equal (weak-list-list weaklist2) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
161 (Assert (equal (weak-list-list weaklist3) (list b (cons a (cons 1 2)) b)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
162 (Assert (equal (weak-list-list weaklist4) testlist)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
163
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
164 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
165
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
166 ;; tests for value-assoc weak-lists
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
167 (let* ((a (cons 23 42))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
168 (b (cons a a))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
169 (testlist (list b b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
170 (weaklist1 (make-weak-list 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
171 (weaklist2 (make-weak-list 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
172 (weaklist3 (make-weak-list 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
173 (weaklist4 (make-weak-list 'value-assoc)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
174 (set-weak-list-list weaklist1 testlist)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
175 (set-weak-list-list weaklist2 (list b (cons (cons 1 2) a) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
176 (set-weak-list-list weaklist3 (list b (cons a (cons 1 2)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
177 (set-weak-list-list weaklist4 (list b (cons (cons 1 2) (cons 3 4)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
178 (Assert (weak-list-p weaklist1))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
179 (Assert (eq (weak-list-type weaklist1) 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
180 (Assert (weak-list-p weaklist2))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
181 (Assert (eq (weak-list-type weaklist2) 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
182 (Assert (weak-list-p weaklist3))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
183 (Assert (eq (weak-list-type weaklist3) 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
184 (Assert (weak-list-p weaklist4))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
185 (Assert (eq (weak-list-type weaklist4) 'value-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
186
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
187 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
188
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
189 (Assert (eq (weak-list-list weaklist1) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
190 (Assert (equal (weak-list-list weaklist2) (list b (cons (cons 1 2) a) b)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
191 (Assert (equal (weak-list-list weaklist3) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
192 (Assert (equal (weak-list-list weaklist4) testlist)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
193
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
194 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
195
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
196 ;; tests for full-assoc weak-lists
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
197 (let* ((a (cons 23 42))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
198 (b (cons a a))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
199 (testlist (list b b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
200 (weaklist1 (make-weak-list 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
201 (weaklist2 (make-weak-list 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
202 (weaklist3 (make-weak-list 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
203 (weaklist4 (make-weak-list 'full-assoc)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
204 (set-weak-list-list weaklist1 testlist)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
205 (set-weak-list-list weaklist2 (list b (cons (cons 1 2) a) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
206 (set-weak-list-list weaklist3 (list b (cons a (cons 1 2)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
207 (set-weak-list-list weaklist4 (list b (cons (cons 1 2) (cons 3 4)) b))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
208 (Assert (weak-list-p weaklist1))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
209 (Assert (eq (weak-list-type weaklist1) 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
210 (Assert (weak-list-p weaklist2))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
211 (Assert (eq (weak-list-type weaklist2) 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
212 (Assert (weak-list-p weaklist3))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
213 (Assert (eq (weak-list-type weaklist3) 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
214 (Assert (weak-list-p weaklist4))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
215 (Assert (eq (weak-list-type weaklist4) 'full-assoc))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
216
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
217 (garbage-collect)
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
218
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
219 (Assert (eq (weak-list-list weaklist1) testlist))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
220 (Assert (equal (weak-list-list weaklist2) (list b (cons (cons 1 2) a) b)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
221 (Assert (equal (weak-list-list weaklist3) (list b (cons a (cons 1 2)) b)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
222 (Assert (equal (weak-list-list weaklist4) testlist)))
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
223
f062c28f4a11 [xemacs-hg @ 2003-08-20 11:53:41 by crestani]
crestani
parents: 890
diff changeset
224 (garbage-collect)