+
+(defmacro def-compress-test (length id)
+ (let ((len (gensym "LENGTH-")))
+ `(deftest ,(intern (format nil "Z.~D" id)
+ (find-package '#:keyword))
+ (block z
+ (let* ((,len ,length)
+ (a (make-array (list ,len) :element-type '(unsigned-byte 8))))
+ (dotimes (j ,len)
+ (setf (aref a j) (random 256)))
+ (let* ((comp (compress a))
+ (uncomp (uncompress comp)))
+ (unless (equalp a uncomp)
+ (throw 'z :error)))))
+ nil)))
+
+(def-compress-test (random 10000) 0)
+(def-compress-test (random 10000) 1)
+(def-compress-test (random 10000) 2)
+(def-compress-test (random 10000) 3)
+(def-compress-test (random 10000) 4)
+(def-compress-test (random 10000) 5)
+(def-compress-test (random 10000) 6)
+(def-compress-test (random 10000) 7)
+(def-compress-test (random 10000) 8)
+(def-compress-test (random 10000) 9)
+(def-compress-test (random 10000) 10)
+
+