1
;; A practical implementation for the Scheme programming language
10
;; Copyright (c) 1992-2004 Manuel Serrano
12
;; Bug descriptions, use reports, comments or suggestions are
13
;; welcome. Send them to
14
;; bigloo@sophia.inria.fr
15
;; http://www.inria.fr/mimosa/fp/Bigloo
17
;; This program is free software; you can redistribute it and/or modify
18
;; it under the terms of the GNU General Public License as published by
19
;; the Free Software Foundation; either version 2 of the License, or
20
;; (at your option) any later version. More precisely,
22
;; - The compiler and the tools are distributed under the terms of the
23
;; GNU General Public License.
25
;; - The Bigloo run-time system and the libraries are distributed under
26
;; the terms of the GNU Library General Public License. The source code
27
;; of the Bigloo runtime system is located in the ./runtime directory.
28
;; The source code of the FairThreads library is located in the
29
;; ./fthread directory.
31
;; This program is distributed in the hope that it will be useful,
32
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
33
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
;; GNU General Public License for more details.
36
;; You should have received a copy of the GNU General Public
37
;; License along with this program; if not, write to the Free
38
;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
39
;; MA 02111-1307, USA.
41
;*---------------------------------------------------------------------*/
42
;* serrano/prgm/project/bigloo/recette/bool.scm */
44
;* Author : Manuel Serrano */
45
;* Creation : Tue Nov 3 09:16:12 1992 */
46
;* Last change : Wed Apr 1 14:05:49 1998 (serrano) */
48
;* On test les operations booleenes. */
49
;*---------------------------------------------------------------------*/
53
;; 2005-08-18 kzk Copied from Bigloo 2.6e and adapted to SigScheme
55
(load "./test/unittest-bigloo.scm")
57
;*---------------------------------------------------------------------*/
59
;*---------------------------------------------------------------------*/
63
;*---------------------------------------------------------------------*/
64
;* faux-predicat ... */
65
;*---------------------------------------------------------------------*/
66
(define (faux-predicat x)
69
;*---------------------------------------------------------------------*/
71
;*---------------------------------------------------------------------*/
72
(define (encore-faux x)
75
;*---------------------------------------------------------------------*/
76
;* local-pred-1 ... */
77
;*---------------------------------------------------------------------*/
78
(define (local-pred-1 x)
79
(let ((pred (lambda (x) (< x 3))))
82
;*---------------------------------------------------------------------*/
83
;* local-pred-2 ... */
84
;*---------------------------------------------------------------------*/
85
(define (local-pred-2 x)
86
(let* ((foo (lambda (x) (< x 3)))
87
(bar (lambda (x) (if (foo x) 3 4)))
88
(gee (lambda (x) (if (foo x) 3 4))))
93
;*---------------------------------------------------------------------*/
94
;* local-pred-3 ... */
95
;*---------------------------------------------------------------------*/
96
(define (local-pred-3 x)
97
(let ((pred (lambda (x) (< x 3))))
100
;*---------------------------------------------------------------------*/
102
;*---------------------------------------------------------------------*/
104
(test "or" (or #f #f) #f)
105
(test "not" (not #f) #t)
106
(test "and" (and #t #t) #t)
107
(test "and" (and #t #f) #f)
108
(test "if" (let ((x 1)) (if x x)) 1)
109
(test "ifnot" (let ((x 1)) (if (not x) #t #f)) #f)
110
(test "ifor" (let ((x 1) (y #f)) (if (or x y) x y)) 1)
111
(test "ifand" (let ((x 1) (y #f)) (if (and x y) #t #f)) #f)
112
(test "pred" (if (predicat 6) #t #f) #t)
113
(test "faux" (if (faux-predicat 6) (faux-predicat 7) (faux-predicat 3)) #t)
114
(test "encore-faux" (if (encore-faux 6) #t #f) #t)
115
(test "local-pred-1" (local-pred-1 1) #t)
116
(test "local-pred-2" (local-pred-2 1) #t)
117
(test "local-pred-3" (if (local-pred-3 1) #t #f) #t))