1
;*---------------------------------------------------------------------*/
2
;* serrano/prgm/project/bigloo/recette/bool.scm */
4
;* Author : Manuel Serrano */
5
;* Creation : Tue Nov 3 09:16:12 1992 */
6
;* Last change : Wed Apr 1 14:05:49 1998 (serrano) */
8
;* On test les operations booleenes. */
9
;*---------------------------------------------------------------------*/
11
(load "./test/unittest-bigloo.scm")
13
;*---------------------------------------------------------------------*/
15
;*---------------------------------------------------------------------*/
19
;*---------------------------------------------------------------------*/
20
;* faux-predicat ... */
21
;*---------------------------------------------------------------------*/
22
(define (faux-predicat x)
25
;*---------------------------------------------------------------------*/
27
;*---------------------------------------------------------------------*/
28
(define (encore-faux x)
31
;*---------------------------------------------------------------------*/
32
;* local-pred-1 ... */
33
;*---------------------------------------------------------------------*/
34
(define (local-pred-1 x)
35
(let ((pred (lambda (x) (< x 3))))
38
;*---------------------------------------------------------------------*/
39
;* local-pred-2 ... */
40
;*---------------------------------------------------------------------*/
41
(define (local-pred-2 x)
42
(let* ((foo (lambda (x) (< x 3)))
43
(bar (lambda (x) (if (foo x) 3 4)))
44
(gee (lambda (x) (if (foo x) 3 4))))
49
;*---------------------------------------------------------------------*/
50
;* local-pred-3 ... */
51
;*---------------------------------------------------------------------*/
52
(define (local-pred-3 x)
53
(let ((pred (lambda (x) (< x 3))))
56
;*---------------------------------------------------------------------*/
58
;*---------------------------------------------------------------------*/
60
(test "or" (or #f #f) #f)
61
(test "not" (not #f) #t)
62
(test "and" (and #t #t) #t)
63
(test "and" (and #t #f) #f)
64
(test "if" (let ((x 1)) (if x x)) 1)
65
(test "ifnot" (let ((x 1)) (if (not x) #t #f)) #f)
66
(test "ifor" (let ((x 1) (y #f)) (if (or x y) x y)) 1)
67
(test "ifand" (let ((x 1) (y #f)) (if (and x y) #t #f)) #f)
68
(test "pred" (if (predicat 6) #t #f) #t)
69
(test "faux" (if (faux-predicat 6) (faux-predicat 7) (faux-predicat 3)) #t)
70
(test "encore-faux" (if (encore-faux 6) #t #f) #t)
71
(test "local-pred-1" (local-pred-1 1) #t)
72
(test "local-pred-2" (local-pred-2 1) #t)
73
(test "local-pred-3" (if (local-pred-3 1) #t #f) #t))