summaryrefslogtreecommitdiff
path: root/test-suite/tests/srfi-39.test
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2004-08-15 20:26:05 +0000
committerMarius Vollmer <mvo@zagadka.de>2004-08-15 20:26:05 +0000
commit3514320f60c5c77716691055c8e2a6eeae7681e6 (patch)
tree99f937a32bc836b7a94c13da3b688ca349c81d1f /test-suite/tests/srfi-39.test
parent80b707b7541e84db6533907fed31efa2dd264ca3 (diff)
downloadguile-3514320f60c5c77716691055c8e2a6eeae7681e6.tar.gz
New, from Jose A Ortega Ruiz. Thanks!
Diffstat (limited to 'test-suite/tests/srfi-39.test')
-rw-r--r--test-suite/tests/srfi-39.test54
1 files changed, 54 insertions, 0 deletions
diff --git a/test-suite/tests/srfi-39.test b/test-suite/tests/srfi-39.test
new file mode 100644
index 000000000..22d2bd056
--- /dev/null
+++ b/test-suite/tests/srfi-39.test
@@ -0,0 +1,54 @@
+;;;; srfi-39.test --- -*- scheme -*-
+;;;;
+;;;; Copyright (C) 2004 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., 59 Temple Place, Suite 330,
+;;;; Boston, MA 02111-1307 USA
+
+(use-modules (srfi srfi-39))
+
+(define a (make-parameter 3))
+(define b (make-parameter 4))
+
+(define (check a b a-val b-val)
+ (and (eqv? (a) a-val)) (eqv? (b) b-val))
+
+(define c (make-parameter 2 (lambda (x) (if (< x 10) x 10))))
+(define d (make-parameter 15 (lambda (x) (if (< x 10) x 10))))
+
+(with-test-prefix "SRFI-39"
+
+ (pass-if "test 1"
+ (check a b 3 4))
+
+ (pass-if "test 2"
+ (parameterize ((a 2) (b 1))
+ (and (check a b 2 1)
+ (parameterize ((b 8))
+ (check a b 2 8)))))
+
+ (pass-if "test 3"
+ (check a b 3 4))
+
+ (pass-if "test 4"
+ (check c d 2 10))
+
+ (pass-if "test 5"
+ (parameterize ((a 0) (b 1) (c 98) (d 9))
+ (and (check a b 0 1)
+ (check c d 10 9)
+ (parameterize ((c (a)) (d (b)))
+ (and (check a b 0 1)
+ (check c d 0 1)))))))