1 ;;;; srfi-111.test --- Test suite for SRFI-111 (Boxes). -*- scheme -*-
3 ;;;; Copyright (C) 2014 Free Software Foundation, Inc.
5 ;;;; This library is free software; you can redistribute it and/or
6 ;;;; modify it under the terms of the GNU Lesser General Public
7 ;;;; License as published by the Free Software Foundation; either
8 ;;;; version 3 of the License, or (at your option) any later version.
10 ;;;; This library is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;;; Lesser General Public License for more details.
15 ;;;; You should have received a copy of the GNU Lesser General Public
16 ;;;; License along with this library; if not, write to the Free Software
17 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 (define-module (test-srfi-111)
20 #:use-module (test-suite lib)
21 #:use-module (srfi srfi-1)
22 #:use-module (srfi srfi-111))
24 (with-test-prefix "srfi-111"
26 (let ((test-vals '(#f #t #\space "string" -5 #e1e100 1e-30 #(a vector))))
27 (pass-if-equal "box and unbox"
35 (not (any box? test-vals))))
37 (pass-if-equal "set-box!"
43 (pass-if "eq? on boxes"
48 (not (eq? box1 box2)))))
50 (pass-if "eqv? on boxes"
55 (not (eqv? box1 box2)))))
57 (pass-if "equal? on boxes"
58 (let ((box1 (box "foo"))
60 (and (equal? box1 box1)
62 (not (equal? box1 box2))
63 ;; Guile extension, not guaranteed by SRFI-111.
64 (begin (set-box! box2 (string #\f #\o #\o))
65 (equal? box1 box2)))))))