mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-18 18:40:22 +02:00
new file.
This commit is contained in:
parent
68a9c6bc99
commit
819f477aba
2 changed files with 91 additions and 0 deletions
34
test-suite/tests/srfi-31.test
Normal file
34
test-suite/tests/srfi-31.test
Normal file
|
@ -0,0 +1,34 @@
|
|||
;;;; srfi-31.test --- Test suite for Guile's SRFI-31 functions. -*- 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-31))
|
||||
|
||||
(with-test-prefix "rec special form"
|
||||
|
||||
(pass-if "rec expressions"
|
||||
(let ((ones-list (rec ones (cons 1 (delay ones)))))
|
||||
(and (= 1 (car ones-list))
|
||||
(= 1 (car (force (cdr ones-list)))))))
|
||||
|
||||
(pass-if "rec functions"
|
||||
(let ((test-func (rec (add-upto n)
|
||||
(if (positive? n)
|
||||
(+ n (add-upto (- n 1)))
|
||||
0))))
|
||||
(= 15 (test-func 5)))))
|
Loading…
Add table
Add a link
Reference in a new issue