1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-26 15:21:51 -08:00
emacs/mps/example/scheme/test-leaf.scm
Gareth Rees a53d45c5c7 Change file types to text+k.
Copied from Perforce
 Change: 192578
 ServerID: perforce.ravenbrook.com
2016-10-14 12:40:35 +01:00

16 lines
539 B
Scheme

;;; test-leaf.scm -- test leaf objects
;;; $Id$
;;; This test case creates many leaf objects (strings and integers).
(load "test-common.scm")
(define (triangle n) (if (eqv? n 0) 0 (+ n (triangle (- n 1)))))
(check '(triangle 10000) 50005000)
(check '(length (range 1000)) 1000)
(check '(let ((f (lambda (n) (make-string n #\x))))
(string-length (apply string-append (map f (range 100)))))
(triangle 100))
(check '(sum (map (lambda (n) (sum (range n))) (range 800))) 85653600)
(write-string "All tests pass.")
(newline)