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