1 ;;;; srfi-9.test --- Test suite for Guile's SRFI-9 functions. -*- scheme -*-
2 ;;;; Martin Grabmueller, 2001-05-10
4 ;;;; Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc.
6 ;;;; This program is free software; you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation; either version 2, or (at your option)
9 ;;;; any later version.
11 ;;;; This program is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;;; GNU General Public License for more details.
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with this software; see the file COPYING. If not, write to
18 ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 ;;;; Boston, MA 02110-1301 USA
21 (define-module (test-suite test-numbers)
22 #:use-module (test-suite lib)
23 #:use-module (srfi srfi-9))
26 (define-record-type :foo (make-foo x) foo?
27 (x get-x) (y get-y set-y!))
29 (define-record-type :bar (make-bar i j) bar?
30 (i get-i) (i get-j set-j!))
32 (define f (make-foo 1))
35 (define b (make-bar 123 456))
37 (with-test-prefix "constructor"
39 (pass-if-exception "foo 0 args" exception:wrong-num-args
41 (pass-if-exception "foo 2 args" exception:wrong-num-args
44 (with-test-prefix "predicate"
48 (pass-if "fail wrong record type"
50 (pass-if "fail number"
53 (with-test-prefix "accessor"
60 (pass-if-exception "get-x on number" exception:wrong-type-arg
62 (pass-if-exception "get-y on number" exception:wrong-type-arg
65 ;; prior to guile 1.6.9 and 1.8.1 this wan't enforced
66 (pass-if-exception "get-x on bar" exception:wrong-type-arg
68 (pass-if-exception "get-y on bar" exception:wrong-type-arg
71 (with-test-prefix "modifier"
77 (pass-if-exception "set-y! on number" exception:wrong-type-arg
80 ;; prior to guile 1.6.9 and 1.8.1 this wan't enforced
81 (pass-if-exception "set-y! on bar" exception:wrong-type-arg