source: trunk/source/tests/ansi-tests/bit-aux.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 731 bytes
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Jul 24 19:25:39 2005
4;;;; Contains: Aux file for BIT-* tests
5
6(in-package :cl-test)
7
8(defun bit-random-test-fn (bit-fn log-fn &key (reps 5000) (maxlen 100))
9  (assert (typep maxlen '(integer 1)))
10  (assert (typep reps 'unsigned-byte))
11  (loop for len = (random maxlen)
12        for twos = (make-list len :initial-element 2)
13        for v1 = (map 'bit-vector #'random twos)
14        for v2 = (map 'bit-vector #'random twos)
15        for result = (funcall bit-fn v1 v2)
16        repeat reps
17        unless (and (= (length result) len)
18                    (every #'(lambda (result-bit v1-bit v2-bit)
19                               (= result-bit (logand 1 (funcall log-fn v1-bit v2-bit))))
20                           result v1 v2))
21        collect (list len v1 v2 result)))
22
Note: See TracBrowser for help on using the repository browser.