Commit | Line | Data |
---|---|---|
e757438d DH |
1 | ;;;; pairs.test --- test suite for Guile's pair functions -*- scheme -*- |
2 | ;;;; | |
3 | ;;;; Copyright (C) 2003 Free Software Foundation, Inc. | |
4 | ;;;; | |
5 | ;;;; This program is free software; you can redistribute it and/or modify | |
6 | ;;;; it under the terms of the GNU General Public License as published by | |
7 | ;;;; the Free Software Foundation; either version 2, or (at your option) | |
8 | ;;;; any later version. | |
9 | ;;;; | |
10 | ;;;; This program is distributed in the hope that it will be useful, | |
11 | ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | ;;;; GNU General Public License for more details. | |
14 | ;;;; | |
15 | ;;;; You should have received a copy of the GNU General Public License | |
16 | ;;;; along with this software; see the file COPYING. If not, write to | |
92205699 MV |
17 | ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | ;;;; Boston, MA 02110-1301 USA | |
e757438d DH |
19 | |
20 | ||
21 | (use-modules (test-suite lib)) | |
22 | ||
23 | (with-test-prefix "cxr" | |
24 | ||
25 | (define x | |
26 | '(1 . 2)) | |
27 | ||
28 | (pass-if "car" | |
29 | (= (car x) 1)) | |
30 | ||
31 | (pass-if "cdr" | |
32 | (= (cdr x) 2))) | |
33 | ||
34 | (with-test-prefix "cxxr" | |
35 | ||
36 | (define x | |
37 | '((1 . 3) 2 . 4)) | |
38 | ||
39 | (pass-if "caar" | |
40 | (= (caar x) 1)) | |
41 | ||
42 | (pass-if "cadr" | |
43 | (= (cadr x) 2)) | |
44 | ||
45 | (pass-if "cdar" | |
46 | (= (cdar x) 3)) | |
47 | ||
48 | (pass-if "cddr" | |
49 | (= (cddr x) 4))) | |
50 | ||
51 | (with-test-prefix "cxxxr" | |
52 | ||
53 | (define x | |
54 | '(((1 . 5) 3 . 7) (2 . 6) 4 . 8)) | |
55 | ||
56 | (pass-if "caaar" | |
57 | (= (caaar x) 1)) | |
58 | ||
59 | (pass-if "caadr" | |
60 | (= (caadr x) 2)) | |
61 | ||
62 | (pass-if "cadar" | |
63 | (= (cadar x) 3)) | |
64 | ||
65 | (pass-if "caddr" | |
66 | (= (caddr x) 4)) | |
67 | ||
68 | (pass-if "cdaar" | |
69 | (= (cdaar x) 5)) | |
70 | ||
71 | (pass-if "cdadr" | |
72 | (= (cdadr x) 6)) | |
73 | ||
74 | (pass-if "cddar" | |
75 | (= (cddar x) 7)) | |
76 | ||
77 | (pass-if "cdddr" | |
78 | (= (cdddr x) 8))) | |
79 | ||
80 | (with-test-prefix "cxxxxr" | |
81 | ||
82 | (define x | |
83 | '((((1 . 9) 5 . 13) (3 . 11) 7 . 15) ((2 . 10) 6 . 14) (4 . 12) 8 . 16)) | |
84 | ||
85 | (pass-if "caaaar" | |
86 | (= (caaaar x) 1)) | |
87 | ||
88 | (pass-if "caaadr" | |
89 | (= (caaadr x) 2)) | |
90 | ||
91 | (pass-if "caadar" | |
92 | (= (caadar x) 3)) | |
93 | ||
94 | (pass-if "caaddr" | |
95 | (= (caaddr x) 4)) | |
96 | ||
97 | (pass-if "cadaar" | |
98 | (= (cadaar x) 5)) | |
99 | ||
100 | (pass-if "cadadr" | |
101 | (= (cadadr x) 6)) | |
102 | ||
103 | (pass-if "caddar" | |
104 | (= (caddar x) 7)) | |
105 | ||
106 | (pass-if "cadddr" | |
107 | (= (cadddr x) 8)) | |
108 | ||
109 | (pass-if "cdaaar" | |
110 | (= (cdaaar x) 9)) | |
111 | ||
112 | (pass-if "cdaadr" | |
113 | (= (cdaadr x) 10)) | |
114 | ||
115 | (pass-if "cdadar" | |
116 | (= (cdadar x) 11)) | |
117 | ||
118 | (pass-if "cdaddr" | |
119 | (= (cdaddr x) 12)) | |
120 | ||
121 | (pass-if "cddaar" | |
122 | (= (cddaar x) 13)) | |
123 | ||
124 | (pass-if "cddadr" | |
125 | (= (cddadr x) 14)) | |
126 | ||
127 | (pass-if "cdddar" | |
128 | (= (cdddar x) 15)) | |
129 | ||
130 | (pass-if "cddddr" | |
131 | (= (cddddr x) 16))) |