;;;; symbols.test --- test suite for Guile's symbols -*- scheme -*- ;;;; ;;;; Copyright (C) 2001, 2006 Free Software Foundation, Inc. ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 2, or (at your option) ;;;; any later version. ;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this software; see the file COPYING. If not, write to ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;;;; Boston, MA 02110-1301 USA ;;; ;;; if, not ;;; (pass-if "true" #t) (pass-if "false" (not #f)) (pass-if "if true" (if #t #t #f)) (pass-if "if false" (if #f #f #t)) ;;; ;;; and, or ;;; (pass-if "(and)" (and)) (pass-if "and t" (and #t)) (pass-if "and f" (not (and #f))) (pass-if "and tt" (and #t #t)) (pass-if "and tf" (not (and #t #f))) (pass-if "and ft" (not (and #f #t))) (pass-if "and ff" (not (and #f #f))) (pass-if "and ttt" (and #t #t #t)) (pass-if "and ttf" (not (and #t #t #f))) (pass-if "and tft" (not (and #t #f #t))) (pass-if "and tff" (not (and #t #f #f))) (pass-if "and ftt" (not (and #f #t #t))) (pass-if "and ftf" (not (and #f #t #f))) (pass-if "and fft" (not (and #f #f #t))) (pass-if "and fff" (not (and #f #f #f))) (pass-if "and ()" (and-map identity '())) (pass-if "and (t)" (and-map identity '(#t))) (pass-if "and (tt)" (and-map identity '(#t #t))) (pass-if "and (ttt)" (and-map identity '(#t #t #t))) (pass-if "and (ttf)" (not (and-map identity '(#t #t #f)))) (pass-if "and (fff)" (and-map not '(#f #f #f))) (pass-if "and (123)" (equal? 3 (and 1 2 3))) (pass-if "3=and(123)" (equal? 3 (and-map identity '(1 2 3)))) (pass-if "5=and(123)+2" (equal? 5 (and-map (lambda (x) (+ 2 x)) '(1 2 3)))) (pass-if "(or)" (not (or))) (pass-if "or t" (or #t)) (pass-if "or f" (not (or #f))) (pass-if "or tt" (or #t #t)) (pass-if "or tf" (or #t #f)) (pass-if "or ft" (or #f #t)) (pass-if "or ff" (not (or #f #f))) (pass-if "or ttt" (or #t #t #t)) (pass-if "or ttf" (or #t #t #f)) (pass-if "or tft" (or #t #f #t)) (pass-if "or tff" (or #t #f #f)) (pass-if "or ftt" (or #f #t #t)) (pass-if "or ftf" (or #f #t #f)) (pass-if "or fft" (or #f #f #t)) (pass-if "or fff" (not (or #f #f #f))) (pass-if "or ()" (not (or-map identity '()))) (pass-if "or (t)" (or-map identity '(#t))) (pass-if "or (ft)" (or-map identity '(#f #t))) (pass-if "or (fft)" (or-map identity '(#f #f #t))) (pass-if "or (fff)" (not (or-map identity '(#f #f #f)))) (pass-if "or (ff3)" (equal? 3 (or #f #f 3))) (pass-if "3=or(ff3)" (equal? 3 (or-map identity '(#f #f 3)))) (pass-if "or not(ttf)" (or-map not '(#t #t #f))) (pass-if "-1=or(123)-2" (equal? -1 (or-map (lambda (x) (- x 2)) '(1 2 3)))) ;;; ;;; and and or as arguments ;;; (let ((apply2 (lambda (f a b) (f a b)))) (pass-if "apply and(tf)=f" (not (apply2 and #t #f))) (pass-if "apply or(tf)=t" (apply2 or #t #f)) (pass-if "apply and(tf)=t" (apply2 and #f #t)))