projects
/
fiveam.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c2915e3
)
Added gen-buffer generator
author
Marco Baringer
<mb@bese.it>
Mon, 13 Mar 2006 21:54:03 +0000
(22:54 +0100)
committer
Marco Baringer
<mb@bese.it>
Mon, 13 Mar 2006 21:54:03 +0000
(22:54 +0100)
src/packages.lisp
patch
|
blob
|
history
src/random.lisp
patch
|
blob
|
history
diff --git
a/src/packages.lisp
b/src/packages.lisp
index
3177b8b
..
7828de5
100644
(file)
--- a/
src/packages.lisp
+++ b/
src/packages.lisp
@@
-50,6
+50,7
@@
#:gen-character
#:gen-string
#:gen-list
+ #:gen-buffer
;; running tests
#:run
#:run-all-tests
diff --git
a/src/random.lisp
b/src/random.lisp
index
f2d8a0a
..
e869a1c
100644
(file)
--- a/
src/random.lisp
+++ b/
src/random.lisp
@@
-234,5
+234,12
@@
producs objects."
repeat (funcall length)
collect (funcall elements))))
+(defun gen-buffer (&key (length (gen-integer :min 0 :max 50))
+ (element-type '(unsigned-byte 8))
+ (elements (gen-integer :min 0 :max (1- (expt 2 8)))))
+ (lambda ()
+ (let ((buffer (make-array (funcall length) :element-type element-type)))
+ (map-into buffer elements))))
+
;;;; The trivial always-produce-the-same-thing generator is done using
;;;; cl:constantly.